|
@@ -255,10 +255,11 @@ class StoreOrderController
|
|
|
$orderInfo = $this->services->get(['order_id' => $uni]);
|
|
$orderInfo = $this->services->get(['order_id' => $uni]);
|
|
|
$uid = $type == 1 ? (int)$request->uid() : $orderInfo->uid;
|
|
$uid = $type == 1 ? (int)$request->uid() : $orderInfo->uid;
|
|
|
$orderInfo->is_channel = $this->getChennel[$request->getFromType()] ?? ($request->isApp() ? 0 : 1);
|
|
$orderInfo->is_channel = $this->getChennel[$request->getFromType()] ?? ($request->isApp() ? 0 : 1);
|
|
|
|
|
+ $orderInfo->order_id = $uid != $orderInfo->pay_uid ? app()->make(StoreOrderCreateServices::class)->getNewOrderId('cp') : $uni;
|
|
|
$orderInfo->pay_uid = $uid;
|
|
$orderInfo->pay_uid = $uid;
|
|
|
$orderInfo->save();
|
|
$orderInfo->save();
|
|
|
$orderInfo = $orderInfo->toArray();
|
|
$orderInfo = $orderInfo->toArray();
|
|
|
- $order = $this->services->get(['order_id' => $uni]);
|
|
|
|
|
|
|
+ $order = $this->services->get(['order_id' => $orderInfo['order_id']]);
|
|
|
if (!$order)
|
|
if (!$order)
|
|
|
return app('json')->fail(410173);
|
|
return app('json')->fail(410173);
|
|
|
if ($order['paid'])
|
|
if ($order['paid'])
|
|
@@ -793,4 +794,42 @@ class StoreOrderController
|
|
|
$cartProduct['order_id'] = $this->services->value(['id' => $cartInfo['oid']], 'order_id');
|
|
$cartProduct['order_id'] = $this->services->value(['id' => $cartInfo['oid']], 'order_id');
|
|
|
return app('json')->success($cartProduct);
|
|
return app('json')->success($cartProduct);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 商家寄件回调
|
|
|
|
|
+ * @param Request $request
|
|
|
|
|
+ * @return \think\Response
|
|
|
|
|
+ * @author 等风来
|
|
|
|
|
+ * @email 136327134@qq.com
|
|
|
|
|
+ * @date 2023/6/12
|
|
|
|
|
+ */
|
|
|
|
|
+ public function callBack(Request $request)
|
|
|
|
|
+ {
|
|
|
|
|
+ $data = $request->postMore([
|
|
|
|
|
+ ['t', ''],
|
|
|
|
|
+ ['sign', ''],
|
|
|
|
|
+ ['type', ''],
|
|
|
|
|
+ ['data', ''],
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ if (md5(json_encode($data['data']) . $data['t']) != $data['sign']) {
|
|
|
|
|
+ return app('json')->fail();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ switch ($data['type']) {
|
|
|
|
|
+ case 'order_success':
|
|
|
|
|
+ $update = [
|
|
|
|
|
+ 'label' => $data['data']['label'] ?? '',
|
|
|
|
|
+ ];
|
|
|
|
|
+ if (isset($data['kuaidinum'])) {
|
|
|
|
|
+ $update['delivery_id'] = $data['kuaidinum'];
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isset($data['task_id'])) {
|
|
|
|
|
+ $this->services->update(['task_id' => $data['task_id']], $update);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return app('json')->success();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|