stanley 2 lat temu
rodzic
commit
9d156c7cfb

+ 55 - 0
data/model/refill_query_err.model.php

@@ -0,0 +1,55 @@
+<?php
+
+defined('InShopNC') or exit('Access Invalid!');
+
+class refill_query_errModel extends Model
+{
+    public function __construct()
+    {
+        parent::__construct('refill_query_err');
+    }
+
+    public function getThirdProductList($condition, $pagesize = '', $field = '*', $order = '', $limit = '')
+    {
+        $list = $this->table('third_product')->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->select();
+        if (empty($list)) return [];
+        return $list;
+    }
+
+    public function addThirdProduct($insert)
+    {
+        return $this->table('third_product')->insert($insert);
+    }
+
+    public function findThirdProduct($system_code)
+    {
+        return $this->table('third_product')->where(['system_code' => $system_code])->find();
+    }
+
+    public function editThirdProduct($system_code, $data){
+        return $this->table('third_product')->where(['system_code' => $system_code])->update($data);
+    }
+
+    public function getProviderProductList($condition, $pagesize = '', $field = '*', $order = '', $limit = '')
+    {
+        $list = $this->table('third_proprice')->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->select();
+        if (empty($list)) return [];
+        return $list;
+    }
+
+    public function add($insert)
+    {
+        $insert['query_time'] = time();
+        return $this->insert($insert);
+    }
+
+    public function edit_provider_product($system_code,$store_id,$goods_id,$data)
+    {
+        return $this->table('third_proprice')->where(['store_id' => $store_id,'goods_id' => $goods_id,'system_code' => $system_code])->update($data);
+    }
+
+    public function del_provider_product($system_code,$store_id,$goods_id)
+    {
+        return $this->table('third_proprice')->where(['store_id' => $store_id,'goods_id' => $goods_id,'system_code' => $system_code])->delete();
+    }
+}

+ 26 - 3
mobile/control/refill.php

@@ -518,12 +518,27 @@ class refillControl extends merchantControl
 
             if(empty($refill_info))
             {
+                $mod_qerr = Model('refill_query_err');
+                $insert = ['mch_order' => $order_sn,'mchid' => $mchid];
+
                 $items = $mod_refill->getOrderInfo(['mch_order' => $order_sn,'mchid' => $mchid]);
                 if (empty($items)) {
                     Log::record("query_state in db no order mchid={$mchid} mch_order={$order_sn}", Log::DEBUG);
-                    return self::outerr(202, "无此订单");
+
+                    $insert['code'] = 202;
+                    $insert['msg'] = "检索充值中的单子,查不到任何订单信息.";
+
+                    $mod_qerr->add($insert);
+
+                    return self::outerr(202, "无此订单,请人工确认处理.");
                 } else {
                     Log::record("DEBUG_TAG: query_state in db mchid={$mchid} mch_order={$order_sn} order_state not completed.", Log::DEBUG);
+
+
+                    $insert['code'] = 200;
+                    $insert['msg'] = "检索充值中的单子能查到,但inner_status=0时查不到.";
+                    $mod_qerr->add($insert);
+
                     $result['mchid'] = $mchid;
                     $result['order_sn'] = $order_sn;
                     $result['order_state'] = ORDER_STATE_SEND;
@@ -536,8 +551,16 @@ class refillControl extends merchantControl
                 $order_info = $vr_order->partition(refill\util::part_query())->getOrderInfo(['order_sn' => $refill_info['order_sn']]);
                 Log::record("query_state in db mchid={$mchid} mch_order={$order_sn} order_state={$order_info['order_state']}" ,Log::DEBUG);
 
-                if (empty($order_info)) {
-                    return self::outerr(203, "无此交易号");
+                if (empty($order_info))
+                {
+                    $mod_qerr = Model('refill_query_err');
+                    $insert = ['mch_order' => $order_sn,'mchid' => $mchid];
+
+                    $insert['code'] = 203;
+                    $insert['msg'] = "检索充值中的单子能查到,但inner_status=0时查不到vr_order中的订单.";
+                    $mod_qerr->add($insert);
+
+                    return self::outerr(203, "无此交易,请人工确认处理.");
                 } else {
                     $result = $this->format($order_info, $refill_info);
                     return self::outsuccess($result);

+ 36 - 0
test/TestQuery.php

@@ -0,0 +1,36 @@
+<?php declare(strict_types=1);
+
+use PHPUnit\Framework\TestCase;
+
+/**
+ * Created by PhpStorm.
+ * User: stanley-king
+ * Date: 16/7/20
+ * Time: 下午4:16
+ */
+
+define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
+
+require_once(BASE_ROOT_PATH . '/global.php');
+require_once(BASE_CORE_PATH . '/lrlz.php');
+require_once(BASE_ROOT_PATH . '/fooder.php');
+
+
+class TestQuery extends TestCase
+{
+    public static function setUpBeforeClass(): void
+    {
+        Base::run_util();
+    }
+
+    public function testAdd()
+    {
+        $mod_qerr = Model('refill_query_err');
+
+        $insert = ['mch_order' => '343143214312','mchid' => 1];
+        $insert['code'] = 202;
+        $insert['msg'] = "检索充值中的单子,查不到任何订单信息.";
+
+        $mod_qerr->add($insert);
+    }
+}