rabin 7 ore fa
parent
commit
c0a79f22e8

+ 5 - 10
src/place/interface/app/Api/Order.php

@@ -58,16 +58,11 @@ class Order extends Core
     {
         $info = $this->getInfo();
         if ($info['pay_money_cash'] > 0) {
-            $detail = Dever::db('porder/source_detail')->select(['order_id' => $info['id']]);
-            $param['uid'] = $info['uid'];
-            $param['pay_money_cash'] = $info['pay_money_cash'];
-            $param['name'] = $detail[0]['name'];
-            $param['order_num'] = $info['order_num'];
-            $param['notify'] = 'Porder/Lib/Notify.handle|' . $this->place->sector['id'] . '|'  . $this->place->info['id'] . '|source|' . $info['order_num'];
-
-            $result['pay'] = Dever::load(\Place\Lib\Account::class)->pay($param);
-            if (isset($result['pay']['link']) && $result['pay']['link']) {
-                return $result;
+            $log = Dever::db('porder/soruce_pay')->insert(['order_id' => $info['id']]);
+            if ($log) {
+                $result['pay'] = Dever::json_decode($log['pay']);
+            } else {
+                Dever::error('支付失败,请重试');
             }
             $result['order_id'] = $info['id'];
             $result['order_num'] = $info['order_num'];

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

@@ -105,6 +105,9 @@ class Notify
             Dever::load(\Porder\Lib\Source\Log::class)->up(1, $order['uid'], $order['id'], $msg);
         }
         if ($state) {
+
+            Dever::db('porder/soruce_pay')->delete(['order_id' => $order['id']]);
+
             if ($update['status'] == 7) {
                 # 恢复库存
                 Dever::load(\Pstock\Lib\Info::class)->refundAll($order);

+ 3 - 0
src/place/order/app/Lib/Pay.php

@@ -275,6 +275,9 @@ class Pay
                 $this->success($result['order_id']);
                 if ($result['pay'] === true) {
                     Dever::load(\Porder\Lib\Notify::class)->notify_end($this->place->sector['id'], $this->place->info['id'], $this->type, $result['order_num'], 1);
+                } elseif ($this->type == 'source') {
+                    # 记录下来
+                    Dever::db('porder/soruce_pay')->insert(['order_id' => $result['order_id'], 'pay' => Dever::json_encode($result['pay'])]);
                 }
             }
         }

+ 3 - 0
src/place/order/app/Lib/Source/Order.php

@@ -263,6 +263,9 @@ class Order
         if ($order['status'] == 1) {
             $state = Dever::db('porder/source')->update($order['id'], ['status' => $status, 'fdate' => time()]);
             if ($state) {
+
+                Dever::db('porder/soruce_pay')->delete(['order_id' => $order['id']]);
+                
                 # 恢复库存
                 Dever::load(\Pstock\Lib\Info::class)->refundAll($order);
             }