浏览代码

admin update

xiaoyu 3 年之前
父节点
当前提交
f5278e9f94

+ 109 - 59
admin/control/merchant.php

@@ -29,7 +29,7 @@ class merchantControl extends SystemControl
         $model_merchant = Model('merchant');
 
         if (trim($_GET['merchant_name']) != '') {
-            $condition['company_name'] = ['like', '%'.$_GET['merchant_name'].'%'];
+            $condition['company_name'] = ['like', '%' . $_GET['merchant_name'] . '%'];
         }
 
         $merchant_list = $model_merchant->getMerchantList($condition, 100, 'available_predeposit desc,merchant_state asc,mchid desc', true);
@@ -136,19 +136,17 @@ class merchantControl extends SystemControl
             showMessage('机构信息有误');
         }
 
-        if (chksubmit())
-        {
+        if (chksubmit()) {
             $update_credit_bonus = ncPriceFormat($_POST['credit_bonus']);
-            if($update_credit_bonus > 0)
-            {
-                if($merchant['credit_bonus'] + $update_credit_bonus < 0) {
+            if ($update_credit_bonus > 0) {
+                if ($merchant['credit_bonus'] + $update_credit_bonus < 0) {
                     showMessage('授信金额调整后不能小于0');
                 }
                 $operatetype = $_POST['operatetype'];
-                if($operatetype == 'add') {
-                    $update['credit_bonus'] = ['exp','credit_bonus+'.$update_credit_bonus];
-                }elseif($operatetype == 'del') {
-                    $update['credit_bonus'] = ['exp','credit_bonus-'.$update_credit_bonus];
+                if ($operatetype == 'add') {
+                    $update['credit_bonus'] = ['exp', 'credit_bonus+' . $update_credit_bonus];
+                } elseif ($operatetype == 'del') {
+                    $update['credit_bonus'] = ['exp', 'credit_bonus-' . $update_credit_bonus];
                 }
             }
 
@@ -160,12 +158,11 @@ class merchantControl extends SystemControl
             $update['quality'] = intval($_POST['quality']);
             $update['oil_quality'] = intval($_POST['oil_quality']);
             $member_id = $merchant['admin_id'];
-            try
-            {
+            try {
                 $model_merchant = Model('merchant');
                 $trans = new trans_wapper($model_merchant, __METHOD__);
 
-                if($update_credit_bonus > 0) {
+                if ($update_credit_bonus > 0) {
                     $this->credit_save_money($update_credit_bonus, $operatetype, $member_id);
                 }
 
@@ -257,7 +254,7 @@ class merchantControl extends SystemControl
                 $model_merchant = Model('merchant');
                 $trans = new trans_wapper($model_merchant, __METHOD__);
                 //删除旧费率
-                $model_merchant->delPrices(['mchid' => $mchid , 'quality' => $quality]);
+                $model_merchant->delPrices(['mchid' => $mchid, 'quality' => $quality]);
                 //更新新费率
                 if (!empty($inserts)) {
                     $model_merchant->insertPrices($inserts);
@@ -279,7 +276,7 @@ class merchantControl extends SystemControl
     {
         $mchid = $_GET['mchid'] ?? $_POST['mchid'];
         $mod = Model('thrid_refill');
-        if(chksubmit()) {
+        if (chksubmit()) {
             //合并表单数据
             $card_types = $_POST['cardtype'];
             $specs = $_POST['spec'];
@@ -312,7 +309,7 @@ class merchantControl extends SystemControl
                     //删除旧费率
                     $model_merchant->delPrices(['mchid' => $mchid, 'quality' => $quality, 'pcode' => $param['pcode']]);
                     //更新新费率
-                    if(!empty($insert)) {
+                    if (!empty($insert)) {
                         $model_merchant->table('merchant_price')->insert($insert);
                     }
                 }
@@ -322,15 +319,15 @@ class merchantControl extends SystemControl
                 $trans->rollback();
                 showMessage('操作失败', 'index.php?act=merchant&op=merchant', 'html', 'error');
             }
-        } else{
+        } else {
             $condition = [];
-            if(!empty($_GET['system_code'])) {
+            if (!empty($_GET['system_code'])) {
                 $condition['system_code'] = $_GET['system_code'];
             }
             if (trim($_GET['product_name']) != '') {
                 $condition['product_name'] = ['like', '%' . $_GET['product_name'] . '%'];
             }
-            $third_product = $mod->getProductList($condition,30);
+            $third_product = $mod->getProductList($condition, 30);
 
             $model_merchant = Model('merchant');
             $items = $model_merchant->table('merchant_price')->where(['mchid' => $mchid, 'quality' => 1, 'card_types' => mtopcard\ThirdRefillCard])->select();
@@ -367,9 +364,9 @@ class merchantControl extends SystemControl
                 } else {
                     continue;
                 }
-                if(in_array($card_type, [mtopcard\ChinaMobileCard,mtopcard\ChinaUnicomCard,mtopcard\ChinaTelecomCard])) {
-                    if($quality == \refill\Quality::Quick) {
-                        $specs = array_merge($config['refill_phone_small_specs'],$specs);
+                if (in_array($card_type, [mtopcard\ChinaMobileCard, mtopcard\ChinaUnicomCard, mtopcard\ChinaTelecomCard])) {
+                    if ($quality == \refill\Quality::Quick) {
+                        $specs = array_merge($config['refill_phone_small_specs'], $specs);
                     }
                 }
 
@@ -398,7 +395,7 @@ class merchantControl extends SystemControl
                         'spec' => intval($item['spec']),
                         'price' => $item['price'],
                         'extra_price' => $item['extra_price']
-                        ];
+                    ];
                 }
             }
             return $result;
@@ -542,7 +539,7 @@ class merchantControl extends SystemControl
         if (chksubmit()) {
             $add_type = '';
             $obj_validate = new Validator();
-            if($type == 'add') {
+            if ($type == 'add') {
                 $add_type = '加款';
                 $obj_validate->validateparam = [
                     ["input" => $_POST["mch_id"], "require" => "true", "message" => '机构号不能为空'],
@@ -575,14 +572,14 @@ class merchantControl extends SystemControl
             if ($money == 0) {
                 showMessage('预存金额错误');
             }
-            if(!empty($_FILES['voucher']['name'])) {
+            if (!empty($_FILES['voucher']['name'])) {
                 $upload = new UploadFile();
-                $upload->set('default_dir',ATTACH_UPFILE);
+                $upload->set('default_dir', ATTACH_UPFILE);
 
                 $result = $upload->upfile('voucher');
-                if ($result){
+                if ($result) {
                     $_POST['voucher_name'] = $upload->file_name;
-                }else {
+                } else {
                     showMessage($upload->error);
                 }
             }
@@ -652,7 +649,7 @@ class merchantControl extends SystemControl
         $input['admin_id'] = $admininfo['id'];
         $input['add_type'] = $params['add_type'];
         $input['receive_bank'] = $params['receive_bank'] ?? 0;
-        if($params['type'] == 'add') {
+        if ($params['type'] == 'add') {
             $input['is_bank'] = 1;
         }
 
@@ -778,8 +775,8 @@ class merchantControl extends SystemControl
         $order_id = $_GET['order_id'];
         $mod_order = Model('vr_order');
         $order_info = $mod_order->getOrderInfo(['order_id' => $order_id]);
-        $refill_info = Model('refill_order')->getOrderInfo(['order_id' => $order_id,'inner_status' => 0,'is_retrying' => 0]);
-        if(empty($refill_info)) {
+        $refill_info = Model('refill_order')->getOrderInfo(['order_id' => $order_id, 'inner_status' => 0, 'is_retrying' => 0]);
+        if (empty($refill_info)) {
             showMessage('订单不存在,或不符合条件', '');
         }
         if ($order_info['order_state'] == ORDER_STATE_SEND) {
@@ -797,12 +794,12 @@ class merchantControl extends SystemControl
 
         $mod_order = Model('vr_order');
         $order_info = $mod_order->getOrderInfo(['order_id' => $order_id]);
-        $refill_info = Model('refill_order')->getOrderInfo(['order_id' => $order_id,'inner_status' => 0,'is_retrying' => 0]);
-        if(empty($refill_info)) {
+        $refill_info = Model('refill_order')->getOrderInfo(['order_id' => $order_id, 'inner_status' => 0, 'is_retrying' => 0]);
+        if (empty($refill_info)) {
             showMessage('订单不存在,或不符合条件', '');
         }
         $check_fetch_order = $this->check_fetch_order($order_info['order_sn']);
-        if($check_fetch_order == false) {
+        if ($check_fetch_order == false) {
             showMessage('此订单不可手动操作,请联系抢单人员操作!');
         }
         if ($type == 'success') {
@@ -840,14 +837,14 @@ class merchantControl extends SystemControl
         }
         $operator = [mtopcard\ChinaMobileCard, mtopcard\ChinaUnicomCard, mtopcard\ChinaTelecomCard];
 
-        if(chksubmit()) {
+        if (chksubmit()) {
             foreach ($operator as $opr) {
                 $key = $opr . '-province';
                 $province = $_POST[$key];
-                if($province == -1) {
+                if ($province == -1) {
                     $updata[$opr] = -1;
-                }else{
-                    $updata[$opr] = implode(',',$province);
+                } else {
+                    $updata[$opr] = implode(',', $province);
                 }
             }
             $resp = $provider_model->editProvider(['provinces' => serialize($updata)], ['provider_id' => $provider_id]);
@@ -861,7 +858,7 @@ class merchantControl extends SystemControl
             $provinces = [];
 
             foreach ($operator as $opr) {
-                if(empty($data)) {
+                if (empty($data)) {
                     $provinces[$opr] = [-1];
                 } else {
                     $provinces[$opr] = explode(',', $data[$opr]);
@@ -978,7 +975,7 @@ class merchantControl extends SystemControl
         $rkey = $this->speed_key($type, $form);
         $quality = [
             'common' => \refill\Quality::Normal, 'fast' => \refill\Quality::Quick, 'card' => \refill\Quality::CardKey,
-            'third' => \refill\Quality::ThirdShop, 'slow' => \refill\Quality::SlowTwentyFour , 'slow6' => \refill\Quality::SlowSix,
+            'third' => \refill\Quality::ThirdShop, 'slow' => \refill\Quality::SlowTwentyFour, 'slow6' => \refill\Quality::SlowSix,
             'slow2' => \refill\Quality::SlowTwo, 'slow48' => \refill\Quality::SlowFortyEight, 'slow72' => \refill\Quality::SlowSeventyTwo
         ];
         if (chksubmit()) {
@@ -1048,7 +1045,7 @@ class merchantControl extends SystemControl
             $amounts = $formData['amounts'];
             $cfgs = $formData['cfgs'];
             $types = $formData['types'];
-            if(!empty($speed_limit)) {
+            if (!empty($speed_limit)) {
                 foreach ($speed_limit as $key => $speed) {
                     foreach ($speed as $value) {
                         $speed_limit[$key][$value['pid']] = $value;
@@ -1127,9 +1124,9 @@ class merchantControl extends SystemControl
         if ($type == 2) {
             $amounts = $config['refill_phone_specs'];
             $cfgs = $config['phone_providers'];
-            if($form == 'fast') {
+            if ($form == 'fast') {
                 //快充质量,加小面值
-                $amounts = array_merge($config['refill_phone_small_specs'],$amounts);
+                $amounts = array_merge($config['refill_phone_small_specs'], $amounts);
             }
         }
 
@@ -1163,24 +1160,24 @@ class merchantControl extends SystemControl
             $refund = $_POST['refund'] ?? 0;
             $remark = $_POST['remark'];
             $gap_order_count = $gap_success_amounts = $gap_success_refill_amounts = 0;
-            if($type == 'provider') {
-                if(!empty($corder_success_amounts)) {
+            if ($type == 'provider') {
+                if (!empty($corder_success_amounts)) {
                     $gap_success_amounts = $corder_success_amounts - $stats_data['success_channel_amounts'];
                 }
-                if(!empty($corder_success_count)) {
+                if (!empty($corder_success_count)) {
                     $gap_order_count = $corder_success_count - $stats_data['success_count'];
                 }
-            }elseif ($type == 'merchant') {
-                if(!empty($corder_success_count)) {
+            } elseif ($type == 'merchant') {
+                if (!empty($corder_success_count)) {
                     $gap_order_count = $stats_data['success_count'] - $corder_success_count;
                 }
-                if(!empty($corder_success_amounts)) {
+                if (!empty($corder_success_amounts)) {
                     $gap_success_amounts = $stats_data['success_channel_amounts'] - $corder_success_amounts;
                 }
-            }else{
+            } else {
                 showMessage('对账数据类型错误', 'index.php?act=OrderStats&op=index');
             }
-            if(!empty($corder_success_refill_amounts)) {
+            if (!empty($corder_success_refill_amounts)) {
                 $gap_success_refill_amounts = $corder_success_refill_amounts - $stats_data['success_refill_amounts'];
             }
 
@@ -1192,17 +1189,17 @@ class merchantControl extends SystemControl
             $updata['gap_success_refill_amounts'] = $gap_success_refill_amounts;
             $updata['remark'] = $remark;
             $updata['refund'] = $refund;
-            if(!empty($corder_success_count) && !empty($corder_success_amounts) && !empty($corder_success_refill_amounts)) {
-                if($gap_order_count == 0 && $gap_success_amounts == 0 && $gap_success_refill_amounts == 0 ) {
+            if (!empty($corder_success_count) && !empty($corder_success_amounts) && !empty($corder_success_refill_amounts)) {
+                if ($gap_order_count == 0 && $gap_success_amounts == 0 && $gap_success_refill_amounts == 0) {
                     $updata['check_status'] = 1;
-                }else{
+                } else {
                     $updata['check_status'] = 2;
                 }
             }
             $res = $mod_stat->edit($stat_id, $updata);
 
             if ($res) {
-                showMessage('操作成功',"index.php?act=OrderStats&op=index&type={$type}&cid={$stats_data['cid']}&order_time_type={$stats_data['order_time_type']}");
+                showMessage('操作成功', "index.php?act=OrderStats&op=index&type={$type}&cid={$stats_data['cid']}&order_time_type={$stats_data['order_time_type']}");
             } else {
                 showMessage('操作失败');
             }
@@ -1226,10 +1223,10 @@ class merchantControl extends SystemControl
         try {
             $trans = new trans_wapper($mod_stat, __METHOD__);
             //更新新数据
-            if($stats_data['type'] == 'merchant') {
-                $refill->merchant_stat($stats_data['time_stamp'],$stats_data['cid'],$stats_data['order_time_type']);
-            }elseif ($stats_data['type'] == 'provider') {
-                $refill->provider_stat($stats_data['time_stamp'],$stats_data['cid'],$stats_data['order_time_type']);
+            if ($stats_data['type'] == 'merchant') {
+                $refill->merchant_stat($stats_data['time_stamp'], $stats_data['cid'], $stats_data['order_time_type']);
+            } elseif ($stats_data['type'] == 'provider') {
+                $refill->provider_stat($stats_data['time_stamp'], $stats_data['cid'], $stats_data['order_time_type']);
             }
             $trans->commit();
             showMessage('操作成功');
@@ -1238,4 +1235,57 @@ class merchantControl extends SystemControl
             showMessage('操作失败');
         }
     }
+
+    public function merchant_interceptOp()
+    {
+        $mchid = $_GET['mchid'] ?? $_POST['mchid'];
+        $model_merchant = Model('merchant');
+        $merchant = $model_merchant->getMerchantInfo(['mchid' => $mchid], '*', true);
+        if (empty($merchant)) {
+            showMessage('机构信息有误');
+        }
+        if (chksubmit()) {
+            $merchant_intercept['is_transfer'] = $_POST['is_transfer'];
+            if (!empty($_POST['card_states'])) {
+                $merchant_intercept['card_states'] = $_POST['card_states'];
+            }
+            $merchant_intercept = serialize($merchant_intercept);
+            $resp = $model_merchant->editMerchant(['merchant_intercept' => $merchant_intercept], ['mchid' => $mchid]);
+            if ($resp) {
+                showMessage('操作成功', 'index.php?act=merchant&op=merchant');
+            } else {
+                showMessage('操作失败');
+            }
+        } else {
+            $merchant_intercept = $merchant['merchant_intercept'];
+            if (empty($merchant_intercept)) {
+                $merchant_intercept = ['card_states' => [], 'is_transfer' => 0];
+            } else {
+                $merchant_intercept = unserialize($merchant_intercept);
+            }
+            Tpl::output('merchant', $merchant);
+            Tpl::output('card_state', mtopcard\CardState);
+            Tpl::output('merchant_intercept', $merchant_intercept);
+            Tpl::showpage('merchant.intercept');
+        }
+    }
+
+    public function merchant_retry_timesOp()
+    {
+        $mchid = $_GET['mchid'] ?? $_POST['mchid'];
+        $model_merchant = Model('merchant');
+        $merchant = $model_merchant->getMerchantInfo(['mchid' => $mchid], '*', true);
+        if (empty($merchant)) {
+            showMessage('机构信息有误');
+        }
+        if (chksubmit()) {
+
+        } else {
+            $quality = [
+                'common' => \refill\Quality::Normal, 'fast' => \refill\Quality::Quick, 'card' => \refill\Quality::CardKey,
+                'third' => \refill\Quality::ThirdShop, 'slow' => \refill\Quality::SlowTwentyFour, 'slow6' => \refill\Quality::SlowSix,
+                'slow2' => \refill\Quality::SlowTwo, 'slow48' => \refill\Quality::SlowFortyEight, 'slow72' => \refill\Quality::SlowSeventyTwo
+            ];
+        }
+    }
 }

+ 11 - 1
admin/templates/default/merchant.index.php

@@ -65,6 +65,7 @@ defined('InShopNC') or exit('Access Invalid!'); ?>
                 <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>
@@ -118,8 +119,17 @@ defined('InShopNC') or exit('Access Invalid!'); ?>
                                 <a href="index.php?act=merchant&op=changeState&state=1&mchid=<?php echo $v['mchid'] ?>">启用机构</a>
                             <?php }?>
                         </td>
+                        <td class="align-center">
+                            <a href="index.php?act=merchant&op=price&quality=1&mchid=<?php echo $v['mchid'] ?>">
+                                质量设置
+                            </a>
+                            |
+                            <a href="index.php?act=merchant&op=merchant_intercept&mchid=<?php echo $v['mchid'] ?>">
+                                拦截设置
+                            </a>
+                        </td>
                         <td class="align-center w200">
-                            <a href="index.php?act=merchant&op=price&quality=1&mchid=<?php echo $v['mchid'] ?>">通道费率设置</a>
+                            <a href="index.php?act=merchant&op=merchant_retry_times&mchid=<?php echo $v['mchid'] ?>">通道费率设置</a>
                             |
                             <a href="index.php?act=provider_group&op=merchant_sel_group&mchid=<?php echo $v['mchid'] ?>">通道组设置</a>
                         </td>

+ 68 - 0
admin/templates/default/merchant.intercept.php

@@ -0,0 +1,68 @@
+<?php defined('InShopNC') or exit('Access Invalid!'); ?>
+
+<div class="page">
+    <div class="fixed-bar">
+        <div class="item-title">
+            <h3><?php echo $lang['nc_merchant'] ?></h3>
+            <ul class="tab-base">
+                <li><a href="index.php?act=merchant&op=merchant"><span><?php echo $lang['nc_manage'] ?></span></a></li>
+                <li><a href="JavaScript:void(0);" class="current"><span>拦截设置</span></a></li>
+            </ul>
+        </div>
+    </div>
+    <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="mchid" value="<?php echo $output['merchant']['mchid'];?>"/>
+        <table class="table tb-type2">
+            <tbody>
+            <tr class="noborder">
+                <td colspan="2"><label>机构名称:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td><?php echo "{$output['merchant']['mchid']} :{$output['merchant']['company_name']}";?></td>
+            </tr>
+            <tr class="noborder">
+                <td colspan="2" class="required"><label for="name">是否拦截转网:</label>
+                <input type="radio" name="is_transfer" value="1" <?php if($output['merchant_intercept']['is_transfer'] == 1){ echo 'checked'; }?>>是
+                <input type="radio" name="is_transfer" value="0" <?php if($output['merchant_intercept']['is_transfer'] == 0){ echo 'checked'; }?>>否
+            </td>
+            </tr>
+            <tr class="noborder">
+                <td colspan="2" class="required"><label for="name">拦截号码状态:</label>
+                    <?php foreach ($output['card_state'] as $key => $value){?>
+                    <input type="checkbox" name="card_states[]" value="<?php echo $key;?>"
+                        <?php if( in_array($key, $output['merchant_intercept']['card_states'])){ echo 'checked'; }?>
+                        ><?php echo $value;?>
+                    <?php }?>
+            </td>
+            </tr>
+            </tbody>
+            <tfoot>
+            <tr class="tfoot">
+                <td colspan="15"><a href="JavaScript:void(0);" class="btn"
+                                    id="submitBtn"><span><?php echo $lang['nc_submit']; ?></span></a></td>
+            </tr>
+            </tfoot>
+        </table>
+    </form>
+</div>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/dialog/dialog.js" id="dialog_js"
+        charset="utf-8"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/jquery.ui.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/ajaxfileupload/ajaxfileupload.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.js"></script>
+<link href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.min.css" rel="stylesheet" type="text/css"
+      id="cssfile2"/>
+<script type="text/javascript">
+    $(function () {
+        //按钮先执行验证再提交表单
+        $("#submitBtn").click(function () {
+            if ($("#user_form").valid()) {
+                $("#user_form").submit();
+            }
+        });
+        $('input:radio[name=sex]')[0].checked = false; //将第一个 radio 设置为不选中
+        $('input:radio[name=sex]')[1].checked = false; //将第2个 radio 设置为不选中
+    });
+</script>

+ 5 - 0
helper/mtopcard/mtopcard.php

@@ -71,6 +71,11 @@ const ProvinceList = [
     31	=> '新疆'
 ];
 
+#空号拦截状态
+const CardState = [
+    '空号','实号','停机','库无','沉默号','风险号'
+];
+
 function month_stamp($time=null) : int {
     $date = getdate($time);
     $stamp = $date['year'] * 100 + $date['mon'];