feat: 接口完善
parent
989542e814
commit
9579abbb20
|
@ -6,6 +6,7 @@ use app\api\logic\OrderInvoiceLogic;
|
|||
use app\api\logic\OrderLogic;
|
||||
use app\api\validate\OrderValidate;
|
||||
use app\common\basics\Api;
|
||||
use app\common\enum\ClientEnum;
|
||||
use app\common\server\ConfigServer;
|
||||
use app\common\server\JsonServer;
|
||||
|
||||
|
@ -60,6 +61,9 @@ class Order extends Api
|
|||
$post = $this->request->post();
|
||||
$post['user_id'] = $this->user_id;
|
||||
$post['client'] = $this->client;
|
||||
if ($this->client == ClientEnum::api) {
|
||||
$post['is_api'] = 1;//通过三方API生成的订单
|
||||
}
|
||||
(new OrderValidate())->goCheck('add', $post);
|
||||
$order = OrderLogic::add($post);
|
||||
if (false === $order) {
|
||||
|
|
|
@ -244,7 +244,11 @@ class OrderLogic extends Logic
|
|||
public static function settlement($post)
|
||||
{
|
||||
if (!empty($post['goods'])) {
|
||||
$goods = json_decode($post['goods'], true);
|
||||
if (!is_array($post['goods'])) {
|
||||
$goods = json_decode($post['goods'], true);
|
||||
} else {
|
||||
$goods = $post['goods'];
|
||||
}
|
||||
$post['goods'] = $goods;
|
||||
} else {
|
||||
$where = [[
|
||||
|
@ -847,7 +851,11 @@ class OrderLogic extends Logic
|
|||
{
|
||||
$Order = new Order();
|
||||
|
||||
$remarks = isset($post['remark']) ? json_decode($post['remark'], true) : '';
|
||||
if (!empty($post['remark']) && is_array($post['remark'])) {
|
||||
$remarks = $post['remark'];
|
||||
} else {
|
||||
$remarks = isset($post['remark']) ? json_decode($post['remark'], true) : '';
|
||||
}
|
||||
if ($remarks != '') {
|
||||
foreach ($remarks as $key => $value) {
|
||||
$user_remark[$value['shop_id']] = $value['remark'];
|
||||
|
@ -893,7 +901,13 @@ class OrderLogic extends Logic
|
|||
}
|
||||
}
|
||||
|
||||
$isApi = 0;
|
||||
if (!empty($post['is_api'])) {
|
||||
$isApi = $post['is_api'];
|
||||
}
|
||||
|
||||
$order_data = [];
|
||||
$order_data['is_api'] = $isApi;//是否是通过第三方接口请求生成的订单
|
||||
$order_data['trade_id'] = $order_id;
|
||||
$order_data['shop_id'] = $shop_id;
|
||||
$order_data['user_id'] = $post['user_id'];
|
||||
|
|
|
@ -10,7 +10,7 @@ use app\common\logic\SmsLogic;
|
|||
class LoginValidate extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'client' => 'require|in:1,2,3,4,5,6',
|
||||
'client' => 'require|in:1,2,3,4,5,6,7,8',
|
||||
'mobile' => 'require|mobile',
|
||||
'password' => 'require|checkPassword',
|
||||
'code' => 'require|checkCode'
|
||||
|
|
Loading…
Reference in New Issue