stanley-king před 1 rokem
rodič
revize
9555f0b8b6
1 změnil soubory, kde provedl 9 přidání a 34 odebrání
  1. 9 34
      helper/refill/api/xyz/bingguang/RefillPhone.php

+ 9 - 34
helper/refill/api/xyz/bingguang/RefillPhone.php

@@ -5,7 +5,6 @@ namespace refill\bingguang;
 require_once(BASE_HELPER_RAPI_PATH . '/bingguang/config.php');
 
 use refill;
-use Log;
 
 class RefillPhone extends refill\IRefillThird
 {
@@ -14,48 +13,24 @@ class RefillPhone extends refill\IRefillThird
         parent::__construct($cfgs);
     }
 
-    private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
-    {
-        $params['tel'] = $phone;
-        $params['mch_order_id'] = $order_sn;
-        $params['mchid'] = config::MCHID;
-        $params['price'] = $amount;
-        $params['notify'] = config::NOTIFY_URL;
-        $params['teltype'] = config::operator[$card_type];
-        $params['timeout'] = 50;
-        $params['time'] = time();
-        $params['rand'] = rand(100000,999999);
-
-        return $params;
-    }
-
     public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
     {
-        //大面值 直接返回成功
-//        refill\util::send_normal($params['order_sn']);
         return [true , '',false];
     }
 
     public function query($refill_info)
     {
-        $params['mch_order_id'] = $refill_info['order_sn'];
-        $params['mchid'] = config::MCHID;
-        $content = $params['mchid'] . $params['mch_order_id'] . config::KEY;
-        $params['sign'] = md5($content);
-        $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
-        if ($resp === false) {
-            return [false, '系统错误'];
+        $mod_order = Model('vr_order');
+
+        $order_sn = $refill_info['order_sn'];
+        $order_info = $mod_order->getOrderInfo(['order_sn' => $order_sn]);
+
+        if(empty($order_info)) {
+            $order_state = ORDER_STATE_NOEXIST;
         } else {
-            $rand = mt_rand(0,1);
-            return [$rand , ''];
+            $order_state = intval($order_info['order_state']);
         }
-    }
 
-    private function sign($params)
-    {
-        $key = config::KEY;
-        $content  = $params['mchid'] . $params['tel'] . $params['mch_order_id'] . $params['price'] . $params['teltype'] . $params['timeout'] . $params['notify'];
-        $content .= $params['time'] . $params['rand'] . $key;
-        return md5($content);
+        return [true, $order_state];
     }
 }