stanley-king 4 vuotta sitten
vanhempi
commit
0c72641e3f

+ 118 - 0
admin/control/merchant.php

@@ -8,6 +8,7 @@ defined('InShopNC') or exit('Access Invalid!');
 
 require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
 require_once(BASE_CONFIG_PATH . CONFIG_PREFIX . '/refill.ini.php');
+require_once(BASE_ROOT_PATH . '/core/framework/function/http.php');
 
 class merchantControl extends SystemControl
 {
@@ -24,6 +25,7 @@ class merchantControl extends SystemControl
      */
     public function merchantOp()
     {
+        $this->successful_where();
         $model_merchant = Model('merchant');
 
         if (trim($_GET['merchant_name']) != '') {
@@ -1101,6 +1103,52 @@ class merchantControl extends SystemControl
         Tpl::showpage('provider.index');
     }
 
+    public function provider_provinceOp()
+    {
+        $provider_model = Model('refill_provider');
+        $provider_id = $_GET['id'] ?? $_POST['id'];
+        $provider = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
+        if (empty($provider)) {
+            showMessage('通道信息有误');
+        }
+        $operator = [mtopcard\ChinaMobileCard, mtopcard\ChinaUnicomCard, mtopcard\ChinaTelecomCard];
+
+        if(chksubmit()) {
+            foreach ($operator as $opr) {
+                $key = $opr . '-province';
+                $province = $_POST[$key];
+                if($province == -1) {
+                    $updata[$opr] = -1;
+                }else{
+                    $updata[$opr] = implode(',',$province);
+                }
+            }
+            $resp = $provider_model->editProvider(['provinces' => serialize($updata)], ['provider_id' => $provider_id]);
+            if ($resp) {
+                showMessage('编辑成功', 'index.php?act=merchant&op=provider');
+            } else {
+                showMessage('编辑失败', "index.php?act=merchant&op=provider_province&id={$provider_id}");
+            }
+        } else {
+            $data = unserialize($provider['provinces']);
+            $provinces = [];
+            $province = $provinces;
+
+            foreach ($operator as $opr) {
+                if(empty($data)) {
+                    $provinces[$opr] = [-1];
+                } else {
+                    $provinces[$opr] = explode(',', $data[$opr]);
+                }
+            }
+            $province_list = mtopcard\ProvinceList;
+            Tpl::output('province_list', $province_list);
+            Tpl::output('provider', $provider);
+            Tpl::output('provinces', $provinces);
+            Tpl::showpage('provider.province');
+        }
+    }
+
     public function sync_cfgs()
     {
         $name_val = function ($items) {
@@ -1747,4 +1795,74 @@ class merchantControl extends SystemControl
             Tpl::showpage('provider.evidence.add');
         }
     }
+
+    public function provider_successfulOp()
+    {
+        $days = $this->successful_where();
+        Tpl::output('days', $days);
+        Tpl::showpage('provider.successful');
+    }
+
+    private function successful_where() {
+        if(defined('COMPANY_NAME') && COMPANY_NAME === 'LZKJ_COMPANY') {
+            $url = 'https://www.lzkj168.cn/plot/days';
+        }
+        else {
+            $url = 'https://www.xyzshops.cn/plot/days';
+        }
+
+        $data = http_request($url);
+        if(empty($data)) return [];
+        preg_match_all('/\d{10}/', $data, $matches);
+        $days = $matches[0];
+        if(empty($days)) return [];
+        $result = [];
+        foreach ($days as $day) {
+            $result[$day] = date("Y-m-d",$day);
+        }
+        return $result;
+    }
+
+    public function successful_time_get_whereOp(){
+        if(defined('COMPANY_NAME') && COMPANY_NAME === 'LZKJ_COMPANY') {
+            $url = 'https://www.lzkj168.cn/plot/paths?time_stamp='.$_GET['timestamp'];
+        }
+        else {
+            $url = 'https://www.xyzshops.cn/plot/paths?time_stamp='.$_GET['timestamp'];
+        }
+
+        $data = http_request($url);
+        preg_match_all('/\d{10}\/[a-z]+\/\d{1,2}\/\d\/\d{2,4}/', $data, $matches);
+        $conds = $matches[0];
+        if(empty($conds)) return [];
+        foreach ($conds as $cond) {
+            $arr = explode('/',$cond);
+            $chname[] = $arr[1];
+            $qualitys[] = $arr[2];
+            $card_types[] = $arr[3];
+            $amount[] = intval($arr[4]);
+        }
+        $chnameData = array_unique($chname);
+        sort($chnameData);
+
+        $result['chname'] = $chnameData;
+        $amountData = array_unique($amount);
+        sort($amountData);
+        $result['amount'] = $amountData;
+
+        foreach (array_unique($card_types) as $card_type) {
+            $card_typeData[$card_type] = $this->scard_type($card_type);
+        }
+        ksort($card_typeData);
+        $result['card_type'] = $card_typeData;
+
+        $quality_txt = [1=>'普充', 2=>'快充', 3=>'卡密', 4=>'三方', 5=>'慢充'];
+        foreach (array_unique($qualitys) as $quality) {
+            $qualityData[$quality] = $quality_txt[$quality];
+        }
+        ksort($qualityData);
+        $result['quality'] = $qualityData;
+        echo(json_encode($result));
+        exit;
+    }
 }

+ 2 - 1
admin/include/menu.php

@@ -100,7 +100,8 @@ $arr = array(
 					array('args'=>'OrderSendList,merchant,merchant',		'text'=>'超时订单监控'),
 					array('args'=>'OrderStats,merchant,merchant',			'text'=>'对账管理'),
 					array('args'=>'stats,card_key,merchant',				'text'=>'卡密管理'),
-					array('args'=>'index,refill_stock,merchant',				'text'=>'库存管理')
+					array('args'=>'index,refill_stock,merchant',			'text'=>'库存管理'),
+					array('args'=>'provider_successful,merchant,merchant',	'text'=>'成功率监控')
 				)
 			),
 			4 => array(

+ 7 - 1
admin/templates/default/css/recharge.css

@@ -9,17 +9,23 @@
 .w100 {width:100px;}
 .w130 {width: 130px;}
 .w160 {width:160px;}
+.w500 {width:500px;}
+
+.h30 {height:30px}
+.h200 {height:200px !important}
 
 .mw24 {min-width:24px;}
 .mw60 {min-width:60px;}
 .mw96 {min-width:96px;}
 .mw120 {min-width:120px;}
 .mw130 {min-width:130px;}
-.mw160 {min-width:160px;}
 .mw156 {min-width:156px;}
+.mw160 {min-width:160px;}
+.mw1250 {min-width:1250px;}
 
 /* 样式 */
 .inblock {display:inline-block}
+.block {display:block}
 .align-left {text-align:left;}
 .align-right {text-align:right;}
 .pad_right_0 {padding-right: 0px; }

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

@@ -101,14 +101,20 @@
                         <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>
-                            <?php }?>
-                            <?php if($v['opened'] == 2){?>
-                                <a href="index.php?act=merchant&op=changeProviderState&state=1&id=<?php echo $v['provider_id'] ?>">启用通道</a>
-                            <?php }?>
-                            | <a href="index.php?act=merchant&op=provider_edit&id=<?php echo $v['provider_id'] ?>">编辑通道</a>
-                            | <a href="index.php?act=merchant&op=provider_del&id=<?php echo $v['provider_id'] ?>">删除通道</a>
+                            <div>
+                                <a href="index.php?act=merchant&op=provider_province&id=<?php echo $v['provider_id'] ?>">省份控制</a>
+                                |
+                                <?php if($v['opened'] == 1){?>
+                                    <a href="index.php?act=merchant&op=changeProviderState&state=2&id=<?php echo $v['provider_id'] ?>">关闭通道</a>
+                                <?php }?>
+                                <?php if($v['opened'] == 2){?>
+                                    <a href="index.php?act=merchant&op=changeProviderState&state=1&id=<?php echo $v['provider_id'] ?>">启用通道</a>
+                                <?php }?>
+                            </div>
+                            <div>
+                                <a href="index.php?act=merchant&op=provider_edit&id=<?php echo $v['provider_id'] ?>">编辑通道</a>
+                                | <a href="index.php?act=merchant&op=provider_del&id=<?php echo $v['provider_id'] ?>">删除通道</a>
+                            </div>
                         </td>
                     </tr>
                 <?php } ?>

+ 255 - 0
admin/templates/default/provider.province.php

@@ -0,0 +1,255 @@
+<link href="<?php echo ADMIN_TEMPLATES_URL;?>/css/recharge.css?7" rel="stylesheet" type="text/css" id="cssfile2" />
+<?php defined('InShopNC') or exit('Access Invalid!'); ?>
+
+<div class="page">
+    <div class="fixed-bar">
+        <div class="item-title">
+            <h3>通道</h3>
+            <ul class="tab-base">
+                <li><a href="index.php?act=merchant&op=provider"><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="provider_id" value="<?php echo $output['provider']['provider_id']?>"/>
+        <table class="tb-type2 table">
+            <tbody class="mw1250 block">
+            <tr class="noborder">
+                <td colspan="2" class="required"><label class="validation" for="name">通道名称:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop"><?php echo $output['provider']['name']?></td>
+            </tr>
+            <tr class="noborder">
+                <td colspan="2"><label for="end_period">选择省份:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="w400 inblock align-center required">
+                    中国移动
+                </td>
+                <td class="w400 inblock align-center required">
+                    中国联通
+                </td>
+                <td class="w400 inblock align-center required">
+                    中国电信
+                </td>
+            </tr>
+            <tr class="noborder">
+                <td class="w400 inblock">
+                    <label>
+                        全国:
+                        <input type="checkbox" name="<?php echo mtopcard\ChinaMobileCard;?>-province" data-name="move" id="move_cb_all" value="-1"
+                            <?php if(in_array(-1,$output['provinces'][mtopcard\ChinaMobileCard])){ echo 'checked';}?>/>
+                    </label>
+                </td>
+                <td class="w400 inblock">
+                    <label>
+                        全国:
+                        <input type="checkbox" name="<?php echo mtopcard\ChinaUnicomCard;?>-province" data-name="unicom" id="unicom_cb_all" value="-1"
+                            <?php if(in_array(-1,$output['provinces'][mtopcard\ChinaUnicomCard])){ echo 'checked';}?>/>
+                    </label>
+                </td>
+                <td class="w400 inblock">
+                    <label>
+                        全国:
+                        <input type="checkbox" name="<?php echo mtopcard\ChinaTelecomCard;?>-province"  data-name="tel" id="tel_cb_all" value="-1"
+                            <?php if(in_array(-1,$output['provinces'][mtopcard\ChinaTelecomCard])){ echo 'checked';}?>/>
+                    </label>
+                </td>
+            </tr>
+            <tr class="noborder">
+                <td  class="w400 inblock h200">
+                    <div class="w100pre">
+                        <?php foreach($output['province_list'] as $key => $province){ ?>
+                        <label style="display: inline-block;width: 70px;height: 30px;line-height: 30px;">
+                            <?php echo $province;?>
+                            <input type="checkbox" class="move_cb_box" name="<?php echo mtopcard\ChinaMobileCard;?>-province[]" data-name="move" style="vertical-align: middle;" value="<?php echo $key;?>"
+                                <?php if(in_array($key,$output['provinces'][mtopcard\ChinaMobileCard])){ echo 'checked';}?>
+                            />
+                        </label>
+                        <?php }?>
+                    </div>
+                </td>
+                <td  class="w400 inblock h200">
+                    <div class="w100pre">
+                        <?php foreach($output['province_list'] as $key => $province){ ?>
+                        <label style="display: inline-block;width: 70px;height: 30px;line-height: 30px;">
+                            <?php echo $province;?>
+                            <input type="checkbox" class="unicom_cb_box" data-name="unicom" name="<?php echo mtopcard\ChinaUnicomCard;?>-province[]" style="vertical-align: middle;" value="<?php echo $key;?>"
+                                <?php if(in_array($key,$output['provinces'][mtopcard\ChinaUnicomCard])){ echo 'checked';}?>
+                            />
+                        </label>
+                        <?php }?>
+                    </div>
+                </td>
+                <td  class="w400 inblock h200">
+                    <div class="w100pre">
+                        <?php foreach($output['province_list'] as $key => $province){ ?>
+                        <label style="display: inline-block;width: 70px;height: 30px;line-height: 30px;">
+                            <?php echo $province;?>
+                            <input type="checkbox" class="tel_cb_box" data-name="tel" name="<?php echo mtopcard\ChinaTelecomCard;?>-province[]" style="vertical-align: middle;" value="<?php echo $key;?>"
+                                <?php if(in_array($key,$output['provinces'][mtopcard\ChinaTelecomCard])){ echo 'checked';}?>
+                            />
+                        </label>
+                        <?php }?>
+                    </div>
+                </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>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/refill/layer.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 () {
+        // 移动
+        if($('#move_cb_all').is(":checked")) {
+            $('.move_cb_box').each(function () {
+                this.checked = true;
+                $(this).attr("disabled",true);
+            })
+        }
+        // 全选
+        $('#move_cb_all').click(function() {
+            if($(this).is(":checked")) {
+                $('.move_cb_box').each(function () {
+                    this.checked = true;
+                    $(this).attr("disabled",true);
+                })
+            } else {
+                $('.move_cb_box').each(function () {
+                    this.checked = false;
+                    $(this).attr("disabled",false);
+                })
+            }
+        })
+        $('.move_cb_box').each(function () {
+            $(this).click(function () {
+                // console.log(1, $(".cb_box:checked").length, $(".cb_box").length);
+                if ($(".move_cb_box:checked").length == $(".move_cb_box").length) {
+                    $("#move_cb_all").attr("checked", "checked");
+                    $('#move_cb_all').attr("disabled",true);
+                }else {
+                    $("#move_cb_all").removeAttr("checked");
+                    $('#move_cb_all').attr("disabled",false);
+                };
+            })
+        })
+
+        // 联通
+        if($('#unicom_cb_all').is(":checked")) {
+            $('.unicom_cb_box').each(function () {
+                this.checked = true;
+                $(this).attr("disabled",true);
+            })
+        }
+        // 全选
+        $('#unicom_cb_all').click(function() {
+            if($(this).is(":checked")) {
+                $('.unicom_cb_box').each(function () {
+                    this.checked = true;
+                    $(this).attr("disabled",true);
+                })
+            } else {
+                $('.unicom_cb_box').each(function () {
+                    this.checked = false;
+                    $(this).attr("disabled",false);
+                })
+            }
+        })
+        $('.unicom_cb_box').each(function () {
+            $(this).click(function () {
+                // console.log(1, $(".cb_box:checked").length, $(".cb_box").length);
+                if ($(".unicom_cb_box:checked").length == $(".unicom_cb_box").length) {
+                    $("#unicom_cb_all").attr("checked", "checked");
+                    $('#unicom_cb_all').attr("disabled",true);
+                }else {
+                    $("#unicom_cb_all").removeAttr("checked");
+                    $('#unicom_cb_all').attr("disabled",false);
+                };
+            })
+        })
+
+        // 电信
+        if($('#tel_cb_all').is(":checked")) {
+            $('.tel_cb_box').each(function () {
+                this.checked = true;
+                $(this).attr("disabled",true);
+            })
+        }
+        // 全选
+        $('#tel_cb_all').click(function() {
+            if($(this).is(":checked")) {
+                $('.tel_cb_box').each(function () {
+                    this.checked = true;
+                    $(this).attr("disabled",true);
+                })
+            } else {
+                $('.tel_cb_box').each(function () {
+                    this.checked = false;
+                    $(this).attr("disabled",false);
+                })
+            }
+        })
+        $('.tel_cb_box').each(function () {
+            $(this).click(function () {
+                // console.log(1, $(".cb_box:checked").length, $(".cb_box").length);
+                if ($(".tel_cb_box:checked").length == $(".tel_cb_box").length) {
+                    $("#tel_cb_all").attr("checked", "checked");
+                    $('#tel_cb_all').attr("disabled",true);
+                }else {
+                    $("#tel_cb_all").removeAttr("checked");
+                    $('#tel_cb_all').attr("disabled",false);
+                };
+            })
+        })
+
+        $("#submitBtn").click(function () {
+            var checkMove = false;
+            var checkUnicom = false;
+            var checkTel = false; 
+            var checkBoxMove = $('input[data-name="move"]');
+            var checkBoxUnicom = $('input[data-name="unicom"]');
+            var checkBoxTel = $('input[data-name="tel"]');
+            for (var i = 0; i < checkBoxMove.length; i++) {
+                //如果有1个被选中时
+                if (checkBoxMove[i].checked) {
+                    checkMove = true
+                };
+            };
+            for (var i = 0; i < checkBoxUnicom.length; i++) {
+                //如果有1个被选中时
+                if (checkBoxUnicom[i].checked) {
+                    checkUnicom = true
+                };
+            };
+            for (var i = 0; i < checkBoxTel.length; i++) {
+                //如果有1个被选中时
+                if (checkBoxTel[i].checked) {
+                    checkTel = true
+                };
+            };
+            if (checkMove && checkUnicom && checkTel) {
+                $("#user_form").submit();
+            } else{
+                layer.msg('每个类型至少选择一个')
+            }
+        });
+    });
+</script>

+ 177 - 0
admin/templates/default/provider.successful.php

@@ -0,0 +1,177 @@
+<div class="page">
+    <div class="fixed-bar">
+        <div class="item-title">
+            <h3>成功率监控列表</h3>
+            <ul class="tab-base">
+                <li><a href="JavaScript:void(0);" class="current" ><span>通道成功率监控</span></a></li>
+            </ul>
+        </div>
+    </div>
+    <div class="fixed-empty"></div>
+    <div style="margin-top: 10px;color: #e60d0d;">
+        请先选择时间
+    </div>
+    <form method="get" action="index.php" name="formSearch" id="formSearch">
+        <input type="hidden" name="act" value="merchant"/>
+        <input type="hidden" name="op" value="OrderSendList"/>
+        <table class="tb-type1 noborder search">
+            <tr>
+                <th><label>起始日期</label></th>
+                <td>
+                    <select name="time_stamp" id="timeSelect">
+                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <?php foreach ($output['days'] as $day => $txt) {?>
+                            <option value="<?php echo $day; ?>"><?php echo $txt; ?></option>
+                        <?php }?>
+                    </select>
+                </td>
+                <th><label>起始时间</label></th>
+                <td>
+                    <select name="time_hour">
+                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <?php for ($i = 1; $i <= 24; $i++) {?>
+                            <option value="<?php echo $i; ?>"><?php echo sprintf("%02d",$i); ?>点</option>
+                        <?php }?>
+                    </select>
+                </td>
+                <th><label>间隔</label></th>
+                <td>
+                    <select name="interval">
+                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <option value="900">15分钟</option>
+                        <option value="1200">20分钟</option>
+                        <option value="1800">半小时</option>
+                        <option value="3600">一小时</option>
+                    </select>
+                </td>
+                <th><label>通道</label></th>
+                <td>
+                    <select name="chname">
+                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                    </select>
+                </td>
+                <th><label>质量</label></th>
+                <td>
+                    <select name="quality">
+                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                    </select>
+                </td>
+                <th><label>卡类型</label></th>
+                <td>
+                    <select name="card_type">
+                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                    </select>
+                </td>
+                <th><label>面额</label></th>
+                <td>
+                    <select name="amount">
+                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                    </select>
+                </td>
+                <td>
+                    <a href="javascript:void(0);" id="ncsubmit" class="btn-search "
+                       title="<?php echo $lang['nc_query']; ?>">&nbsp;
+                    </a>
+                </td>
+            </tr>
+        </table>
+    </form>
+    <div style="height:800px">
+        <iframe
+            src=""
+            scrolling="No"  noresize="noresize" frameborder="0"
+            width="100%" height="100%"></iframe>
+    </div>
+</div>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/laydate/laydate.js"></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/jquery-ui/i18n/zh-CN.js"
+        charset="utf-8"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/refill/layer.js"></script>
+<link rel="stylesheet" type="text/css"
+      href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css"/>
+<script type="text/javascript">
+    $(function () {
+        $('#timeSelect').change(function () {
+            let val = $(this).val()
+            // console.log('val', val);
+            $.get("index.php?act=merchant&op=successful_time_get_where&timestamp="+val, function (data){
+                if (!data) {
+                    return
+                }
+                data = JSON.parse(data)
+                $("select[name=chname]").find('.chnameOption').remove();
+                $("select[name=quality]").find('.qualityOption').remove();
+                $("select[name=card_type]").find('.ctOption').remove();
+                $("select[name=amount]").find('.amountOption').remove();
+                // 通道
+                for (const key in data.chname) {
+                    $("select[name=chname]").append("<option class='chnameOption' value='"+data.chname[key]+"'>"+data.chname[key]+"</option>")
+                }
+                // 质量
+                for (const key in data.quality) {
+                    // console.log('质量', key, data.quality[key]);
+                    $("select[name=quality]").append("<option class='qualityOption' value='"+key+"'>"+data.quality[key]+"</option>")
+                }
+                // 卡类型
+                for (const key in data.card_type) {
+                    // console.log('类型', key, data.card_type[key]);
+                    $("select[name=card_type]").append("<option class='ctOption' value='"+key+"'>"+data.card_type[key]+"</option>")
+                }
+                // 面额
+                for (const key in data.amount) {
+                    // console.log('面额', data.amount[key]);
+                    $("select[name=amount]").append("<option class='amountOption' value='"+data.amount[key]+"'>"+data.amount[key]+"</option>")
+                }
+                // console.log('data1', data);
+            });
+        })
+        $('#ncsubmit').click(function () {
+            let time_stamp = $("select[name=time_stamp]").val()
+            let time_hour = $("select[name=time_hour]").val()
+            let time = Number(time_stamp) + Number(time_hour)*3600
+            // console.log('time',time_stamp,time_hour, time);
+            let interval = $("select[name=interval]").val()
+            let chname = $("select[name=chname]").val()
+            let quality = $("select[name=quality]").val()
+            let card_type = $("select[name=card_type]").val()
+            let amount = $("select[name=amount]").val()
+            if (!time_stamp) {
+                layer.msg('请选择时间');
+                return
+            }
+            <?php
+            if (defined('COMPANY_NAME') && COMPANY_NAME === 'LZKJ_COMPANY'){?>
+                let base_src = 'https://www.lzkj168.cn';
+            <?php }else{?>
+                let base_src = 'https://www.xyzshops.cn';
+            <?php }?>
+            // console.log('val', time_stamp, interval,chname,quality,card_type,amount);
+            let src = base_src+"/plot/index?time_stamp="+time+"&interval="+interval+"&chname="+chname+"&quality="+quality+"&card_type="+card_type+"&amount="+amount
+            if (!interval) {
+                src = src.replace("&interval=", "")
+            }
+            if (!chname) {
+                src = src.replace("&chname=", "")
+            }
+            if (!quality) {
+                src = src.replace("&quality=", "")
+            }
+            if (!card_type) {
+                src = src.replace("&card_type=", "")
+            }
+            if (!amount) {
+                src = src.replace("&amount=", "")
+            }
+            // console.log(1, $('iframe').attr('src'));
+            // console.log('src',src);
+            $.get(src, function (data){
+                if (!data) {
+                    return
+                }
+                $('iframe').attr('src',src)
+                // console.log('data', data);
+            });
+        });
+    })
+</script> 

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

@@ -75,28 +75,30 @@
                 </td>
             </tr>
         </table>
+        <table class="tb-type1 noborder search">
+            <tr>
+                <td>
+                    <a href="index.php?act=merchant&op=OrderQuery" class="btns" >
+                        <span><i class="icon-edit"></i>更新待收货订单状态</span>
+                    </a>
+                    <a href="#" class="btns" onclick="hCopyChannel(event)">
+                        <span><i class="icon-edit"></i>拷贝渠道单号</span>
+                    </a>
+                    <a href="#" class="btns" onclick="hCopyCardNo(event)">
+                        <span><i class="icon-edit"></i>拷贝充值卡号</span>
+                    </a>
+                    <a href="index.php?act=merchant&op=OrderSendList&time=1&card_type=<?php echo $_GET['card_type']?>" class="btns" >
+                        <span><i class="icon-edit"></i>耗时半小时订单</span>
+                    </a>
+                    <a href="index.php?act=merchant&op=OrderSendList&time=2&card_type=<?php echo $_GET['card_type']?>" class="btns" >
+                        <span><i class="icon-edit"></i>耗时一小时订单</span>
+                    </a>
+                </td>
+            </tr>
+        </table>
     </form>
     <table class="table tb-type2" id="prompt">
         <tbody>
-        <tr>
-            <td>
-                <a href="index.php?act=merchant&op=OrderQuery" class="btns" >
-                    <span><i class="icon-edit"></i>更新待收货订单状态</span>
-                </a>
-                <a href="#" class="btns" onclick="hCopyChannel(event)">
-                    <span><i class="icon-edit"></i>拷贝渠道单号</span>
-                </a>
-                <a href="#" class="btns" onclick="hCopyCardNo(event)">
-                    <span><i class="icon-edit"></i>拷贝充值卡号</span>
-                </a>
-                <a href="index.php?act=merchant&op=OrderSendList&time=1&card_type=<?php echo $_GET['card_type']?>" class="btns" >
-                    <span><i class="icon-edit"></i>耗时半小时订单</span>
-                </a>
-                <a href="index.php?act=merchant&op=OrderSendList&time=2&card_type=<?php echo $_GET['card_type']?>" class="btns" >
-                    <span><i class="icon-edit"></i>耗时一小时订单</span>
-                </a>
-            </td>
-        </tr>
         <tr class="space odd" id="autoClick">
             <th colspan="12"><div class="title"><h5>
                         金额统计</h5><span class="arrow"></span></div></th>

+ 59 - 1
helper/mtopcard/mtopcard.php

@@ -34,6 +34,41 @@ const FreezedCard  = 3;
 const OilCardPaper   = 1;
 const PhoneCardPaper = 2;
 
+#省份列表
+const ProvinceList = [
+    1	=> '北京',
+    2	=> '天津',
+    3	=> '河北',
+    4	=> '山西',
+    5	=> '内蒙古',
+    6	=> '辽宁',
+    7	=> '吉林',
+    8	=> '黑龙江',
+    9	=> '上海',
+    10	=> '江苏',
+    11	=> '浙江',
+    12	=> '安徽',
+    13	=> '福建',
+    14	=> '江西',
+    15	=> '山东',
+    16	=> '河南',
+    17	=> '湖北',
+    18	=> '湖南',
+    19	=> '广东',
+    20	=> '广西',
+    21	=> '海南',
+    22	=> '重庆',
+    23	=> '四川',
+    24	=> '贵州',
+    25	=> '云南',
+    26	=> '西藏',
+    27	=> '陕西',
+    28	=> '甘肃',
+    29	=> '青海',
+    30	=> '宁夏',
+    31	=> '新疆'
+];
+
 function month_stamp($time=null) : int {
     $date = getdate($time);
     $stamp = $date['year'] * 100 + $date['mon'];
@@ -159,7 +194,8 @@ function card_type($cardno,&$regin_no)
     }
     elseif(preg_match('/^1\d{10}$/',$cardno,$matches))
     {
-        $checker = function ($phone)
+        $region_no = -1;
+        $checker = function ($phone) use(&$region_no)
         {
             if (empty($phone)) return false;  //手机号不能为空
             $url = "https://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel={$phone}";
@@ -172,6 +208,9 @@ function card_type($cardno,&$regin_no)
                 $body = trim($datas[1]);
                 if(preg_match_all("/(\w+):'([^']+)/", $body, $m)) {
                     $res = array_combine($m[1], $m[2]);
+
+                    $province = formatProvince($res['province']);
+                    $region_no = array_search($province,ProvinceList);
                     return $res;
                 }
             }
@@ -250,4 +289,23 @@ function valid_phone($phone) : bool
         Log::record("valid_phone phone:{$phone} return msg:{$resp['msg']}", Log::DEBUG);
         return true;
     }
+}
+
+function formatProvince(string $province) : string
+{
+    if(empty($province)) {
+        return '';
+    }
+
+    $checkArr = ["省","市","自治区","特别行政区"];
+
+    for($i = 0; $i < count($checkArr); $i++) {
+        if(strpos($province, $checkArr[$i]) === false) {
+            continue;
+        } else {
+            $province = mb_strcut($province, 0, strrpos($province, $checkArr[$i]));
+        }
+    }
+
+    return $province;
 }

+ 7 - 3
helper/refill/IRefill.php

@@ -22,6 +22,7 @@ abstract class IRefill
         $this->mName = $cfgs['name'];
         $this->mStoreID = $cfgs['store_id'];
         $this->mRefillType = $cfgs['refill_type'];
+        $this->mSupportRegins = [];
 
         $card_types = function ($stypes)
         {
@@ -68,13 +69,16 @@ abstract class IRefill
         return !empty($this->mSupportRegins);
     }
 
-    public function match_regin($regin_no): bool
+    public function match_regin($card_type,$regin_no): bool
     {
-        if(empty($this->mSupportRegins)){
+        if(empty($this->mSupportRegins) || empty($this->mSupportRegins[$card_type])) {
+            return true;
+        }
+        elseif(in_array(-1,$this->mSupportRegins[$card_type])) {
             return true;
         }
         else {
-            return in_array($regin_no,$this->mSupportRegins);
+            return in_array($regin_no,$this->mSupportRegins[$card_type]);
         }
     }
     //

+ 26 - 6
helper/refill/ProviderManager.php

@@ -137,8 +137,10 @@ class ProviderManager
             foreach ($channels as $item)
             {
                 $name = $item['name'];
+                $regins = $item['regins'];
                 if(array_key_exists($name,$this->mProviders)) {
                     $this->mProviders[$name]->setOpened($item['opened']);
+                    $this->mProviders[$name]->setRegins($regins);
                 }
             }
         }
@@ -154,19 +156,37 @@ class ProviderManager
         $items = $refill_provider->getProviderList(['provider_id' => ['gt' , 0]]);
 
         $result = [];
-        foreach ($items as $item) {
+        foreach ($items as $item)
+        {
             $name = $item['name'];
+
+            $regins = [];
+            $tmp = unserialize($item['provinces']);
+            if(!empty($tmp))
+            {
+                foreach ($tmp as $card_type => $sregions)
+                {
+                    $regins = explode(',',$sregions);
+                    if(!empty($regins)) {
+                        $regins[$card_type] = $regins;
+                    }
+                }
+            }
+
+
             $val = ['name' => $name,
-                    'type' => intval($item['type']),
-                    'opened' => intval($item['opened']) == 1,
-                    'sort' => intval($item['sort'])];
+                'type' => intval($item['type']),
+                'opened' => intval($item['opened']) == 1,
+                'sort' => intval($item['sort']),
+                'regins' => $regins
+            ];
             $result[$name] = $val;
         }
 
         return $result;
     }
 
-    public function find_providers(int $spec, int $card_type,int $quality): array
+    public function find_providers(int $spec, int $card_type,int $quality,$regin_no): array
     {
         $qnames = $this->mSpecTypes[$quality] ?? [];
 
@@ -181,7 +201,7 @@ class ProviderManager
             {
                 Log::record("name = {$name}",Log::DEBUG);
                 $provider = $this->mProviders[$name];
-                if($provider->opened()) {
+                if($provider->opened() && $provider->match_regin($card_type,$regin_no)) {
                     $providers[] = $provider;
                 }
             }

+ 9 - 6
helper/refill/RefillBase.php

@@ -167,6 +167,7 @@ class RefillBase
             'amount' => $refill_info['refill_amount'],
             'card_no' => $refill_info['card_no'],
             'card_type' => $refill_info['card_type'],
+            'regin_no' => $refill_info['regin_no'],
             'org_quality' => $org_quality,
             'mch_order' =>  $refill_info['mch_order'],
             'notify_url' => $refill_info['notify_url'],
@@ -184,7 +185,7 @@ class RefillBase
                         $mch_order, $idcard, $card_name, $notify_url,$quality,$org_quality,
                         $order_time = 0, $commit_times = 0,$errmsg='')
     {
-        $card_type = mtopcard\card_type($card_no);
+        $card_type = mtopcard\card_type($card_no,$regin_no);
         $minfo = new member_info($buyer_id);
 
         $calc = new ZeroMerchantPrice($mchid, $amount, $card_type,$quality);
@@ -238,12 +239,12 @@ class RefillBase
     //     其它情况,则需要判断订单ID
     public function add($mchid, $buyer_id, $amount, $card_no,
                         $mch_order, $idcard, $card_name, $notify_url, $quality, $org_quality,
-                        $order_time, $commit_times, $last_orderid = 0, $card_type = 0)
+                        $order_time, $commit_times, $last_orderid = 0, $card_type = 0,$regin_no = 0)
     {
         if($card_type == 0) {
-            $card_type = mtopcard\card_type($card_no);
+            $card_type = mtopcard\card_type($card_no,$regin_no);
         }
-        [$providers,$overload] = $this->mPolicy->find_providers($amount,$card_type,$quality);
+        [$providers, $overload] = $this->mPolicy->find_providers($amount, $card_type, $quality, $regin_no);
 
         if (empty($providers))
         {
@@ -322,7 +323,8 @@ class RefillBase
                     'notify_url' => $notify_url, 'channel_name' => $channel_name,
                     'mch_amount' => $mch_amount, 'channel_amount' => $price,
                     'order_time' => $order_time, 'commit_times' => $commit_times,
-                    'card_type' => $card_type, 'card_no' => $card_no,'quality' => $quality,'org_quality'=> $org_quality];
+                    'card_type' => $card_type, 'regin_no' => $regin_no,
+                    'card_no' => $card_no, 'quality' => $quality, 'org_quality' => $org_quality];
                 $mod_refill->add_refill($orderext);
 
                 if(!$this->pay_completed($order_sn)) {
@@ -440,7 +442,8 @@ class RefillBase
             $refill_order->edit($order_id, ['mch_notify_state' => 1, 'mch_notify_times' => ['exp', 'mch_notify_times+1']]);
             return [true, ""];
         }
-        else {
+        else
+        {
             $refill_order->edit($order_id, ['mch_notify_times' => ['exp', 'mch_notify_times+1']]);
             $times = $refill_info['mch_notify_times'] + 1;
 

+ 1 - 1
helper/refill/api/lingzh/amingjd/RefillPhone.php

@@ -105,7 +105,7 @@ class RefillPhone extends refill\IRefillPhone
 
     private function phone_type($phone)
     {
-        $card_type = mtopcard\card_type($phone);
+        $card_type = mtopcard\card_type($phone,$regin_no);
 
         if ($card_type == mtopcard\ChinaMobileCard) {
             return 0;

+ 1 - 1
helper/refill/api/lingzh/wailing/RefillPhone.php

@@ -108,7 +108,7 @@ class RefillPhone extends refill\IRefillPhone
 
     private function phone_type($phone)
     {
-        $card_type = mtopcard\card_type($phone);
+        $card_type = mtopcard\card_type($phone,$regin_no);
 
         if ($card_type == mtopcard\ChinaMobileCard) {
             return 0;

+ 1 - 1
helper/refill/api/lingzh/wuchen/RefillPhone.php

@@ -138,7 +138,7 @@ class RefillPhone extends refill\IRefillPhone
 
     private function phone_type($phone)
     {
-        $card_type = mtopcard\card_type($phone);
+        $card_type = mtopcard\card_type($phone,$regin_no);
 
         if ($card_type == mtopcard\ChinaMobileCard) {
             return 1;

+ 1 - 1
helper/refill/api/test/baidu/RefillPhone.php

@@ -73,7 +73,7 @@ class RefillPhone extends refill\IRefillPhone
 
     private function phone_type($phone)
     {
-        $card_type = mtopcard\card_type($phone);
+        $card_type = mtopcard\card_type($phone,$regin_no);
 
         if ($card_type == mtopcard\ChinaMobileCard) {
             return 2;

+ 1 - 1
helper/refill/api/xyz/afand/RefillPhone.php

@@ -109,7 +109,7 @@ class RefillPhone extends refill\IRefillPhone
 
     private function phone_type($phone)
     {
-        $card_type = mtopcard\card_type($phone);
+        $card_type = mtopcard\card_type($phone,$regin_no);
 
         if ($card_type == mtopcard\ChinaMobileCard) {
             return 2;

+ 1 - 1
helper/refill/api/xyz/jiec/RefillPhone.php

@@ -100,7 +100,7 @@ class RefillPhone extends refill\IRefillPhone
 
     private function phone_type($phone)
     {
-        $card_type = mtopcard\card_type($phone);
+        $card_type = mtopcard\card_type($phone,$regin_no);
 
         if ($card_type == mtopcard\ChinaMobileCard) {
             return 2;

+ 1 - 1
helper/refill/api/xyz/wantong/RefillPhone.php

@@ -109,7 +109,7 @@ class RefillPhone extends refill\IRefillPhone
 
     private function phone_type($phone)
     {
-        $card_type = mtopcard\card_type($phone);
+        $card_type = mtopcard\card_type($phone,$regin_no);
 
         if ($card_type == mtopcard\ChinaMobileCard) {
             return 0;

+ 1 - 1
helper/refill/api/xyz/weit/RefillPhone.php

@@ -107,7 +107,7 @@ class RefillPhone extends refill\IRefillPhone
 
     private function phone_type($phone)
     {
-        $card_type = mtopcard\card_type($phone);
+        $card_type = mtopcard\card_type($phone,$regin_no);
 
         if ($card_type == mtopcard\ChinaMobileCard) {
             return 2;

+ 4 - 2
helper/refill/policy/chctl.php

@@ -72,14 +72,16 @@ class chctl
 
         //去掉已经关闭通道
         $usable_items = [];
-        foreach ($ctl_items as $item) {
+        foreach ($ctl_items as $item)
+        {
             if($item->opened()) {
                 $usable_items[] = $item;
             }
         }
 
         //不过载的排在前面
-        $ascending = function ($l, $r) {
+        $ascending = function ($l, $r)
+        {
             $lproity = $l->priority();
             $rproity = $r->priority();
 

+ 1 - 1
helper/refill/policy/lingzh/policy.php

@@ -33,7 +33,7 @@ class policy extends ProviderManager implements IPolicy
 
     public function find_providers(int $spec, int $card_type,int $quality,$regin_no): array
     {
-        $providers = parent::find_providers($spec,$card_type,$quality);
+        $providers = parent::find_providers($spec,$card_type,$quality,$regin_no);
 
         if(empty($providers)) {
             return [$providers,false];

+ 1 - 1
helper/refill/policy/xyz/policy.php

@@ -100,7 +100,7 @@ class policy extends ProviderManager implements IPolicy
                 continue;
             }
 
-            [$providers,$overload] = $this->find_providers($spec,$card_type,$quality);
+            [$providers,$overload] = $this->find_providers($spec,$card_type,$quality,-1);
             if (!empty($providers))
             {
                 if (!$overload) {

+ 1 - 1
helper/refill/util.php

@@ -88,7 +88,7 @@ class util
             $ret = $mod_topcard->get_card($card_no);
             if (empty($ret)) {
                 if ($card_type === 0) {
-                    $card_type = mtopcard\card_type($card_no);
+                    $card_type = mtopcard\card_type($card_no,$regin_no);
                 }
                 $bind_phone = util::make_mobile();
                 $mod_topcard->add($card_no, $card_type, time(), $bind_phone);

+ 1 - 1
mobile/control/merchant_refill.php

@@ -49,7 +49,7 @@ class merchant_refillControl extends mbMerchantControl
         }
 
         $card_no = $params['cardno'];
-        $card_type = mtopcard\card_type($card_no);
+        $card_type = mtopcard\card_type($card_no,$regin_no);
 
         if($card_type == mtopcard\UnknownCard) {
             return [false,'卡类型无法识别'];

+ 1 - 1
racc/control/refill.php

@@ -75,7 +75,7 @@ class refillControl extends merchantControl
             return self::outerr(206,"平台不支持该卡充值.");
         }
 
-//        $card_type = mtopcard\card_type($card_no);
+//        $card_type = mtopcard\card_type($card_no,$regin_no);
 //        if($card_type === mtopcard\SinopecCard || $card_type === mtopcard\PetroChinaCard)
 //        {
 //            $allow = refill\RefillFactory::instance()->allow($this->mchid(),$card_type,$amount);

+ 4 - 2
rdispatcher/proxy.php

@@ -31,14 +31,16 @@ class proxy
 
         $org_quality = intval($params['org_quality']) ?? 0;
         $card_type   = intval($params['card_type']) ?? 0;
+        $regin_no   = intval($params['regin_no']) ?? 0;
 
         Log::record("proxy::add mch_order={$mch_order} card_no = {$card_no}",Log::DEBUG);
 
         $need_check = false;
         if($card_type == 0)
         {
-            $card_type = mtopcard\card_type($card_no);
+            $card_type = mtopcard\card_type($card_no,$regin_no);
             $params['card_type'] = $card_type;
+            $params['regin_no'] = $regin_no;
 
             global $config;
             if($config['phone_life_check'] == true && $card_type != mtopcard\PetroChinaCard && $card_type != mtopcard\SinopecCard) {
@@ -61,7 +63,7 @@ class proxy
 
         [$errcode, $errmsg, $order_id, $neterr] = refill\RefillFactory::instance()->add($mchid, $buyer_id, $amount, $card_no,
             $mch_order, $idcard, $card_name, $notify_url, $quality,$org_quality,
-            $order_time, $commit_times, $last_order_id,$card_type);
+            $order_time, $commit_times, $last_order_id,$card_type,$regin_no);
         $params['commit_times'] += 1;
         $commit_times += 1;