瀏覽代碼

Merge branch 'oilrun' into iOIL

stanley-king 4 年之前
父節點
當前提交
7beb521463
共有 5 個文件被更改,包括 41 次插入2 次删除
  1. 2 0
      data/config/prod/refill.ini.php
  2. 18 0
      mobile/control/refill.php
  3. 1 0
      mobile/framework/function/function.php
  4. 18 0
      test/TestRefill.php
  5. 2 2
      test/TestRefillCB.php

+ 2 - 0
data/config/prod/refill.ini.php

@@ -48,6 +48,7 @@ $saihu_oil = ['name' => 'saihu', 'store_id' => 15, 'card_type' => ['sinopec'],
         1000 => ['goods_id' => 6316, 'price' => 970],
         2000 => ['goods_id' => 6317, 'price' => 1940]], 'refill_type' => 'api'];
 
+#官方中石油通道
 $gftd_oil = ['name' => 'gftd', 'store_id' => 19, 'card_type' => ['petrochina'],
     'amount' => [
         100 => ['goods_id' => 6339, 'price' => 95],
@@ -57,6 +58,7 @@ $gftd_oil = ['name' => 'gftd', 'store_id' => 19, 'card_type' => ['petrochina'],
     ],
     'period' => [], 'refill_type' => 'api'];
 
+#官方中石化通道
 $gftdsinop_oil = ['name' => 'gftdsinop', 'store_id' => 20, 'card_type' => ['sinopec'],
     'amount' => [
         100 => ['goods_id' => 6343, 'price' => 95],

+ 18 - 0
mobile/control/refill.php

@@ -73,6 +73,10 @@ class refillControl extends merchantControl
         $idcard = $_GET['idcard'] ?? '';
         $card_name = $_GET['card_name'] ?? '';
 
+        if(!$this->check_mchorder($this->mchid(),$mch_order)) {
+            return self::outerr(201,"客户订单号重复或者为空.");
+        }
+
         [$state, $err] = refill\RefillFactory::instance()->add($this->mchid(), $this->adminid(), $amount, $card_no, $mch_order, $idcard, $card_name, $notify_url);
         if($state === true) {
             return self::outsuccess(['state' => true]);
@@ -82,6 +86,20 @@ class refillControl extends merchantControl
             return self::outerr($code,$err);
         }
     }
+
+    private function check_mchorder($mchid,$mch_order)
+    {
+        if(empty($mch_order)) {
+            return false;
+        }
+        else {
+            $refill_order = Model('refill_order');
+            $ret = $refill_order->getOrderInfo(['mchid' => $mchid,'mch_order' => $mch_order]);
+
+            return empty($ret);
+        }
+    }
+
     public function balanceOp()
     {
         $uid = $this->adminid();

+ 1 - 0
mobile/framework/function/function.php

@@ -42,6 +42,7 @@ function joutput_data($datas,$type='')
     $code = errcode::Success;
     $data['code'] = $code;
     $data['message'] = errcode::msg($code);
+
     $data['datas'] = $datas;
 
     if($_SESSION['client_type'] != 'ajax')

+ 18 - 0
test/TestRefill.php

@@ -720,6 +720,24 @@ class TestRefill extends TestCase
         $info = $this->refill_info($card_no,$card_type);
 
     }
+
+    private function check_mchorder($mchid,$mch_order)
+    {
+        if(empty($mch_order)) {
+            return true;
+        }
+        else {
+            $refill_order = Model('refill_order');
+            $ret = $refill_order->getOrderInfo(['mchid' => $mchid,'mch_order' => $mch_order]);
+
+            return empty($ret);
+        }
+    }
+
+    public function testCheckMchorder()
+    {
+        $ret = $this->check_mchorder(1,'13281475');
+    }
 }
 
 

+ 2 - 2
test/TestRefillCB.php

@@ -98,8 +98,8 @@ class TestRefillCancel extends TestCase
 
     public function testGFTDCancel()
     {
-        $params['channelOrderNumber'] = '600664387134838632';
-        $params['orderNumber'] = 'GYFL1611043135784640';
+        $params['channelOrderNumber'] = '930664641391799632';
+        $params['orderNumber'] = 'GYFL1611297392856576';
         $params['message'] = '只能给绑定正确手机号的油卡充值或只能给主卡充值';
         $params['status'] = 109;