Преглед изворни кода

移动 用户下单后 通知节点 - 在支付完成后通知运营

liugc пре 1 година
родитељ
комит
e58e19cbea

+ 0 - 11
app/api/controller/ServiceOrderController.php

@@ -83,17 +83,6 @@ class ServiceOrderController extends BaseApiController
         if (false === $result) {
             return $this->fail(ServiceOrderLogic::getError());
         }
-        // 用户下单后,给订单运营专员(配置固定ID)发送公众号提醒(订单信息)
-        $workDetail = ServiceWorkLogic::detail(['id'=>$result['work_id']]);
-        $res = event('Notice',  [
-            'scene_id' => 100,
-            'params' => [
-                'user_id' => 0,
-                'thing3' => $workDetail['title'],
-                'time6' => $workDetail['appointment_time'],
-                'phone_number8' => $workDetail['mobile'],
-            ]
-        ]);
         return $this->data($result);
     }
 

+ 23 - 1
app/common/service/pay/WeChatPayService.php

@@ -21,6 +21,7 @@ use app\common\enum\user\UserTerminalEnum;
 use app\common\logic\PayNotifyLogic;
 use app\common\model\recharge\RechargeOrder;
 use app\common\model\user\UserAuth;
+use app\common\model\works\ServiceWork;
 use app\common\service\wechat\WeChatConfigService;
 use EasyWeChat\Pay\Application;
 use EasyWeChat\Pay\Message;
@@ -385,7 +386,28 @@ class WeChatPayService extends BasePayService
                         PayNotifyLogic::handle('recharge', $message['out_trade_no'], $extra);
                         break;
                     case 'goods':
-                        PayNotifyLogic::handle('goods', $message['out_trade_no'], $extra);
+                        $res = PayNotifyLogic::handle('goods', $message['out_trade_no'], $extra);
+                        if($res === true){
+                            // 用户下单后,给订单运营专员(配置固定ID)发送公众号提醒(订单信息)
+                            $order = RechargeOrder::where('sn', $message['out_trade_no'])
+                                ->where('payment_type','IN',[0,1])
+                                ->where('pay_status','=',1)
+                                ->findOrEmpty();
+                            if(!$order->isEmpty()){
+                                $workDetail = ServiceWork::findOrEmpty($order->work_id);
+                                if(!$workDetail->isEmpty()){
+                                    event('Notice',  [
+                                        'scene_id' => 100,
+                                        'params' => [
+                                            'user_id' => 0,
+                                            'thing3' => $workDetail['title'],
+                                            'time6' => $workDetail['appointment_time'],
+                                            'phone_number8' => $workDetail['mobile'],
+                                        ]
+                                    ]);
+                                }
+                            }
+                        }
                         break;
                 }
             }