stanley-king 1 vuosi sitten
vanhempi
commit
05f958ec30

+ 0 - 82
admin/control/merchant.php

@@ -989,88 +989,6 @@ class merchantControl extends SystemControl
         showMessage('操作成功', 'index.php?act=provider&op=index');
     }
 
-    /**
-     * 新增通道
-     */
-    public function provider_addOp()
-    {
-        $provider_model = Model('refill_provider');
-        if (chksubmit()) {
-            $params = $_POST;
-            unset($params['form_submit']);
-            $result = $provider_model->addProvider($params);
-            if ($result) {
-                $url = [
-                    [
-                        'url' => 'index.php?act=provider&op=index',
-                        'msg' => '返回通道列表',
-                    ],
-                    [
-                        'url' => 'index.php?act=merchant&op=provider_add',
-                        'msg' => '继续新增通道',
-                    ],
-                ];
-                $this->log('添加通道:' . '[	' . $_POST['name'] . ']', 1);
-                showMessage('通道添加成功', $url);
-            } else {
-                showMessage('通道添加失败');
-            }
-        }
-        Tpl::showpage('provider.add');
-    }
-
-    public function provider_editOp()
-    {
-        $provider_model = Model('refill_provider');
-        if (chksubmit()) {
-            $provider_id = intval($_POST['provider_id']) ?? '';
-            $provider = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
-            if (empty($provider)) {
-                showMessage('通道信息有误');
-            }
-            $params = $_POST;
-            unset($params['form_submit']);
-            if (empty($params)) {
-                showMessage('通道编辑成功', 'index.php?act=provider&op=index');
-            }
-            $result = $provider_model->editProvider($params, ['provider_id' => $provider_id]);
-            if ($result) {
-                $this->log('编辑通道:' . '[	' . $provider['name'] . ']', 1);
-                showMessage('通道编辑成功', 'index.php?act=provider&op=index');
-            } else {
-                showMessage('通道编辑失败', "index.php?act=merchant&op=provider_edit&id={$provider_id}");
-            }
-        }
-        $provider_id = intval($_GET['id']) ?? '';
-        $provider = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
-        if (empty($provider)) {
-            showMessage('通道信息有误');
-        }
-        $type_text = ['油卡', '手机充值卡'];
-        $refill_company = $this->refill_companys(['co_type' => refill_companyModel::co_type_provider]);
-        Tpl::output('refill_company', $refill_company);
-        Tpl::output('type_text', $type_text);
-        Tpl::output('provider', $provider);
-        Tpl::showpage('provider.edit');
-    }
-
-    public function provider_delOp()
-    {
-        $provider_model = Model('refill_provider');
-        $provider_id = intval($_GET['id']) ?? '';
-        $provider = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
-        if (empty($provider)) {
-            showMessage('通道信息有误');
-        }
-        $result = $provider_model->delProvider(['provider_id' => $provider_id]);
-        if ($result) {
-            $this->log('删除通道:' . '[	' . $provider['name'] . ']', 1);
-            showMessage('通道删除成功', 'index.php?act=provider&op=index');
-        } else {
-            showMessage('通道删除失败', "index.php?act=provider&op=index");
-        }
-    }
-
     public function OrderStatsCheckOp()
     {
         $stat_id = $_GET['stat_id'] ?? $_POST['stat_id'];

+ 89 - 2
admin/control/provider.php

@@ -4,6 +4,7 @@ include(BASE_CONFIG_PATH . CONFIG_PREFIX . '/refill.ini.php');
 require_once(BASE_HELPER_PATH . '/model/member_info.php');
 require_once(BASE_HELPER_PATH . '/refill/chprice_helper.php');
 
+#通道列表
 class providerControl extends SystemControl
 {
     public function __construct()
@@ -14,6 +15,7 @@ class providerControl extends SystemControl
     public function indexOp()
     {
         global $config;
+
         $provider_model = Model('refill_provider');
         $condition = [];
         if (trim($_GET['name']) != '') {
@@ -78,20 +80,23 @@ class providerControl extends SystemControl
                 }
             }
         }
-        if(!empty($_GET['export']))
-        {
+
+        if (!empty($_GET['export'])) {
             $this->provider_export($providers);
             return;
         }
+
         $stats = ['available_total' => $available_total, 'debt_total' => $debt_total];
         $opened_text = ['使用中', '已禁用'];
         $type_text = ['油卡', '手机充值卡', '增值业务'];
+
         Tpl::output('opened_text', $opened_text);
         Tpl::output('type_text', $type_text);
         Tpl::output('provider_list', $providers);
         Tpl::output('stats', $stats);
         Tpl::output('prices', $this->all_price());
         Tpl::output('show_page', $provider_model->showpage());
+
         Tpl::showpage('provider.index');
     }
 
@@ -770,4 +775,86 @@ class providerControl extends SystemControl
         }
         return $result;
     }
+
+    /**
+     * 新增通道
+     */
+    public function provider_addOp()
+    {
+        $provider_model = Model('refill_provider');
+        if (chksubmit()) {
+            $params = $_POST;
+            unset($params['form_submit']);
+            $result = $provider_model->addProvider($params);
+            if ($result) {
+                $url = [
+                    [
+                        'url' => 'index.php?act=provider&op=index',
+                        'msg' => '返回通道列表',
+                    ],
+                    [
+                        'url' => 'index.php?act=provider&op=provider_add',
+                        'msg' => '继续新增通道',
+                    ],
+                ];
+                $this->log('添加通道:' . '[	' . $_POST['name'] . ']', 1);
+                showMessage('通道添加成功', $url);
+            } else {
+                showMessage('通道添加失败');
+            }
+        }
+        Tpl::showpage('provider.add');
+    }
+
+    public function provider_editOp()
+    {
+        $provider_model = Model('refill_provider');
+        if (chksubmit()) {
+            $provider_id = intval($_POST['provider_id']) ?? '';
+            $provider = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
+            if (empty($provider)) {
+                showMessage('通道信息有误');
+            }
+            $params = $_POST;
+            unset($params['form_submit']);
+            if (empty($params)) {
+                showMessage('通道编辑成功', 'index.php?act=provider&op=index');
+            }
+            $result = $provider_model->editProvider($params, ['provider_id' => $provider_id]);
+            if ($result) {
+                $this->log('编辑通道:' . '[	' . $provider['name'] . ']', 1);
+                showMessage('通道编辑成功', 'index.php?act=provider&op=index');
+            } else {
+                showMessage('通道编辑失败', "index.php?act=provider&op=provider_edit&id={$provider_id}");
+            }
+        }
+        $provider_id = intval($_GET['id']) ?? '';
+        $provider = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
+        if (empty($provider)) {
+            showMessage('通道信息有误');
+        }
+        $type_text = ['油卡', '手机充值卡'];
+        $refill_company = $this->refill_companys(['co_type' => refill_companyModel::co_type_provider]);
+        Tpl::output('refill_company', $refill_company);
+        Tpl::output('type_text', $type_text);
+        Tpl::output('provider', $provider);
+        Tpl::showpage('provider.edit');
+    }
+
+    public function provider_delOp()
+    {
+        $provider_model = Model('refill_provider');
+        $provider_id = intval($_GET['id']) ?? '';
+        $provider = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
+        if (empty($provider)) {
+            showMessage('通道信息有误');
+        }
+        $result = $provider_model->delProvider(['provider_id' => $provider_id]);
+        if ($result) {
+            $this->log('删除通道:' . '[	' . $provider['name'] . ']', 1);
+            showMessage('通道删除成功', 'index.php?act=provider&op=index');
+        } else {
+            showMessage('通道删除失败', "index.php?act=provider&op=index");
+        }
+    }
 }

+ 3 - 14
admin/templates/default/provider.index.php

@@ -86,18 +86,7 @@
             </tbody>
         </table>
     </form>
-    <!-- <table class="tb-type1 noborder search">
-        <tr>
-            <td>
-                <a href="index.php?act=provider&op=file_sync" class="btns">
-                    <span><i class="icon-edit"></i>新通道-价格导入</span>
-                </a>
-                <a href="index.php?act=provider&op=refresh_price" class="btns">
-                    <span><i class="icon-edit"></i>调价-立即生效</span>
-                </a>
-            </td>
-        </tr>
-    </table> -->
+
     <table class="table tb-type2" id="prompt">
         <tbody>
             <tr class="space odd">
@@ -199,7 +188,7 @@
                                     <?php } ?>
                                 </div>
                                 <div>
-                                    <a href="index.php?act=merchant&op=provider_edit&id=<?php echo $v['provider_id'] ?>">编辑通道</a>
+                                    <a href="index.php?act=provider&op=provider_edit&id=<?php echo $v['provider_id'] ?>">编辑通道</a>
 <!--                                    | <a class="deleid" href="#" data_id="--><?php //echo $v['provider_id'] ?><!--">删除通道</a>-->
                                 </div>
                             </td>
@@ -250,7 +239,7 @@
             layer.confirm('确定要删除通道 ?', {
                 btn: ['确定', '取消']
             }, function() {
-                window.location.href = `index.php?act=merchant&op=provider_del&id= ${data_id}`
+                window.location.href = `index.php?act=provider&op=provider_del&id= ${data_id}`
             }, function() {})
         });
         // 负数余额变红

+ 2 - 2
data/config/dev/base.ini.php

@@ -52,14 +52,14 @@ define('SSH_TUNEL_PROD','local');
 
 if(SSH_TUNEL_PROD ==='local') {
     $config['db'][1]['dbhost']       = MASTER_DBHOST;
-    $config['db'][1]['dbport']       = '3306';
+    $config['db'][1]['dbport']       = '3307';
     $config['db'][1]['dbuser']       = 'root';
     $config['db'][1]['dbpwd']        = '55668899';
     $config['db'][1]['dbname']       = 'xyzshop';
     $config['db'][1]['dbcharset']    = 'UTF-8';
 
     $config['db']['slave'][0]['dbhost']     = SLAVE_DBHOST;
-    $config['db']['slave'][0]['dbport']     = '3306';
+    $config['db']['slave'][0]['dbport']     = '3307';
     $config['db']['slave'][0]['dbuser']     = 'root';
     $config['db']['slave'][0]['dbpwd']      = '55668899';
     $config['db']['slave'][0]['dbname']     = 'xyzshop';

+ 1 - 1
docker/compose/homecuda/admin/docker-compose.yml

@@ -22,7 +22,7 @@ services:
     volumes:
       - ../../../../:/var/www/html
       - ../conf/etc/localtime:/etc/localtime:ro
-      - ../conf/php/php.ini:/usr/local/etc/php/php.ini
+      - ../conf/php/php-debug.ini:/usr/local/etc/php/php.ini
       - ../conf/php-fpm/php-fpm.conf:/usr/local/etc/php-fpm.conf
       - /mnt/upload:/var/www/html/data/upload
       - /mnt/shoplog:/var/www/html/data/log

+ 36 - 0
helper/refill/util.php

@@ -968,4 +968,40 @@ class util
     {
         return self::part_calc($time, 86400 * 15, 3600);
     }
+
+    public static function write_ch_submit_times($chname, $fail_times, $enough_times)
+    {
+        $name = 'channel_submit_times_limit';
+        $data = ["$chname" => json_encode([$fail_times, $enough_times])];
+
+        wcache($name,$data,'refill-');
+    }
+    public static function read_ch_submit_times($chname)
+    {
+        $name = 'channel_submit_times_limit';
+        $ret = rcache($name,'refill-',$chname);
+        if(empty($ret)) {
+            return [-1, -1];
+        }
+        $times = $ret[$chname];
+        [$fail_times, $enough_times] = json_decode($times,true);
+
+        return [$fail_times, $enough_times];
+    }
+    public static function read_ches_submit_times()
+    {
+        $name = 'channel_submit_times_limit';
+        $datas = rcache($name,'refill-');
+        if(empty($datas)) {
+            return [-1, -1];
+        }
+
+        $ret = [];
+        foreach ($datas as $ch_name => $times) {
+            $ret[$ch_name] = json_decode($times, true);
+
+        }
+
+        return $ret;
+    }
 }

+ 11 - 2
test/TestRefillUtil.php

@@ -25,10 +25,19 @@ class TestRefillUtil extends TestCase
         $val = refill\util::query_queue_order(1092,'abcdefg');
     }
 
-
-
     public function testWriteCard()
     {
         refill\util::write_card('1000113300017553895',mtopcard\SinopecCard,'13911129867');
     }
+
+    public function testChannelSubmitLimit()
+    {
+        $ch_name = 'test';
+        $fail_times  = 10;
+        $enough_times = 30;
+
+        refill\util::write_ch_submit_times($ch_name,$fail_times,$enough_times);
+        $val = refill\util::read_ch_submit_times($ch_name);
+        $all = refill\util::read_ches_submit_times();
+    }
 }