rabin 1 rok pred
rodič
commit
b777aa38b2
1 zmenil súbory, kde vykonal 22 pridanie a 1 odobranie
  1. 22 1
      src/bao/connect/api/Notify.php

+ 22 - 1
src/bao/connect/api/Notify.php

@@ -12,7 +12,28 @@ class Notify extends Api
             $this->error('error');
         }
         $s = \Dever\Helper\Str::decode($input['s']);
-        list($connect_id, $api_id, $order_id) = explode('|', $s);
+        if ($s) {
+            list($connect_id, $api_id, $order_id) = explode('|', $s);
+        } elseif (isset($input['order_num'])) {
+            $order_id = Dever::db('order', 'seller')->find(array('order_num' => $input['order_num']));
+            if (!$order_id) {
+                $this->error('error');
+            }
+            $channel = Dever::db('info', 'channel')->find($order_id['channel_id']);
+            if (!$channel) {
+                $this->error('order error');
+            }
+            $connect_id = $channel['connect_id'];
+            $api = Dever::db('api', 'connect')->find(array('connect_id' => $connect_id, 'type' => 1));
+            if (!$api) {
+                $this->error('order error');
+            }
+            $api_id = $api['id'];
+
+        } else {
+            $this->error('error');
+        }
+        
         unset($input['s']);
         unset($input['l']);
         if (!$input) {