浏览代码

modify order exist check

stanley-king 3 年之前
父节点
当前提交
2a4d5a8a49
共有 3 个文件被更改,包括 16 次插入6 次删除
  1. 6 0
      data/model/refill_order.model.php
  2. 4 6
      mobile/control/refill.php
  3. 6 0
      test/TestRefill.php

+ 6 - 0
data/model/refill_order.model.php

@@ -70,4 +70,10 @@ class refill_orderModel extends Model
     {
     {
         return $this->table('refill_detail')->where(['mchid' => $mchid,'mch_order' => $mch_order])->update($datas);
         return $this->table('refill_detail')->where(['mchid' => $mchid,'mch_order' => $mch_order])->update($datas);
     }
     }
+
+    public function exist($mchid,$mch_order)
+    {
+        $item = $this->table('refill_detail')->where(['mchid' => $mchid,'mch_order' => $mch_order])->select();
+        return !empty($item);
+    }
 }
 }

+ 4 - 6
mobile/control/refill.php

@@ -218,14 +218,12 @@ class refillControl extends merchantControl
 
 
     private function check_mchorder($mchid,$mch_order)
     private function check_mchorder($mchid,$mch_order)
     {
     {
-        if(empty($mch_order)) {
+        if (empty($mch_order)) {
             return false;
             return false;
-        }
-        else {
+        } else {
             $refill_order = Model('refill_order');
             $refill_order = Model('refill_order');
-            $ret = $refill_order->getOrderInfo(['mchid' => $mchid,'mch_order' => $mch_order]);
-
-            return empty($ret);
+            $ret = $refill_order->exist($mchid, $mch_order);
+            return ($ret == false);
         }
         }
     }
     }
 
 

+ 6 - 0
test/TestRefill.php

@@ -2235,6 +2235,12 @@ class TestRefill extends TestCase
             return false;
             return false;
         }
         }
     }
     }
+
+    public function testOrderExist()
+    {
+        $refill_order = Model('refill_order');
+        $ret = $refill_order->exist(10116,'Yzb20210825111251415');
+    }
 }
 }