rabin 16 jam lalu
induk
melakukan
78d3806916
2 mengubah file dengan 29 tambahan dan 6 penghapusan
  1. 23 0
      src/place/order/app/Lib/Notify.php
  2. 6 6
      src/place/set/app/Lib/Account.php

+ 23 - 0
src/place/order/app/Lib/Notify.php

@@ -25,6 +25,29 @@ class Notify
         }
     }
 
+    # 退款回调开始操作
+    public function refund_start($sector_id, $place_id, $type, $order_num)
+    {
+        $this->handle_start($sector_id, $place_id, $type, $order_num);
+    }
+
+    public function refund_end_commit(){}
+    public function refund_end($sector_id, $place_id, $type, $order_num, $status, $body = [])
+    {
+        list($order_num, $refund_id) = explode('_', $order_num);
+        $order = Dever::db('porder/' . $type)->find(['order_num' => $order_num]);
+        if ($order) {
+            $refund = Dever::db('porder/' . $type . '_refund')->find($refund_id);
+            if ($refund) {
+                if ($status == 1) {
+                    Dever::db('porder/' . $type . '_refund')->update($refund_id, ['status' => 3]);
+                } elseif ($status == 2) {
+                    Dever::db('porder/' . $type . '_refund')->update($refund_id, ['status' => 4]);
+                }
+            }
+        }
+    }
+
     # 抵扣
     private function deduct($type, $order)
     {

+ 6 - 6
src/place/set/app/Lib/Account.php

@@ -37,13 +37,13 @@ class Account
         if (!$account) {
             Dever::error('支付账户配置错误');
         }
-        $order['order_num'] = $order['order_num'];
-        $order['refund_order_num'] = $refund_order_num;
-        $order['total'] = $order['pay_money_cash']*100;
-        $order['pay_cash'] = $pay_cash*100;
-        $order['notify'] = 'Porder/Lib/Notify.refund|' . $sector_id . '|'  . $place_id . '|' . $type . '|' . $refund_order_num;
+        $param['order_num'] = $order['order_num'];
+        $param['refund_order_num'] = $refund_order_num;
+        $param['total'] = $order['pay_money_cash']*100;
+        $param['cash'] = $pay_cash*100;
+        $param['notify'] = 'Porder/Lib/Notify.refund|' . $sector_id . '|'  . $place_id . '|' . $type . '|' . $refund_order_num;
 
-        return Dever::load(\Api\Lib\Account::class)->run($account, 'order_refund', $order, $env, 'run', 'place');
+        return Dever::load(\Api\Lib\Account::class)->run($account, 'refund', $param, 1, 'run', 'place');
     }
 
     # 微信小程序发货操作