|
|
@@ -384,6 +384,7 @@ class DouYinService
|
|
|
$payNotifyUrl = 'https://weixiudev.kyjlkj.com/api/dou_yin/payTailNotify';
|
|
|
}else{
|
|
|
// 创建首单 goods_id user_info.mobile user_id quantity
|
|
|
+ $params['cp_extra']['item_order_info_list'] = $params['item_order_info_list'];
|
|
|
$order_number = self::submitOrder([
|
|
|
'open_id'=>$params['open_id'],
|
|
|
'order_id'=>$params['order_id'], // 抖音订单号
|
|
|
@@ -469,7 +470,7 @@ class DouYinService
|
|
|
$out_order_no = $params['out_order_no'];
|
|
|
$pay_time = time();
|
|
|
$order = DouyinOrder::where('order_number', $out_order_no)->findOrEmpty();
|
|
|
- if(!$order->isEmpty()){
|
|
|
+ if(!$order->isEmpty() && empty($order->consultation_id)){
|
|
|
// 更新充值订单状态
|
|
|
$order->transaction_id = $transaction_id;
|
|
|
$order->order_status = 2;
|
|
|
@@ -658,7 +659,7 @@ class DouYinService
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
$order = DouyinOrder::where('order_number', $params['order_number'])->findOrEmpty();
|
|
|
- if(!$order->isEmpty()){
|
|
|
+ if(!$order->isEmpty() && $order->consultation_id && empty($order->work_id)){
|
|
|
$consultation = ExternalConsultation::where('id', $order->consultation_id)->findOrEmpty()->toArray();
|
|
|
$consultation['user_name'] = $params['user_name']??$consultation['user_name'];
|
|
|
$consultation['mobile'] = $params['mobile']??$consultation['mobile'];
|
|
|
@@ -681,6 +682,12 @@ class DouYinService
|
|
|
$params['consultationOrderId'] = $consultationOrderId;
|
|
|
$params['open_id'] = $order->open_id;
|
|
|
$params['goods_id'] = $order->goods_id;
|
|
|
+ }elseif ($order->consultation_id && $order->work_id){
|
|
|
+ $consultationOrderId = ExternalConsultationOrder::where('work_id', $order->work_id)->where('consultation_id', $order->consultation_id)->value('id')??0;
|
|
|
+ $params['dy_order_id'] = $order->dy_order_id;
|
|
|
+ $params['consultationOrderId'] = $consultationOrderId;
|
|
|
+ $params['open_id'] = $order->open_id;
|
|
|
+ $params['goods_id'] = $order->goods_id;
|
|
|
}
|
|
|
Db::commit();
|
|
|
|
|
|
@@ -690,11 +697,14 @@ class DouYinService
|
|
|
|
|
|
//book_id result
|
|
|
// 抖音预约接单结果回调
|
|
|
- $bookurl = 'api/apps/trade/v2/book/book_result_callback';
|
|
|
- $res = self::toDyRequestUrl($bookurl,[
|
|
|
- 'book_id' => $resData['book_id']??$params['dy_order_id'],
|
|
|
- 'result' => 1,
|
|
|
- ]);
|
|
|
+ $bookInfo = json_decode($order->book_info, true);
|
|
|
+ if(isset($bookInfo['item_order_info_list']) && $bookInfo['item_order_info_list']){
|
|
|
+ $bookurl = 'api/apps/trade/v2/book/book_result_callback';
|
|
|
+ $res = self::toDyRequestUrl($bookurl,[
|
|
|
+ 'book_id' => $bookInfo['item_order_info_list'][0]['item_order_id']??$params['dy_order_id'],
|
|
|
+ 'result' => 1,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
return $order['id']??0;
|
|
|
} catch (\Exception $e) {
|