stanley-king 4 лет назад
Родитель
Сommit
6554d8c102

+ 1 - 0
helper/fcgisrv/RAccServer.php

@@ -11,6 +11,7 @@ require_once(BASE_ROOT_PATH . '/helper/session_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/sensitive_word/dfa.php');
 require_once(BASE_ROOT_PATH . '/helper/exceptionex.php');
 require_once(BASE_PATH . '/control/merchant.php');
+require_once(BASE_PATH . '/control/lzbase.php');
 
 use Log;
 use Base;

+ 12 - 4
helper/refill/RefillBase.php

@@ -81,7 +81,7 @@ class RefillBase
                         {
                             $logic_vr_order->changeOrderStateCancel($order_info, '', "{$chname}接口回调通知失败,正在重试");
                             if ($this->retry($refill_info, $order_info)) {
-                                $mod_refill->edit($order_id, ['inner_status' => 1, 'notify_time' => time(), 'notify_state' => 1]);
+                                $mod_refill->edit($order_id, ['is_retrying' => 1]);
                                 $trans->commit();
                                 return true;
                             }
@@ -127,7 +127,8 @@ class RefillBase
             'idcard' => $refill_info['idcard'] ?? '',
             'card_name' => $refill_info['card_name'] ?? '',
             'order_time' => $refill_info['order_time'],
-            'commit_times' => $refill_info['commit_times'] + 1
+            'commit_times' => $refill_info['commit_times'] + 1,
+            'order_id' => $refill_info['order_id']
         ];
 
         return util::push_add($params);
@@ -194,7 +195,7 @@ class RefillBase
     //     其它情况,则需要判断订单ID
     public function add($mchid, $buyer_id, $amount, $card_no,
                         $mch_order, $idcard, $card_name, $notify_url,$quality,
-                        $order_time, $commit_times)
+                        $order_time, $commit_times,$last_orderid = 0)
     {
         $card_type = mtopcard\card_type($card_no);
         [$providers,$overload] = $this->mPolicy->find_providers($amount,$card_type,$quality);
@@ -225,6 +226,7 @@ class RefillBase
 
         $refill_state = false;
         $order_success = false;
+
         foreach ($providers as $provider)
         {
             $channel_name = $provider->name();
@@ -250,6 +252,11 @@ class RefillBase
                 $order_sn = $result['data']['order_sn'];
                 $order_id = $result['data']['order_id'];
 
+                if($last_orderid > 0) {
+                    $mod_refill->edit($last_orderid, ['inner_status' => 1]);
+                }
+                $last_orderid = $order_id;
+
                 if(!$this->pay_completed($order_sn)) {
                     $logic_vr_order = Logic("vr_order");
                     $order_info = Model('vr_order')->getOrderInfo(['order_id' => $order_id]);
@@ -305,7 +312,8 @@ class RefillBase
                 $logic_vr_order = Logic("vr_order");
                 $order_info = Model('vr_order')->getOrderInfo(['order_id' => $order_id]);
                 $logic_vr_order->changeOrderStateCancel($order_info, '', "调用{$channel_name}接口失败");
-                $mod_refill->edit($order_id, ['commit_time' => time(), 'inner_status' => 1]);
+
+                $mod_refill->edit($order_id, ['commit_time' => time()]);
             }
         }
 

+ 18 - 3
racc/control/lzbase.php

@@ -18,8 +18,11 @@ class lzbaseControl
             $this->mAdminid = intval($mchinfo['admin_id']);
         }
 
-        $minfo = new member_info($this->adminid());
-        $this->available = $minfo->available_predeposit();
+        $mchinfo = Model('merchant')->getMerchantInfo(['mchid' => $mchid]);
+
+        $mod_member = Model('member');
+        $minfo = $mod_member->getMemberInfo(['member_id' => $this->mAdminid], '*', true);
+        $this->available = $minfo['available_predeposit'];
 
         if ($mchinfo['merchant_state'] != 1) {
             throw new LzException(self::text_content(-7,$this->available));
@@ -67,7 +70,19 @@ class lzbaseControl
 
     private function sign_body($params)
     {
-        $content = $params['usr'] . $params['ord'] . $params['mob'] . $params['amt'] . $params['tim'];
+        $op = $params['op'];
+        if($op == 'add_mob') {
+            $content = $params['usr'] . $params['ord'] . $params['mob'] . $params['amt'] . $params['tim'];
+        }
+        elseif($op == 'balance') {
+            $content = $params['usr'];
+        }
+        elseif($op == 'query') {
+            $content = $params['usr'] . $params['ord'];
+        }
+        else {
+            $content = 'error';
+        }
         return $content;
     }
 

+ 5 - 2
racc/control/lzrefill.php

@@ -32,7 +32,7 @@ class lzrefillControl extends lzbaseControl
             return -9;
         }
 
-        $card_no = $_GET['cardno'];
+        $card_no = $params['mob'];
         if(!preg_match('/^1\d{10}$/',$card_no,$matches)) {
             return -11;
         }
@@ -129,7 +129,10 @@ class lzrefillControl extends lzbaseControl
         $uid = $this->adminid();
         $minfo = new member_info($uid);
         $available = $minfo->available_predeposit();
-        return self::outsuccess(['balance' => $available]);
+
+        $content = "0|".ncPriceFormat($available)."|0.00";
+        echo $content;
+        return true;
     }
 
     private function format($order_info,$refill_info)

+ 2 - 5
racc/racc.php

@@ -10,7 +10,6 @@ require_once(BASE_ROOT_PATH . '/global.php');
 require_once(BASE_ROOT_PATH . '/fooder.php');
 require_once(BASE_PATH . '/index.php');
 
-
 require_once(BASE_ROOT_PATH . '/helper/http_header.php');
 require_once(BASE_ROOT_PATH . '/helper/session.php');
 require_once(BASE_ROOT_PATH . '/helper/img_helper.php');
@@ -36,12 +35,10 @@ require_once(BASE_ROOT_PATH . '/helper/fcode/present_manager.php');
 require_once(BASE_ROOT_PATH . '/helper/url_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/activity_helper.php');
 require_once(BASE_HELPER_PATH . '/fcgisrv/RAccServer.php');
-
-use fcgisrv;
-
+require_once(BASE_HELPER_PATH . '/refill/util.php');
 
 function all_channels() {
-    return ['ch_index','activity','goods','refill'];
+    return ['refill'];
 }
 
 Base::mobile_init();

+ 4 - 11
rdispatcher/proxy.php

@@ -25,9 +25,11 @@ class proxy
 
         $order_time = $params['order_time'] ?? time();
         $commit_times = $params['commit_times'] ?? 0;
+        $last_order_id = $params['order_id'] ?? 0;
 
         [$errcode, $errmsg,$order_id,$neterr] = refill\RefillFactory::instance()->add($mchid, $buyer_id, $amount, $card_no,
-            $mch_order, $idcard, $card_name, $notify_url,$quality, $order_time, $commit_times);
+            $mch_order, $idcard, $card_name, $notify_url,$quality, $order_time, $commit_times,$last_order_id);
+
         $params['commit_times'] += 1;
         $commit_times += 1;
 
@@ -39,10 +41,7 @@ class proxy
                 if(refill\RefillFactory::instance()->can_nettry($quality,$order_time,$commit_times))
                 {
                     $fNotify = false;
-                    if($order_id > 0) {
-                        $this->set_trying($refill_order,$mchid,$mch_order,$order_id);
-                    }
-
+                    $params['order_id'] = $order_id;
                     refill\util::push_add($params);
                 }
             }
@@ -66,12 +65,6 @@ class proxy
         }
     }
 
-    private function set_trying($refill_order,$mchid,$mch_order,$order_id)
-    {
-        $refill_order->table('refill_order')->where(['mchid' => $mchid,'mch_order' => $mch_order])->update(['is_retrying' => 0]);
-        $refill_order->edit($order_id,['is_retrying' => 1]);
-    }
-
     private function latest_order($refill_order,$mchid,$mch_order)
     {
         $orders = $refill_order->getOrderInfo(['mchid' => $mchid,'mch_order' => $mch_order]);