Procházet zdrojové kódy

快应用中间表

tgz před 2 roky
rodič
revize
76706b1ed3
1 změnil soubory, kde provedl 26 přidání a 0 odebrání
  1. 26 0
      app/Modules/Trade/Pay/OrderArousePayAbstract.php

+ 26 - 0
app/Modules/Trade/Pay/OrderArousePayAbstract.php

@@ -4,6 +4,7 @@ namespace App\Modules\Trade\Pay;
 
 use App\Modules\Subscribe\Models\Order;
 use App\Modules\User\Models\QappPackage;
+use DB;
 
 abstract class OrderArousePayAbstract
 {
@@ -50,6 +51,31 @@ abstract class OrderArousePayAbstract
             'inner_send_order_id'     => isset($data['inner_send_order_id']) ? $data['inner_send_order_id'] : '',
         ];
         Order::firstOrCreate($params);
+        if (!empty($data['send_order_id'])) {
+            $order = Order::where('trade_no',$data['trade_no'])->first();
+            try {
+                $account =  DB::table('qapp_send_orders')->where('send_order_id',$data['send_order_id'])->value('account');
+                if ($account) {
+                    $company_id = DB::table('qapp_channel_account')->where('account',$account)->value('company_id');
+                }
+                $qapp_order = [
+                    'order_id' => $order->id,
+                    'order_created_at' => $order->created_at,
+                    'distribution_channel_id' => $data['distribution_channel_id'],
+                    'book_id'=>$order->from_bid,
+                    'account'=>$account,
+                    'company_id'=>$company_id,
+                ];
+                $res = DB::table('qapp_orders')->insertGetID($qapp_order);
+                if (!$res) {
+                    sendNotice('报警:'.$order->id.':此订单插入 qapp_orders 失败');
+                }
+            } catch (Exception $e) {
+                sendNotice('报错:'.$e->getMessage());
+            }
+            
+
+        }
     }
 
     protected function getSubjectName(int $channel_id)