Forráskód Böngészése

Merge branch 'oilrun' of 39.97.239.116:gyfl/xyzshop into oilrun

stanley-king 4 éve
szülő
commit
02f3763ec5

+ 3 - 0
.gitignore

@@ -86,3 +86,6 @@ server/mac_start.sh
 /.phpunit.result.cache
 /composer.json
 /composer.phar
+/composer.lock
+/vendor
+phpunit.xml

+ 22 - 56
admin/control/merchant.php

@@ -566,6 +566,13 @@ class merchantControl extends SystemControl
 
         $provider_list = $provider_model->getProviderList($condition, 25);
 
+        foreach ($provider_list as $key => $provider) {
+            if(!empty($provider['start_period']) && !empty($provider['end_period'])){
+                $provider_list[$key]['period'] = $provider['start_period'] . '~' . $provider['end_period'];
+            }else{
+                $provider_list[$key]['period'] = '全时间段';
+            }
+        }
         $opened_text = ['使用中', '已禁用'];
         $type_text = ['油卡', '手机充值卡'];
         Tpl::output('opened_text', $opened_text);
@@ -656,8 +663,9 @@ class merchantControl extends SystemControl
     {
         $provider_model = Model('refill_provider');
         if (chksubmit()) {
-            $insert_array = $this->providerCheck($_POST , 'add');
-            $result = $provider_model->addProvider($insert_array);
+            $params = $_POST;
+            unset($params['form_submit']);
+            $result = $provider_model->addProvider($params);
             if ($result) {
                 $url = [
                     [
@@ -678,36 +686,36 @@ class merchantControl extends SystemControl
         Tpl::showpage('provider.add');
     }
 
-    /**
-     * 新增通道
-     */
     public function provider_editOp()
     {
         $provider_model = Model('refill_provider');
         if (chksubmit()) {
-            $provider_id = intval($_POST['id']) ?? '';
+            $provider_id = intval($_POST['provider_id']) ?? '';
             $provider = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
-            if(empty($provider)){
+            if (empty($provider)) {
                 showMessage('通道信息有误');
             }
-            $params = $this->providerCheck($_POST , 'edit' , $provider);
-            if(empty($params)){
+            $params = $_POST;
+            unset($params['form_submit']);
+            if (empty($params)) {
                 showMessage('通道编辑成功', 'index.php?act=merchant&op=provider');
             }
-            $result = $provider_model->editProvider($params , ['provider_id' => $provider_id]);
+            $result = $provider_model->editProvider($params, ['provider_id' => $provider_id]);
             if ($result) {
-                $this->log('编辑通道:' . '[	' . $_POST['name'] . ']', 1);
+                $this->log('编辑通道:' . '[	' . $provider['name'] . ']', 1);
                 showMessage('通道编辑成功', 'index.php?act=merchant&op=provider');
             } else {
-                showMessage('通道编辑失败' , "index.php?act=merchant&op=provider_edit&id={$provider_id}");
+                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)){
+        if (empty($provider)) {
             showMessage('通道信息有误');
         }
-        Tpl::output('provider',$provider);
+        $type_text = ['油卡', '手机充值卡'];
+        Tpl::output('type_text', $type_text);
+        Tpl::output('provider', $provider);
         Tpl::showpage('provider.edit');
     }
 
@@ -726,48 +734,6 @@ class merchantControl extends SystemControl
             showMessage('通道删除失败' , "index.php?act=merchant&op=provider");
         }
     }
-
-    private function providerCheck($params,$type,$provider=[])
-    {
-        $obj_validate = new Validator();
-        $obj_validate->validateparam = [
-            ["input" => $params["name"], "require" => "true", "message" => '通道名称不能为空'],
-            ["input" => $params["type"], "require" => "true", "message" => '通道类型不能为空'],
-            ["input" => $params["interval_sec"], "require" => "true", "message" => '每单间隔时间不能为空'],
-            ["input" => $params["process_num"], "require" => "true", "message" => '子进程数量不能为空']
-        ];
-        $error = $obj_validate->validate();
-        if ($error != '') {
-            showMessage($error);
-        }
-        $result = [];
-        if ($type == 'add') {
-            $result['name'] = trim($params['name']);
-            $result['type'] = intval($params['type']);
-            $result['interval_sec'] = intval($params['interval_sec']);
-            $result['process_num'] = intval($params['process_num']);
-            $result['sort'] = intval($params['sort']) ?? '';
-        }
-        if ($type == 'edit') {
-            if ($params['name'] != $provider['name']) {
-                $result['name'] = trim($params['name']);
-            }
-            if ($params['type'] != $provider['type']) {
-                $result['type'] = intval($params['type']);
-            }
-            if ($params['interval_sec'] != $provider['interval_sec']) {
-                $result['interval_sec'] = intval($params['interval_sec']);
-            }
-            if ($params['process_num'] != $provider['process_num']) {
-                $result['process_num'] = intval($params['process_num']);
-            }
-            if (!empty($params['sort']) && $params['sort'] != $provider['sort']) {
-                $result['sort'] = intval($params['sort']);
-            }
-        }
-        return $result;
-    }
-
     private function whereStr_ct($cond){
         if(empty($cond)){
             return '';

+ 25 - 32
admin/templates/default/provider.edit.php

@@ -13,14 +13,14 @@
     <div class="fixed-empty"></div>
     <form id="user_form" enctype="multipart/form-data" method="post">
         <input type="hidden" name="form_submit" value="ok"/>
-        <input type="hidden" name="id" value="<?php echo $output['provider']['provider_id']?>"/>
+        <input type="hidden" name="provider_id" value="<?php echo $output['provider']['provider_id']?>"/>
         <table class="table tb-type2">
             <tbody>
             <tr class="noborder">
                 <td colspan="2" class="required"><label class="validation" for="name">通道名称:</label></td>
             </tr>
             <tr class="noborder">
-                <td class="vatop rowform"><input type="text" value="<?php echo $output['provider']['name']?>" name="name" id="name" class="txt"></td>
+                <td class="vatop rowform"><?php echo $output['provider']['name']?></td>
                 <td class="vatop tips"></td>
             </tr>
             <tr class="noborder">
@@ -28,15 +28,12 @@
             </tr>
             <tr class="noborder">
                 <td class="vatop rowform">
-                    <select name="type" id="type">
-                        <option value="1" <?php if($output['provider']['type'] == 1) echo 'selected'?>>油卡</option>
-                        <option value="2" <?php if($output['provider']['type'] == 2) echo 'selected'?>>手机充值卡</option>
-                    </select>
+                    <?php echo $output['type_text'][$output['provider']['type']-1]; ?>
                 </td>
                 <td class="vatop tips"></td>
             </tr>
             <tr class="noborder">
-                <td colspan="2"><label for="name">排序:</label></td>
+                <td colspan="2"><label class="validation" for="sort">排序:</label></td>
             </tr>
             <tr class="noborder">
                 <td class="vatop rowform"><input type="text" value="<?php echo $output['provider']['sort']?>" name="sort" id="sort" class="txt"></td>
@@ -56,6 +53,27 @@
                 <td class="vatop rowform"><input type="text" value="<?php echo $output['provider']['process_num']?>" name="process_num" id="process_num" class="txt"></td>
                 <td class="vatop tips"></td>
             </tr>
+            <tr class="noborder">
+                <td colspan="2"><label for="every_amt">每日额度:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" value="<?php echo $output['provider']['every_amt']?>" name="every_amt" id="every_amt" class="txt"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td colspan="2"><label for="start_period">每日开始时间:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" value="<?php echo $output['provider']['start_period']?>" name="start_period" id="start_period" class="txt"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td colspan="2"><label for="end_period">每日结束时间:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" value="<?php echo $output['provider']['end_period']?>" name="end_period" id="end_period" class="txt"></td>
+                <td class="vatop tips"></td>
+            </tr>
             </tbody>
             <tfoot>
             <tr class="tfoot">
@@ -86,23 +104,6 @@
                 error.appendTo(element.parent().parent().prev().find('td:first'));
             },
             rules: {
-                name: {
-                    required: true,
-                    minlength: 3,
-                    maxlength: 20,
-                    // remote: {
-                    //     url: 'index.php?act=merchant&op=ajax&branch=check_mch_name',
-                    //     type: 'get',
-                    //     data: {
-                    //         name: function () {
-                    //             return $('#name').val();
-                    //         },
-                    //     }
-                    // }
-                },
-                type: {
-                    required: true,
-                },
                 sort: {
                     required: true,
                 },
@@ -114,14 +115,6 @@
                 },
             },
             messages: {
-                name: {
-                    required: '<?php echo $lang['merchant_add_name_null']?>',
-                    maxlength: '<?php echo $lang['merchant_add_name_length']?>',
-                    minlength: '<?php echo $lang['merchant_add_name_length']?>',
-                },
-                type: {
-                    required: '<?php echo '通道类型不能为空'; ?>',
-                },
                 sort: {
                     required: '<?php echo '排序不能为空'; ?>',
                 },

+ 5 - 1
admin/templates/default/provider.index.php

@@ -6,7 +6,7 @@
             <h3>通道管理</h3>
             <ul class="tab-base">
                 <li><a href="JavaScript:void(0);" class="current"><span><?php echo $lang['nc_manage'] ?></span></a></li>
-                <li><a href="index.php?act=merchant&op=provider_add"><span><?php echo $lang['nc_new'] ?></span></a></li>
+<!--                <li><a href="index.php?act=merchant&op=provider_add"><span>--><?php //echo $lang['nc_new'] ?><!--</span></a></li>-->
             </ul>
         </div>
     </div>
@@ -64,6 +64,8 @@
                 <th class="align-center">通道状态</th>
                 <th class="align-center">每单间隔秒数</th>
                 <th class="align-center">需要子进程数量</th>
+                <th class="align-center">每日额度</th>
+                <th class="align-center">每日时间段</th>
                 <th class="align-center"><?php echo $lang['operation']; ?></th>
             </tr>
             </thead>
@@ -78,6 +80,8 @@
                         <td class="align-center"><?php echo $output['opened_text'][$v['opened']-1]; ?></td>
                         <td class="align-center"><?php echo $v['interval_sec']?></td>
                         <td class="align-center"><?php echo $v['process_num']?></td>
+                        <td class="align-center"><?php echo $v['every_amt']?></td>
+                        <td class="align-center"><?php echo $v['period']?></td>
                         <td class="align-center w200">
                             <?php if($v['opened'] == 1){?>
                                 <a href="index.php?act=merchant&op=changeProviderState&state=2&id=<?php echo $v['provider_id'] ?>">关闭通道</a>

+ 5 - 5
admin/templates/default/refill.order.index.php

@@ -60,9 +60,9 @@
           <tr>
             <td>
             <ul>
-                <li>总计充值金额:<?php echo $output['stat']['refill_amount'] ?? 0?></li>
-                <li>总计渠道扣款金额:<?php echo $output['stat']['channel_amount'] ?? 0?></li>
-                <li>总计机构扣款金额:<?php echo $output['stat']['mch_amount'] ?? 0?></li>
+                <li>总计充值金额:<?php echo $output['stat']['refill_amounts'] ?? 0?></li>
+                <li>总计渠道扣款金额:<?php echo $output['stat']['channel_amounts'] ?? 0?></li>
+                <li>总计机构扣款金额:<?php echo $output['stat']['mch_amounts'] ?? 0?></li>
               </ul></td>
           </tr>
         </tbody>
@@ -102,11 +102,11 @@
                     <td><?php echo $order['ch_trade_no']; ?></td>
                     <td><?php echo $order['official_sn']; ?></td>
                     <td class="align-center"><?php echo $order['card_type_text']; ?></td>
-                    <td class="align-center"><?php echo $order['mch_amount']; ?></td>
+                    <td class="align-center"><?php echo $order['refill_amount']; ?></td>
                     <td class="nowrap align-center"><?php echo date('Y-m-d H:i:s', $order['order_time']); ?></td>
                     <td class="align-center"><?php echo $order['notify_time'] ? date('Y-m-d H:i', $order['notify_time']) : $lang['no_limit']; ?></td>
-                    <td class="align-center"><?php echo $order['refill_amount']; ?></td>
                     <td class="align-center"><?php echo $order['channel_name']; ?></td>
+                    <td class="align-center"><?php echo $order['mch_amount']; ?></td>
                     <td class="align-center"><?php echo $order['channel_amount']; ?></td>
                     <td class="align-center"><?php echo orderState($order); ?></td>
                     <td class="w144 align-center">

+ 4 - 4
data/config/prod/refill.ini.php

@@ -86,10 +86,10 @@ $yifa_phone = ['name' => 'yifa', 'store_id' => 16, 'card_type' => ['chinamobile'
     'refill_type' => 'api'];
 
 $jiec_phone = ['name' => 'jiec', 'store_id' => 17, 'card_type' => ['chinaunicom', 'chinatelecom'],
-    'amount' => [30 => ['goods_id' => 6323, 'price' => 28.74],
-        50 => ['goods_id' => 6324, 'price' => 47.9],
-        100 => ['goods_id' => 6325, 'price' => 95.8],
-        200 => ['goods_id' => 6326, 'price' => 191.6]], 'official_sn' => true, 'refill_type' => 'api'];
+    'amount' => [30 => ['goods_id' => 6323, 'price' => 28.65],
+        50 => ['goods_id' => 6324, 'price' => 47.75],
+        100 => ['goods_id' => 6325, 'price' => 95.5],
+        200 => ['goods_id' => 6326, 'price' => 191]], 'official_sn' => true, 'refill_type' => 'api'];
 
 $phone_providers = [
     ['name' => 'beixt', 'cfg' => $beixt_phone, 'opened' => false, 'sort' => 1],

+ 1 - 1
data/config/win/base.ini.php

@@ -11,7 +11,7 @@ define('USE_BONUS_RATE',false);
 define('SERVER_TYPE','panda');
 define('CROSS_DOAMIN',true);
 define('COOKIE_DOMAIN','192.168.1.195');
-define('NET_IP','124.64.84.75');
+define('NET_IP','222.130.242.243');
 
 $SRV_HOST = 'http://192.168.1.195';
 $REMOTE_IMG_HOST = $SRV_HOST;

+ 87 - 18
data/config/win/refill.ini.php

@@ -1,30 +1,99 @@
 <?php
 
+//速汇充京东加油通道
+$suhc_oil = ['name' => 'suhc', 'store_id' => 7, 'card_type' => ['sinopec'],
+    'amount' => [100 => ['goods_id' => 6290, 'price' => 96.8],
+        200 => ['goods_id' => 6291, 'price' => 193.6],
+        500 => ['goods_id' => 6292, 'price' => 484],
+        1000 => ['goods_id' => 6293, 'price' => 968]],
+    'period' => ['start' => '8:30', 'end' => '22:20'], 'refill_type' => 'api'];
 
-$suhc_oil = ['name' => 'suhc','store_id' => 8,'card_type' => ['sinopec'],
-    'amount' => [100 => ['goods_id' => 6226,'price' => 96.8],
-        200 => ['goods_id' => 6227,'price' => 197.6],
-        500 => ['goods_id' => 6228,'price' => 484],
-        1000=> ['goods_id' => 6229,'price' => 968],
-        2000=> ['goods_id' => 6230,'price' => 1976]],
-    'period' => ['start' => '8:30','end' => '22:30'],'refill_type' => 'api'];
-$oil_providers = ['suhc' => $suhc_oil];
+//速汇充天猫加油通道
+$suhctm_oil = ['name' => 'suhctm', 'store_id' => 7, 'card_type' => ['sinopec'],
+    'amount' => [100 => ['goods_id' => 6290, 'price' => 96.8],
+        200 => ['goods_id' => 6291, 'price' => 193.6],
+        500 => ['goods_id' => 6292, 'price' => 484],
+        1000 => ['goods_id' => 6293, 'price' => 968]],
+    'period' => ['start' => '8:30', 'end' => '22:20'], 'refill_type' => 'api'];
+
+$suhcpdd_oil = ['name' => 'suhcpdd', 'store_id' => 7, 'card_type' => ['sinopec'],
+    'amount' => [
+//        100 => ['goods_id' => 6290, 'price' => 96.8],
+//        200 => ['goods_id' => 6291, 'price' => 193.6],
+//        500 => ['goods_id' => 6292, 'price' => 484],
+        1000 => ['goods_id' => 6293, 'price' => 968]
+    ],
+    'period' => ['start' => '8:30', 'end' => '22:20'], 'refill_type' => 'api'];
+
+//赵梓暄提供的加油通道
+$zzx_oil = ['name' => 'zzx', 'store_id' => 13, 'card_type' => ['petrochina', 'sinopec'],
+    'amount' => [100 => ['goods_id' => 6307, 'price' => 97.8],
+        200 => ['goods_id' => 6308, 'price' => 195.6],
+        500 => ['goods_id' => 6309, 'price' => 489],
+        1000 => ['goods_id' => 6310, 'price' => 978]], 'refill_type' => 'api'];
+
+//赵梓暄提供的加油通道
+$lx_oil = ['name' => 'lx', 'store_id' => 14, 'card_type' => ['sinopec'],
+    'amount' => [500 => ['goods_id' => 6322, 'price' => 479],
+        1000 => ['goods_id' => 6311, 'price' => 958] //,
+//        2000 => ['goods_id' => 6322, 'price' => 1916]
+    ],
+    'period' => ['start' => '14:00', 'end' => '19:00'], 'official_sn' => true, 'refill_type' => 'inner_store'];
+
+//赛虎
+$saihu_oil = ['name' => 'saihu', 'store_id' => 15, 'card_type' => ['sinopec'],
+    'amount' => [100 => ['goods_id' => 6313, 'price' => 97],
+        200 => ['goods_id' => 6314, 'price' => 194],
+        500 => ['goods_id' => 6315, 'price' => 485],
+        1000 => ['goods_id' => 6316, 'price' => 970],
+        2000 => ['goods_id' => 6317, 'price' => 1940]], 'refill_type' => 'api'];
+
+$oil_providers = [
+    ['name' => 'suhc', 'cfg' => $suhc_oil, 'opened' => false, 'sort' => 3],
+    ['name' => 'suhctm', 'cfg' => $suhctm_oil, 'opened' => true, 'sort' => 1],
+    ['name' => 'suhcpdd', 'cfg' => $suhcpdd_oil, 'opened' => true, 'sort' => 2],
+    ['name' => 'zzx', 'cfg' => $zzx_oil, 'opened' => false, 'sort' => 5],
+    ['name' => 'lx', 'cfg' => $lx_oil, 'opened' => false, 'sort' => 1],
+    ['name' => 'saihu', 'cfg' => $saihu_oil, 'opened' => false, 'sort' => 6]];
 $config['oil_providers'] = $oil_providers;
 
+$beixt_phone = ['name' => 'beixt', 'store_id' => 8, 'card_type' => ['chinamobile', 'chinaunicom', 'chinatelecom'],
+    'amount' => [50 => ['goods_id' => 6295, 'price' => 48.75],
+        100 => ['goods_id' => 6296, 'price' => 97.5],
+        200 => ['goods_id' => 6297, 'price' => 195]],
+    'refill_type' => 'api'];
 
-$beixt_phone = ['name' => 'beixt','store_id' => 9,'card_type' => ['chinamobile','chinaunicom','chinatelecom'],
-    'amount' => [50 => ['goods_id' => 6231,'price' => 48.75],
-        100 => ['goods_id' => 6232,'price' => 97.5],
-        200 => ['goods_id' => 6233,'price' => 195]],
+$bxtwt_phone = ['name' => 'bxtwt', 'store_id' => 10, 'card_type' => ['chinamobile', 'chinaunicom', 'chinatelecom'],
+    'amount' => [50 => ['goods_id' => 6298, 'price' => 48],
+        100 => ['goods_id' => 6299, 'price' => 96],
+        200 => ['goods_id' => 6300, 'price' => 192]],
     'refill_type' => 'api'];
 
-$xc_phone = ['name' => 'xc','store_id' => 10 , 'card_type' => ['chinamobile','chinaunicom','chinatelecom']];
+$bjb_phone = ['name' => 'bjb', 'store_id' => 12, 'card_type' => ['chinamobile' ,/*'chinaunicom', */'chinatelecom'],
+    'amount' => [10 => ['goods_id' => 6305, 'price' => 9.55],
+        20 => ['goods_id' => 6306, 'price' => 19.1],
+        30 => ['goods_id' => 6301, 'price' => 28.65],
+        50 => ['goods_id' => 6302, 'price' => 47.75],
+        100 => ['goods_id' => 6303, 'price' => 95.5],
+        200 => ['goods_id' => 6304, 'price' => 191]], 'official_sn' => true, 'refill_type' => 'api'];
 
-$beixts_phone = ['name' => 'bxtwt','store_id' => 11,'card_type' => ['chinamobile','chinaunicom','chinatelecom'],
-    'amount' => [50 => ['goods_id' => 6231,'price' => 48.75],
-        100 => ['goods_id' => 6232,'price' => 97.5],
-        200 => ['goods_id' => 6233,'price' => 195]],
+$yifa_phone = ['name' => 'yifa', 'store_id' => 16, 'card_type' => ['chinamobile'],
+    'amount' => [30 => ['goods_id' => 6318, 'price' => 28.65],
+        50 => ['goods_id' => 6319, 'price' => 47.75],
+        100 => ['goods_id' => 6320, 'price' => 95.5],
+        200 => ['goods_id' => 6321, 'price' => 191]],
     'refill_type' => 'api'];
 
-$phone_providers = ['beixt' => $beixt_phone , 'xc' => $xc_phone , 'bxtwt' => $beixts_phone];
+$jiec_phone = ['name' => 'jiec', 'store_id' => 17, 'card_type' => ['chinaunicom', 'chinatelecom'],
+    'amount' => [30 => ['goods_id' => 6323, 'price' => 28.65],
+        50 => ['goods_id' => 6324, 'price' => 47.75],
+        100 => ['goods_id' => 6325, 'price' => 95.5],
+        200 => ['goods_id' => 6326, 'price' => 191]], 'official_sn' => true, 'refill_type' => 'api'];
+
+$phone_providers = [
+    ['name' => 'beixt', 'cfg' => $beixt_phone, 'opened' => false, 'sort' => 1],
+    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone, 'opened' => false, 'sort' => 2],
+    ['name' => 'bjb', 'cfg' => $bjb_phone, 'opened' => false, 'sort' => 2],
+    ['name' => 'yifa', 'cfg' => $yifa_phone, 'opened' => false, 'sort' => 5],
+    ['name' => 'jiec', 'cfg' => $jiec_phone, 'opened' => true, 'sort' => 1]];
 $config['phone_providers'] = $phone_providers;

+ 7 - 0
mobile/refill_xc.php

@@ -0,0 +1,7 @@
+<?php
+
+require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
+
+refill\RefillFactory::instance()->notify('xc',$_POST);
+
+echo ('success');

+ 1 - 1
test/TestRefill.php

@@ -133,7 +133,7 @@ class TestRefill extends TestCase
     public function testJiecPhone()
     {
         $providers = new refill\jiec\RefillPhone([]);
-        $resp = $providers->add('15120035568', 2, 100, ['order_sn' => $this->make_sn()]);
+        $resp = $providers->add('18500608333', 5, 30, ['order_sn' => $this->make_sn()]);
     }
 
     public function testBxtwtCB()