Просмотр исходного кода

Merge branch 'ralbex' into rtest

xiaoyu 3 лет назад
Родитель
Сommit
0d81231b23

+ 7 - 4
admin/control/refill_detail.php

@@ -140,15 +140,17 @@ class refill_detailControl extends SystemControl
         $type = $_GET['type'];
         $condition['detail_id'] = ['in',$id];
         $condition['order_state'] = ORDER_STATE_QUEUE;
-
+        var_dump($_GET);die;
         $refill_detail = Model('refill_detail')->where($condition)->select();
         $mod = Model('refill_order');
-        foreach ($refill_detail as $detail) {
+        foreach ($refill_detail as $detail)
+        {
             $mchid = $detail['mchid'];
             $mch_order = $detail['mch_order'];
             Log::record("mchid: {$mchid} , mch_order: {$mch_order}", Log::DEBUG);
             $refill_order = $mod->getOrderInfo(['mchid' => $mchid,'mch_order' => $mch_order]);
-            if (empty($refill_order)) {
+            if (empty($refill_order))
+            {
                 Log::record("order dispose type:{$type}, params:{$detail['params']}",Log::DEBUG);
                 $params = json_decode($detail['params'],true);
                 if ($type == 'cancel') {
@@ -162,7 +164,8 @@ class refill_detailControl extends SystemControl
                 } else {
                     continue;
                 }
-            } else {
+            }
+            else {
                 util::pop_queue_order($mchid,$mch_order);
             }
         }

+ 3 - 2
admin/control/refill_order.php

@@ -20,7 +20,7 @@ class refill_orderControl extends SystemControl
     {
         $model_refill_order = Model('refill_order');
         $condition['inner_status'] = 0;
-        $_GET['query_start_time'] = $_GET['query_start_time'] ?? date("Y-m-d 00:00:00");
+        $_GET['query_start_time'] = $_GET['query_start_time'] ?? date("Y-m-d H:i:s", strtotime("-10 minutes"));
 
         if (!empty($_GET['order_sn'])) {
             $condition['refill_order.order_sn'] = $_GET['order_sn'];
@@ -89,7 +89,8 @@ class refill_orderControl extends SystemControl
         } elseif ($end_unixtime > 0) {
             $condition['refill_order.order_time'] = ['lt', $end_unixtime];
         } else {
-            $start = strtotime(date('Y-m-d', time()));
+            $start = time() - 600;
+            $_GET['query_start_time'] = date("Y-m-d H:i:s",$start);
             $condition['refill_order.order_time'] = ['egt', $start];
             $fToday = true;
         }

+ 31 - 12
admin/templates/default/refill.detail.php

@@ -150,7 +150,10 @@
     <table class="table tb-type2 nobdb">
         <thead>
         <tr class="thead">
-            <th class="align-center" id="selectAll">全选</th>
+            <th class="align-center" id="selectAll">
+            <input type="checkbox" name="chbox" value="">
+            </th>
+            <th class="align-center">编号</th>
             <th class="align-center">机构编号</th>
             <th class="align-center">机构名称</th>
             <th class="align-center">商家单号</th>
@@ -169,6 +172,7 @@
                     <td class="align-center">
                     <input type="checkbox" id="checkBoxList" name="checkbox" value="<?php echo $order['detail_id'];?>">
                     </td>
+                    <td class="align-center"><?php echo $key+1;?></td>
                     <td class="align-center"><?php echo $order['mchid']; ?></td>
                     <td class="align-center"><?php echo $order['company_name'];?></td>
                     <td class="align-center"><?php echo $order['mch_order']; ?></td>
@@ -190,13 +194,13 @@
             <?php } ?>
         <?php } else { ?>
             <tr class="no_data">
-                <td colspan="8"><?php echo $lang['nc_no_record']; ?></td>
+                <td colspan="10"><?php echo $lang['nc_no_record']; ?></td>
             </tr>
         <?php } ?>
         </tbody>
         <tfoot>
         <tr class="tfoot">
-            <td colspan="8" id="dataFuncs">
+            <td colspan="10" id="dataFuncs">
                 <div class="pagination"> <?php echo $output['show_page']; ?> </div>
             </td>
         </tr>
@@ -236,16 +240,17 @@
         //全选
           //全选
           $('#selectAll' ).click ( function () {
-          if ($(this).text() == '全选') {
+          if ($("input[name='chbox']").is(':checked')) {
               $("input[name='checkbox']").each(function() {
                   this.checked = true;
               })
-              $(this).text("取消全选")
+       
           } else {
+       
               $("input[name='checkbox']").each(function() {
                   this.checked = false;
               })
-              $(this).text("全选")
+ 
 
           }
      
@@ -272,11 +277,18 @@
                 arr[i] = $(this).val();
             })
             let str = arr.join(",");
-            if (str != '') {
+            let strr = str.substring(0, 1);
+            let number = Number(strr);
+            if (isNaN(number)) {
+                let strrr = str.substring(1, str.length);
+            window.location.href =`index.php?act=refill_detail&op=order_dispose&id= ${strrr ? strrr : ''}&type=cancel`
+        
+
+            } else {
             window.location.href =`index.php?act=refill_detail&op=order_dispose&id= ${str ? str : ''}&type=cancel`
-            console.log(str);
-            layer.msg('批量成功', {icon: 1});
 
+            }
+            if (str != '') {
             } else {
                 layer.msg('请还没有任何操作,请先选择');
             }
@@ -300,11 +312,18 @@
                 arr[i] = $(this).val();
             })
             let str = arr.join(",");
-            if (str != '') {
+            let strr = str.substring(0, 1);
+            let number = Number(strr);
+            if (isNaN(number)) {
+                let strrr = str.substring(1, str.length);
+            window.location.href =`index.php?act=refill_detail&op=order_dispose&id= ${strrr ? strrr : ''}&type=anew`
+        
+
+            } else {
             window.location.href =`index.php?act=refill_detail&op=order_dispose&id= ${str ? str : ''}&type=anew`
-            console.log(str);
-            layer.msg('批量成功', {icon: 1});
 
+            }
+            if (str != '') {
             } else {
                 layer.msg('请还没有任何操作,请先选择');
             }

+ 15 - 48
admin/templates/default/refill.order.batch.php

@@ -10,7 +10,6 @@
 </style>
 <?php defined('InShopNC') or exit('Access Invalid!'); ?>
 
-
 <div class="page">
     <div class="fixed-bar">
         <div class="item-title">
@@ -40,13 +39,13 @@
             <tfoot>
             <tr class="tfoot">
                 <td colspan="15">
-                    <a href="JavaScript:void(0);" class="submitBtn" id="successbtn" data-type="success">
+                    <a href="JavaScript:void(0);" class="submitBtn btns" data-type="success">
                         <span>全部手动成功</span>
                     </a>
-                    <a href="JavaScript:void(0);" class="submitBtn" id="cancelbtn" data-type="cancel">
+                    <a href="JavaScript:void(0);" class="submitBtn btns" data-type="cancel">
                         <span>全部手动失败</span>
                     </a>
-                    <a href="JavaScript:void(0);" class="submitBtn" id="notifybtn" data-type="notify">
+                    <a href="JavaScript:void(0);" class="submitBtn btns" data-type="notify">
                         <span>全部回调</span>
                     </a>
                 </td>
@@ -67,51 +66,23 @@
 <script type="text/javascript">
     $(function () {
         //按钮先执行验证再提交表单
-        $("#successbtn").click(function () {
-            layer.confirm('您确定要全部手动成功?', {
-                btn: ['确定','取消'],
-                title:'全部手动成功'
-            }, function(){
-                if ($("#user_form").valid()) {
-                const type = $(this).attr('data-type');
-                $("input[name='type']").val(type)
-                $("#user_form").submit();
-            }
-            }, function(){
-            });
+        $(".submitBtn").click(function () {
+            const txt = $(this).text();
+            const type = $(this).attr('data-type');
 
-  
-        });
-        $("#cancelbtn").click(function () {
-            layer.confirm('您确定要全部手动失败?', {
-                btn: ['确定','取消'],
-                title:'全部手动失败'
-            }, function(){
+            layer.confirm('您确定要'+txt+'吗?', {
+                btn: ['确定', '取消'],
+                title: txt
+            }, function () {
                 if ($("#user_form").valid()) {
-                const type = $(this).attr('data-type');
-                $("input[name='type']").val(type)
-                $("#user_form").submit();
-            }
-            }, function(){
+                    console.log(type);
+                    $("input[name='type']").val(type)
+                    $("#user_form").submit();
+                }
+            }, function () {
             });
-
-  
         });
-        $("#notifybtn").click(function () {
-            layer.confirm('您确定要全部回调?', {
-                btn: ['确定','取消'],
-                title:'全部回调'
-            }, function(){
-                if ($("#user_form").valid()) {
-                const type = $(this).attr('data-type');
-                $("input[name='type']").val(type)
-                $("#user_form").submit();
-            }
-            }, function(){
-            });
 
-  
-        });
         $('#user_form').validate({
             errorPlacement: function (error, element) {
                 error.appendTo(element.parent().parent().prev().find('td:first'));
@@ -127,9 +98,5 @@
                 }
             }
         });
-                    //批量
-                $('#successbtn').click(function () {
-    
-            })
     });
 </script>

+ 19 - 0
admin/templates/default/refill.order.index.php

@@ -277,6 +277,9 @@
                     <a href="#" class="btns" onclick="hCopyCardNo(event)">
                         <span><i class="icon-edit"></i>拷贝充值卡号</span>
                     </a>
+                    <a href="#" class="btns" onclick="hCopyOrderSn(event)">
+                        <span><i class="icon-edit"></i>拷贝订单号码</span>
+                    </a>
                     <a href="#" class="btns" id="10_rder">
                         <span><i class="icon-edit"></i>10分钟订单</span>
                     </a>
@@ -838,4 +841,20 @@
         document.execCommand("Copy"); // 执行浏览器复制命令
         oInput.parentNode.removeChild(oInput)
     }
+
+    function hCopyOrderSn(e) {
+        let str = ''
+        $('#tbody tr').each(function () {
+            let res = $(this).find('td').eq(1).text()
+            str += res + '\n'
+        })
+        let oInput = document.createElement("textarea");
+        oInput.style.border = "0 none";
+        oInput.style.color = "transparent";
+        oInput.value = str;
+        document.body.appendChild(oInput);
+        oInput.select(); // 选择对象
+        document.execCommand("Copy"); // 执行浏览器复制命令
+        oInput.parentNode.removeChild(oInput)
+    }
 </script> 

+ 2 - 1
core/framework/db/comysqli.php

@@ -144,7 +144,8 @@ class Db
                     $link = self::connect($link,$host);
                     CoMysqliPool::instance()->reset(Co::getCid(),$link);
                     $count++;
-                } elseif (C('debug')) {
+                }
+                elseif (C('debug')) {
                     throw_exception($error . '<br/>' . $sql);
                     return false;
                 }

+ 2 - 1
core/framework/db/mysqli.php

@@ -45,11 +45,12 @@ class Db
         $conf = C('db.' . $host);
         self::$link[$host] = mysqli_init();
         self::$link[$host]->real_connect($conf['dbhost'], $conf['dbuser'], $conf['dbpwd'], $conf['dbname'], $conf['dbport'],NULL,MYSQLI_CLIENT_FOUND_ROWS);
+        Log::record("{$host}:{$conf['dbhost']}",Log::DEBUG);
 
         if (mysqli_connect_errno()) {
             $err_no = mysqli_connect_errno();
             $error = mysqli_connect_error();
-            throw_exception("Db Error: database connect failed errno={$err_no} err={$error}");
+            throw_exception("Db Error: {$host} database connect failed errno={$err_no} err={$error}");
         }
 
         switch (strtoupper($conf['dbcharset'])) {

+ 1 - 1
core/framework/libraries/CoMysqliPool.php

@@ -2,7 +2,7 @@
 
 class CoMysqliPool extends CoRefPool
 {
-    const max_clients = 100;
+    const max_clients = 50;
 
     private static $stInstance = null;
 

+ 8 - 8
data/config/win/refill.ini.php

@@ -1795,14 +1795,14 @@ $kangkai_phone = ['name' => 'kangkai', 'store_id' => 98,'qualitys' => '2',
 
 $lechong_phone = ['name' => 'lechong', 'store_id' => 99, 'qualitys' => '1',
     'amount' => [
-        10 => [['goods_id' => 6885, 'price' => 9.57, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        20 => [['goods_id' => 6886, 'price' => 19.14, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 6887, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 6888, 'price' => 47.85, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 6889, 'price' => 95.7, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 6890, 'price' => 191.4, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        300 => [['goods_id' => 6891, 'price' => 287.1, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        500 => [['goods_id' => 6892, 'price' => 478.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+        10 => [['goods_id' => 6885, 'price' => 9.56, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6886, 'price' => 19.12, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6887, 'price' => 28.68, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6888, 'price' => 47.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6889, 'price' => 95.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6890, 'price' => 191.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6891, 'price' => 286.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6892, 'price' => 478, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 

+ 8 - 8
data/config/xyz/refill.ini.php

@@ -1795,14 +1795,14 @@ $kangkai_phone = ['name' => 'kangkai', 'store_id' => 98,'qualitys' => '2',
 
 $lechong_phone = ['name' => 'lechong', 'store_id' => 99, 'qualitys' => '1',
     'amount' => [
-        10 => [['goods_id' => 6885, 'price' => 9.57, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        20 => [['goods_id' => 6886, 'price' => 19.14, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 6887, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 6888, 'price' => 47.85, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 6889, 'price' => 95.7, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 6890, 'price' => 191.4, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        300 => [['goods_id' => 6891, 'price' => 287.1, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        500 => [['goods_id' => 6892, 'price' => 478.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+        10 => [['goods_id' => 6885, 'price' => 9.56, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6886, 'price' => 19.12, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6887, 'price' => 28.68, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6888, 'price' => 47.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6889, 'price' => 95.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6890, 'price' => 191.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6891, 'price' => 286.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6892, 'price' => 478, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 

+ 8 - 8
data/config/xyzadm/refill.ini.php

@@ -1795,14 +1795,14 @@ $kangkai_phone = ['name' => 'kangkai', 'store_id' => 98,'qualitys' => '2',
 
 $lechong_phone = ['name' => 'lechong', 'store_id' => 99, 'qualitys' => '1',
     'amount' => [
-        10 => [['goods_id' => 6885, 'price' => 9.57, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        20 => [['goods_id' => 6886, 'price' => 19.14, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 6887, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 6888, 'price' => 47.85, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 6889, 'price' => 95.7, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 6890, 'price' => 191.4, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        300 => [['goods_id' => 6891, 'price' => 287.1, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        500 => [['goods_id' => 6892, 'price' => 478.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+        10 => [['goods_id' => 6885, 'price' => 9.56, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6886, 'price' => 19.12, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6887, 'price' => 28.68, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6888, 'price' => 47.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6889, 'price' => 95.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6890, 'price' => 191.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6891, 'price' => 286.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6892, 'price' => 478, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 

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

@@ -66,6 +66,11 @@ class refill_orderModel extends Model
         return $this->table('refill_detail')->insert(['mchid' => $mchid,'mch_order' => $mch_order,'order_time' => time(),'params' => json_encode($details),'order_state' => $order_state]);
     }
 
+    public function del_detail($mchid,$mch_order)
+    {
+        return $this->table('refill_detail')->where(['mchid' => $mchid,'mch_order' => $mch_order])->delete();
+    }
+
     public function edit_detail($mchid,$mch_order,$datas)
     {
         return $this->table('refill_detail')->where(['mchid' => $mchid,'mch_order' => $mch_order])->update($datas);

+ 11 - 1
docker/compose/xyz/admin/docker-compose.yml

@@ -14,6 +14,10 @@ services:
       - /mnt/shoplog:/var/www/html/data/log
     container_name: "panda-merchant"
     command: [docker-spwan-start]
+#    deploy:
+#      resources:
+#        limits:
+#          cpus: '8'
 
   websrv:
     image: php-fpm:alpine
@@ -27,4 +31,10 @@ services:
       - /nfs/upload:/var/www/html/data/upload
       - /mnt/shoplog:/var/www/html/data/log
     container_name: "panda-web"
-    command: [php-fpm]
+    command: [php-fpm]
+    extra_hosts:
+      - "docker.hostip:172.17.0.1"
+#    deploy:
+#      resources:
+#        limits:
+#          cpus: '8'

+ 1 - 1
docker/compose/xyz/conf/php/php.ini

@@ -401,7 +401,7 @@ max_input_vars = 100000
 
 ; Maximum amount of memory a script may consume (128MB)
 ; http://php.net/memory-limit
-memory_limit = 256M
+memory_limit = -1
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; Error handling and logging ;

+ 20 - 19
helper/queue/iqueue.php

@@ -220,7 +220,7 @@ abstract class ILooper
     private $_cid = 0;
 
     private $mServer;
-    const MAX_COROUTINE = 1024;
+    const MAX_COROUTINE = 100;
 
     protected function __construct($server)
     {
@@ -295,6 +295,14 @@ abstract class ILooper
                 $pcid = Swoole\Coroutine::getPcid($cid);
                 if($pcid == $this->_cid) {
                     $count += 1;
+                    $time_secs = Swoole\Coroutine::getElapsed($cid);
+                    $backtrace = Swoole\Coroutine::getBackTrace($cid);
+
+                    $trace = "wait Coroutine quit tim={$time_secs}\n";
+                    foreach ($backtrace as $item) {
+                        $trace .= "{$item['file']}\t{$item['line']}\t{$item['function']}\n";
+                    }
+                    Log::record($trace,Log::DEBUG);
                 }
             }
 
@@ -357,26 +365,19 @@ abstract class ILooper
                             }
                         }
 
-                        if($this->_stop)
-                        {
-                            foreach ($content as $key => $params) {
-                                util::push_queue($key, $params);
-                            }
-                        }
-                        else
-                        {
-                            $pThis = $this;
-                            go(function () use ($content, $num, $mem,$pThis) {
-                                $start = microtime(true);
-                                Log::record("BeginGoFunction coroutin_num={$num} memory={$mem}", Log::DEBUG);
+                        $pThis = $this;
+                        go(function () use ($content, $num, $mem,$pThis) {
+                            $start = microtime(true);
+                            Log::record("BeginGoFunction coroutin_num={$num} memory={$mem}", Log::DEBUG);
 
-                                $method = $pThis->handle($content);
+                            $method = $pThis->handle($content);
 
-                                $use_time = microtime(true) - $start;
-                                $msg = sprintf("EndGoFunction coroutin_num={$num} memory={$mem} request_time=%.6f method={$method}", $use_time);
-                                Log::record($msg, Log::DEBUG);
-                            });
-                        }
+                            $use_time = microtime(true) - $start;
+                            $res = Swoole\Coroutine::stats();
+                            $num = $res['coroutine_num'];
+                            $msg = sprintf("EndGoFunction coroutin_num={$num} memory={$mem} request_time=%.6f method={$method}", $use_time);
+                            Log::record($msg, Log::DEBUG);
+                        });
                     }
                     else {
                         Swoole\Coroutine::sleep(0.1);

+ 10 - 0
helper/refill/util.php

@@ -519,6 +519,16 @@ class util
         $ins->hset($name, '', [$key => $order_state]);
     }
 
+    public static function del_queue_order($mchid,$mch_order)
+    {
+        if(empty($mch_order)) return;
+        $ins = Cache::getInstance('cacheredis');
+
+        $name = 'merchant_order_query';
+        $key = "{$mchid}-{$mch_order}";
+        $ret = $ins->hdel($name, '', $key);
+    }
+
     public static function pop_queue_order($mchid,$mch_order)
     {
         util::del_order_channels($mchid,$mch_order);

+ 10 - 4
mobile/control/refill.php

@@ -109,6 +109,9 @@ class refillControl extends merchantControl
             'notify_url' => $notify_url,
             'org_quality' => $quality];
 
+        refill\util::push_queue_order($this->mchid(),$mch_order,ORDER_STATE_QUEUE);
+        Model('refill_order')->add_detail($this->mchid(),$mch_order,$params,ORDER_STATE_QUEUE);
+
         [$can_refill, $period] = refill\util::can_commit($card_no, $card_type);
         if ($can_refill === false) {
             $state = refill\util::async_add($params, $period);
@@ -118,11 +121,11 @@ class refillControl extends merchantControl
 
         $mchid = $this->mchid();
         if ($state === true) {
-            refill\util::push_queue_order($this->mchid(),$mch_order,ORDER_STATE_QUEUE);
-            Model('refill_order')->add_detail($this->mchid(),$mch_order,$params,ORDER_STATE_QUEUE);
             Log::record("refill::util::push_add success mchid={$mchid} mch_order={$mch_order} state={$state}",Log::DEBUG);
             return self::outsuccess(['state' => true]);
         } else {
+            refill\util::del_queue_order($this->mchid(),$mch_order);
+            Model('refill_order')->del_detail($this->mchid(),$mch_order);
             Log::record("refill::util::push_add error mchid={$mchid} mch_order={$mch_order} state={$state}",Log::DEBUG);
             return self::outerr(208, '提交失败');
         }
@@ -197,12 +200,15 @@ class refillControl extends merchantControl
             'third_card_type' => $third_card_type
         ];
 
+        refill\util::push_queue_order($this->mchid(),$mch_order,ORDER_STATE_QUEUE);
+        Model('refill_order')->add_detail($this->mchid(),$mch_order,$params,ORDER_STATE_QUEUE);
+
         $state = refill\util::push_addthird($params);
         if ($state === true) {
-            refill\util::push_queue_order($this->mchid(),$mch_order,ORDER_STATE_QUEUE);
-            Model('refill_order')->add_detail($this->mchid(),$mch_order,$params,ORDER_STATE_QUEUE);
             return self::outsuccess(['state' => true]);
         } else {
+            refill\util::del_queue_order($this->mchid(),$mch_order);
+            Model('refill_order')->del_detail($this->mchid(),$mch_order);
             return self::outerr(208, '提交失败');
         }
     }

+ 8 - 8
test/TestRefill.php

@@ -1773,13 +1773,13 @@ class TestRefill extends TestCase
 
     public function testCtSign()
     {
-        $params['act'] = 'refill';
-        $params['amount'] = 1;
-        $params['cardno'] = 18888888888;
-        $params['mchid'] = 1101;
-        $params['op'] = 'add';
-        $params['notifyurl'] = '';
-        $params['order_sn'] = '1231212';
+        $params['amount'] = '10.00';
+        $params['message'] = '余额不足支付订单';
+        $params['cardno'] = 18345531094;
+        $params['mchid'] = 10197;
+        $params['trade_no'] = '2068550683809271439468';
+        $params['state'] = 'CANCEL';
+        $params['order_sn'] = '20210901110059907C414UF7GCIG9491';
         $sign = $this->md5_sign($params);
     }
 
@@ -1800,7 +1800,7 @@ class TestRefill extends TestCase
             }
         }
 
-        $body .= "&key=E63AFB19FA130AC0E35C5BD1C42470A5";
+        $body .= "&key=bac87b788087457e92a5319413c603a3";
 
         return md5($body);
     }