rabin 1 år sedan
förälder
incheckning
ddc010f9b1
1 ändrade filer med 13 tillägg och 2 borttagningar
  1. 13 2
      src/bao/connect/api/Notify.php

+ 13 - 2
src/bao/connect/api/Notify.php

@@ -15,6 +15,7 @@ class Notify extends Api
         $s = \Dever\Helper\Str::decode($input['s']);
         list($connect_id, $api_id, $order_id) = explode('|', $s);
         unset($input['s']);
+        unset($input['l']);
         $this->load($input, $connect_id, $api_id, $order_id);
     }
 
@@ -22,7 +23,11 @@ class Notify extends Api
     {
         $this->connect = Dever::db('info', 'connect')->find($connect_id);
         $this->info = Dever::db('api', 'connect')->find($api_id);
-        $order = Dever::db('order', 'seller')->find($order_id);
+        if (is_array($order_id)) {
+            $order = $order_id;
+        } else {
+            $order = Dever::db('order', 'seller')->find($order_id);
+        }
         if (!$order || $order['status'] >= 10) {
             $this->error('order error');
         }
@@ -89,6 +94,8 @@ class Notify extends Api
     # 生成回调
     public function callback()
     {
+        //$param = '{"l":"notify.callback","t":"4-5-user_order","userid":"41438","order_id":"24020213181441438abbf5b39f","account":"15810090811","amount":"100","price":"104.1","state":"failed","user_order":"C2024020251094338265393","sign":"0447CC15F7D0218A1C5C09160A12A19A","voucher":""}';
+        //$input = Dever::json_decode($param);
         $input = Dever::input();
         if (!isset($input['t'])) {
             $this->error('error');
@@ -102,6 +109,10 @@ class Notify extends Api
         }
         $order_id = $input[$order_key];
         unset($input['t']);
-        $this->load($input, $connect_id, $api_id, $order_id);
+        $order = Dever::db('order', 'seller')->find(array('order_num' => $order_id));
+        if (!$order || $order['status'] >= 10) {
+            $this->error('order error');
+        }
+        $this->load($input, $connect_id, $api_id, $order);
     }
 }