whitefang 2 лет назад
Родитель
Сommit
196c5b0c0a
2 измененных файлов с 23 добавлено и 3 удалено
  1. 23 2
      app/common/logic/PayNotifyLogic.php
  2. 0 1
      app/common/logic/PaymentLogic.php

+ 23 - 2
app/common/logic/PayNotifyLogic.php

@@ -16,8 +16,10 @@ namespace app\common\logic;
 
 use app\common\enum\PayEnum;
 use app\common\enum\user\AccountLogEnum;
+use app\common\enum\WorkEnum;
 use app\common\model\recharge\RechargeOrder;
 use app\common\model\user\User;
+use app\common\model\works\ServiceWork;
 use think\facade\Db;
 use think\facade\Log;
 
@@ -55,8 +57,6 @@ class PayNotifyLogic extends BaseLogic
      * @notes 充值回调
      * @param $orderSn
      * @param array $extra
-     * @author 段誉
-     * @date 2023/2/27 15:28
      */
     public static function recharge($orderSn, array $extra = [])
     {
@@ -84,5 +84,26 @@ class PayNotifyLogic extends BaseLogic
         $order->save();
     }
 
+    /**
+     * @notes 服务回调
+     * @param $orderSn
+     * @param array $extra
+     */
+    public static function goods($orderSn, array $extra = [])
+    {
+        $order = RechargeOrder::where('sn', $orderSn)->findOrEmpty();
+        // 更新充值订单状态
+        $order->transaction_id = $extra['transaction_id'] ?? '';
+        $order->pay_status = PayEnum::ISPAID;
+        $order->pay_time = time();
+        $order->save();
+
+        $work = ServiceWork::findOrEmpty($order->work_id);
+        $work->work_pay_status = WorkEnum::IS_PAY_STATUS;
+        $work->work_total = $order->order_amount;
+        $work->work_amount = $order->order_amount;
+        $work->save();
+    }
+
 
 }

+ 0 - 1
app/common/logic/PaymentLogic.php

@@ -174,7 +174,6 @@ class PaymentLogic extends BaseLogic
         if ($payWay == PayEnum::WECHAT_PAY) {
             $paySn = self::formatOrderSn($order['sn'], $terminal);
         }
-
         //更新支付方式
         switch ($from) {
             case 'recharge':