Browse Source

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

stanley-king 3 năm trước cách đây
mục cha
commit
828624120e

+ 1 - 102
admin/control/merchant.php

@@ -211,7 +211,7 @@ class merchantControl extends SystemControl
 
     public function priceOp()
     {
-        $quality = $_GET['quality'] ? $_GET['quality'] : 1;
+        $quality = $_GET['quality'] ?? 1;
         if (chksubmit()) {
             $mchid = $_POST['mchid'];
 
@@ -1183,105 +1183,4 @@ class merchantControl extends SystemControl
         }
     }
 
-    public function provider_evidenceOp()
-    {
-        $mod = Model('provider_evidence');
-        $condition = [];
-        if (trim($_GET['store_name']) != '') {
-            $condition['store_name'] = ['like', '%' . $_GET['store_name'] . '%'];
-        }
-        $start_unixtime = intval(strtotime($_GET['query_start_time']));
-        $end_unixtime = intval(strtotime($_GET['query_end_time']));
-        if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
-            $condition['apply_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
-        } elseif ($start_unixtime > 0) {
-            $condition['apply_time'] = ['egt', $start_unixtime];
-        } elseif ($end_unixtime > 0) {
-            $condition['apply_time'] = ['lt', $end_unixtime];
-        }
-
-        //上游充值申请列表
-        $evidence_list = $mod->getProviderEvidence($condition, 30);
-        $stats = $mod->field('sum(amount) as amounts')->where($condition)->find();
-        Tpl::output('amounts', $stats['amounts']);
-        Tpl::output('evidence_list', $evidence_list);
-        Tpl::output('page', $mod->showpage());
-        Tpl::showpage('merchant.provider.evidence_list');
-    }
-
-    public function provider_evidence_addOp()
-    {
-        $provider_model = Model('refill_provider');
-        if (chksubmit()) {
-            $obj_validate = new Validator();
-            $obj_validate->validateparam = [
-                ["input" => $_POST["provider_id"], "require" => "true", "message" => '上游通道不能为空'],
-                ["input" => $_POST["bank_username"], "require" => "true", "message" => '开户人姓名不能为空'],
-                ["input" => $_POST["bank_name"], "require" => "true", "message" => '开户银行不能为空'],
-                ["input" => $_POST["to_bank_username"], "require" => "true", "message" => '上游开户人姓名不能为空'],
-                ["input" => $_POST["to_bank_name"], "require" => "true", "message" => '上游开户银行不能为空'],
-                ["input" => $_POST["amount"], "require" => "true", "message" => '预存金额不能为空'],
-                ["input" => $_POST["apply_time"], "require" => "true", "message" => '申请日期不能为空']
-            ];
-            $error = $obj_validate->validate();
-            if ($error != '') {
-                showMessage($error);
-            }
-            $provider_id = $_POST["provider_id"];
-            $provider_info = $provider_model->table('refill_provider,store')
-                ->where((['provider_id' => $provider_id]))
-                ->field('refill_provider.*,store.store_name')
-                ->join('inner')
-                ->on('store.store_id=refill_provider.store_id')
-                ->find();
-            if (!$provider_info) {
-                showMessage('对应店铺不存在');
-            }
-            $amount = $_POST['amount'];
-            $money = abs($amount);
-            if ($money == 0) {
-                showMessage('申请金额错误');
-            }
-            if(!empty($_FILES['voucher']['name'])) {
-                $upload = new UploadFile();
-                $upload->set('default_dir',ATTACH_UPFILE.'/provider');
-
-                $result = $upload->upfile('voucher');
-                if ($result){
-                    $_POST['voucher'] = $upload->file_name;
-                    $input['voucher_name'] = $_POST['voucher'];
-                }else {
-                    showMessage($upload->error);
-                }
-            }
-
-            $input['store_name'] = $provider_info['store_name'];
-            $input['store_id'] = $provider_info['store_id'];
-            $input['amount'] = $amount;
-            $input['bank_username'] = $_POST['bank_username'];
-            $input['bank_name'] = $_POST['bank_name'];
-            $input['to_bank_username'] = $_POST['to_bank_username'];
-            $input['to_bank_name'] = $_POST['to_bank_name'];
-            $input['add_time'] = time();
-            $input['bz'] = $_POST['bz'];
-            $input['apply_time'] = strtotime($_POST['apply_time']);
-            $mod = Model('provider_evidence');
-            $res = $mod->addProviderEvidence($input);
-
-            if ($res) {
-                showMessage('操作成功',"index.php?act=merchant&op=provider_evidence");
-            } else {
-                showMessage('操作失败');
-            }
-        } else {
-            $provider_list = Model('')->table('refill_provider,store')
-                ->field('refill_provider.*,store.store_name')
-                ->join('inner')
-                ->on('store.store_id=refill_provider.store_id')
-                ->limit(1000)
-                ->select();
-            Tpl::output('provider_list', $provider_list);
-            Tpl::showpage('provider.evidence.add');
-        }
-    }
 }

+ 231 - 2
admin/control/provider_info.php

@@ -1,6 +1,6 @@
 <?php
 
-
+require_once(BASE_HELPER_PATH . '/PHPExcel/PHPExcel.php');
 class provider_infoControl extends SystemControl
 {
     public function __construct()
@@ -122,7 +122,6 @@ class provider_infoControl extends SystemControl
 
     public function apply_editOp()
     {
-
         $apply_id = $_GET['apply_id'] ?? $_POST['apply_id'];
         $mod = Model('provider_evidence');
         $provider_evidence_info = $mod->getProviderEvidenceInfo(['apply_id' => $apply_id]);
@@ -170,4 +169,234 @@ class provider_infoControl extends SystemControl
             Tpl::showpage('provider.evidence.edit');
         }
     }
+
+    public function apply_delOp()
+    {
+        $apply_id = $_GET['apply_id'] ?? $_POST['apply_id'];
+        $mod = Model('provider_evidence');
+        $provider_evidence_info = $mod->getProviderEvidenceInfo(['apply_id' => $apply_id]);
+        if (empty($provider_evidence_info)) {
+            showMessage('申请信息不存在');
+        }
+        $result = $mod->DelProviderEvidence(['apply_id' => $apply_id]);
+        if (!$result) {
+            showMessage('删除失败');
+        }
+        showMessage('删除成功','index.php?act=provider_info&op=provider_evidence');
+    }
+
+    public function get_provider_infoOp()
+    {
+        $provider_id = $_GET['provider_id'];
+        $mod = Model('provider_info');
+        $provider_info = $mod->getProviderInfoList(['provider_id' => $provider_id]);
+        $to_bank_username = [];
+        $to_bank_name = [];
+        if(!empty($provider_info)) {
+            foreach ($provider_info as $info) {
+                $to_bank_username[] = $info['bank_username'];
+                $to_bank_name[] = $info['bank_name'];
+            }
+        }
+        echo json_encode(['to_bank_username' =>$to_bank_username, 'to_bank_name' => $to_bank_name]);
+        exit;
+    }
+
+    public function provider_evidenceOp()
+    {
+        $mod = Model('provider_evidence');
+        $condition = [];
+        if (trim($_GET['store_name']) != '') {
+            $condition['store_name'] = ['like', '%' . $_GET['store_name'] . '%'];
+        }
+        $start_unixtime = intval(strtotime($_GET['query_start_time']));
+        $end_unixtime = intval(strtotime($_GET['query_end_time']));
+        if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
+            $condition['apply_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
+        } elseif ($start_unixtime > 0) {
+            $condition['apply_time'] = ['egt', $start_unixtime];
+        } elseif ($end_unixtime > 0) {
+            $condition['apply_time'] = ['lt', $end_unixtime];
+        }
+
+        //上游充值申请列表
+        $evidence_list = $mod->getProviderEvidence($condition, 30, '*', 'apply_time desc');
+        $stats = $mod->field('sum(amount) as amounts')->where($condition)->find();
+        Tpl::output('amounts', $stats['amounts']);
+        Tpl::output('evidence_list', $evidence_list);
+        Tpl::output('page', $mod->showpage());
+        Tpl::showpage('merchant.provider.evidence_list');
+    }
+
+    public function provider_evidence_addOp()
+    {
+        $provider_model = Model('refill_provider');
+        if (chksubmit()) {
+            $obj_validate = new Validator();
+            $obj_validate->validateparam = [
+                ["input" => $_POST["provider_id"], "require" => "true", "message" => '上游通道不能为空'],
+                ["input" => $_POST["bank_username"], "require" => "true", "message" => '开户人姓名不能为空'],
+                ["input" => $_POST["bank_name"], "require" => "true", "message" => '开户银行不能为空'],
+                ["input" => $_POST["to_bank_username"], "require" => "true", "message" => '上游开户人姓名不能为空'],
+                ["input" => $_POST["to_bank_name"], "require" => "true", "message" => '上游开户银行不能为空'],
+                ["input" => $_POST["amount"], "require" => "true", "message" => '预存金额不能为空'],
+                ["input" => $_POST["apply_time"], "require" => "true", "message" => '申请日期不能为空']
+            ];
+            $error = $obj_validate->validate();
+            if ($error != '') {
+                showMessage($error);
+            }
+            $provider_id = $_POST["provider_id"];
+            $provider_info = $provider_model->table('refill_provider,store')
+                ->where((['provider_id' => $provider_id]))
+                ->field('refill_provider.*,store.store_name')
+                ->join('inner')
+                ->on('store.store_id=refill_provider.store_id')
+                ->find();
+            if (!$provider_info) {
+                showMessage('对应店铺不存在');
+            }
+            $amount = $_POST['amount'];
+            $money = abs($amount);
+            if ($money == 0) {
+                showMessage('申请金额错误');
+            }
+            if(!empty($_FILES['voucher']['name'])) {
+                $upload = new UploadFile();
+                $upload->set('default_dir',ATTACH_UPFILE.'/provider');
+
+                $result = $upload->upfile('voucher');
+                if ($result){
+                    $_POST['voucher'] = $upload->file_name;
+                    $input['voucher_name'] = $_POST['voucher'];
+                }else {
+                    showMessage($upload->error);
+                }
+            }
+
+            $input['store_name'] = $provider_info['store_name'];
+            $input['store_id'] = $provider_info['store_id'];
+            $input['amount'] = $amount;
+            $input['bank_username'] = $_POST['bank_username'];
+            $input['bank_name'] = $_POST['bank_name'];
+            $input['to_bank_username'] = $_POST['to_bank_username'];
+            $input['to_bank_name'] = $_POST['to_bank_name'];
+            $input['add_time'] = time();
+            $input['bz'] = $_POST['bz'];
+            $input['apply_time'] = strtotime($_POST['apply_time']);
+            $mod = Model('provider_evidence');
+            $res = $mod->addProviderEvidence($input);
+
+            if ($res) {
+                showMessage('操作成功',"index.php?act=provider_info&op=provider_evidence");
+            } else {
+                showMessage('操作失败');
+            }
+        } else {
+            $provider_list = Model('')->table('refill_provider,store')
+                ->field('refill_provider.*,store.store_name')
+                ->join('inner')
+                ->on('store.store_id=refill_provider.store_id')
+                ->limit(1000)
+                ->select();
+            Tpl::output('provider_list', $provider_list);
+            Tpl::showpage('provider.evidence.add');
+        }
+    }
+
+    public function importOp()
+    {
+        if(chksubmit()) {
+            $provider_list = Model('')->table('refill_provider,store')
+                ->field('refill_provider.provider_id,store.store_id,store.store_name')
+                ->join('inner')
+                ->on('store.store_id=refill_provider.store_id')
+                ->limit(1000)
+                ->select();
+            $store = [];
+            foreach ($provider_list as $provider) {
+                $store[$provider['provider_id']] = ['store_id' => $provider['store_id'], 'store_name' => $provider['store_name']];
+            }
+            if(empty($store)) {
+                showMessage('上游通道为空,不可导入');
+            }
+            //得到导入文件
+            $filename = $_FILES['csv']['name'];
+            $tmp_name = $_FILES['csv']['tmp_name'];
+            $extend = strrchr($filename,'.');
+            $extendLower = strtolower($extend);
+            if (!in_array($extendLower, ['.xls', '.xlsx', '.csv']))
+            {
+                showMessage('文件格式有误');
+            }
+            $filePath = BASE_ROOT_PATH . '/data/upload/upfile/provider/';
+
+            /** Error reporting */
+            error_reporting(E_ALL);
+            //注意设置时区
+            $time=date("m-d-H-i-s");//去当前上传的时间
+            //根据当前时间外加后五位产生一个 防止多个用户同时操作产生的重复概率
+            $randnum = 'RefillOrderImport_'.$time.str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
+            //上传后的文件名
+            $name=$randnum.$extendLower;
+
+            $upload_filename=$filePath.$name;//上传后的文件名地址
+
+            $result=move_uploaded_file($tmp_name,$upload_filename);//假如上传到当前目录下
+            if(!$result){
+                showMessage('上传失败,稍后再试!');
+                exit;
+            }
+
+            $fileType = PHPExcel_IOFactory::identify($upload_filename);
+            $objReader = PHPExcel_IOFactory::createReader($fileType);
+            $objPHPExcel = $objReader->load($upload_filename);
+
+            $time = time();
+            $mod = Model('provider_evidence');
+            foreach ($objPHPExcel->getWorkSheetIterator() as $sheet)
+            {
+                foreach ($sheet->getRowIterator() as $row)
+                {
+                    $index = $row->getRowIndex();
+                    if ($index == 1) continue;
+                    $items = [];
+                    foreach ($row->getCellIterator() as $cell) {
+                        $data = $cell->getValue();
+                        $items[] = $data;
+                    }
+                    $provider_id = intval($items[0]);
+                    $params = [
+                        'store_id' => $store[$provider_id]['store_id'],
+                        'store_name' => $store[$provider_id]['store_name'],
+                        'amount' => $items[1] ?? '',
+                        'bank_username' => trim($items[2]) ?? '',
+                        'bank_name' => trim($items[3]) ?? '',
+                        'to_bank_username' => trim($items[4]) ?? '',
+                        'to_bank_name' => trim($items[5]) ?? '',
+                        'apply_time' => strtotime($items[6]) ?? '',
+                        'add_time' => $time
+                    ];
+                    if(!empty($items[7])) {
+                        $params['bz'] = $items[7];
+                    }
+                    $json_txt = json_encode($params);
+                    Log::record("import data: {$json_txt}",LOG::DEBUG);
+                    if(empty($params['store_id']) || empty($params['store_name'])) {
+                        Log::record("provider evidence import err,not find store info, provider_id: {$provider_id}, amount: {$params['amount']}",LOG::DEBUG);
+                    }
+                    $res = $mod->addProviderEvidence($params);
+                    if(!$res){
+                        Log::record("provider evidence import err, provider_id: {$provider_id}, amount: {$params['amount']}",LOG::DEBUG);
+                    }
+                }
+            }
+            showMessage('操作完成');
+            exit;
+        }
+        else
+        {
+            Tpl::showpage('provider.evidence.import');
+        }
+    }
 }

+ 1 - 1
admin/control/refill_evidence.php

@@ -16,7 +16,7 @@ class refill_evidenceControl extends SystemControl
         $model_merchant = Model('merchant');
         $condition = [];
         if (trim($_GET['mch_name']) != '') {
-            $condition['mch_name'] = ['like', '%' . $_GET['mch_name'] . '%'];
+            $condition['mch_name'] = $_GET['mch_name'];
             Tpl::output('mch_name', $_GET['mch_name']);
         }
         $state_sel = intval($_REQUEST['state_sel']);

+ 23 - 9
admin/templates/default/merchant.provider.evidence_list.php

@@ -5,6 +5,14 @@
         margin-bottom:10px !important;
         font-weight:700 !important;
     }
+    .page .fixed-bar .item-title h3 {
+    margin-top: 18px !important;
+    margin-bottom: 10px !important;
+    font-weight: 700 !important;
+}
+.tab-base li span {
+    font-size: 12px !important;
+}
 </style>
 <div class="page">
     <div class="fixed-bar">
@@ -12,15 +20,18 @@
             <h3>上游信息管理</h3>
             <ul class="tab-base">
                 <li><a href="index.php?act=provider_info&op=provider"><span>上游信息管理</span></a></li>
+                <li><a href="index.php?act=provider_info&op=add"><span>新增</span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span>上游充值申请记录</span></a></li>
-                <li><a href="index.php?act=merchant&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
+                <li><a href="index.php?act=provider_info&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
+                <li><a href="index.php?act=provider_info&op=import"><span>导入上游充值申请</span></a></li>
             </ul>
         </div>
     </div>
     <div class="fixed-empty"></div>
-    <form method="get" name="formSearch" id="formSearch">
-        <input type="hidden" value="merchant" name="act">
+    <form method="get" name="formSearch" action="" id="formSearch" enctype="multipart/form-data">
+        <input type="hidden" value="provider_info" name="act">
         <input type="hidden" value="provider_evidence" name="op">
+
         <table class="tb-type1 noborder search">
             <tbody>
             <tr>
@@ -42,7 +53,8 @@
                     <?php if ($output['mch_name'] != '') { ?>
                         <a href="index.php?act=merchant&op=refill_evidence" class="btns "
                            title="<?php echo $lang['nc_cancel_search']; ?>"><span><?php echo $lang['nc_cancel_search']; ?></span></a>
-                    <?php } ?></td>
+                    <?php } ?>
+                </td>
             </tr>
             </tbody>
         </table>
@@ -60,13 +72,13 @@
         <tr>
             <td>
                 <ul>
-                    <li>提交金额:<?php echo $output['amounts'];?></li>
+                    <li>提交金额:<?php echo $output['amounts']*100%100==0 ? intval($output['amounts']) : $output['amounts']; ?> (<?php echo $output['amounts']>=10000 ? $output['amounts']/10000 .'万' : $output['amounts'] . '元';?>)</li>
                 </ul>
             </td>
         </tr>
         </tbody>
     </table>
-    <form method="post" id="merchant_name_form">
+    <form type="file" method="post" id="merchant_name_form">
         <input type="hidden" name="form_submit" value="ok"/>
         <table class="table tb-type2">
             <thead>
@@ -79,7 +91,7 @@
                 <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">备注</th>
                 <th class="align-center"><?php echo $lang['operation']; ?></th>
             </tr>
@@ -96,10 +108,12 @@
                         <td class="align-center"><?php echo $v['to_bank_username']; ?></td>
                         <td class="align-center"><?php echo $v['to_bank_name']; ?></td>
                         <td class="nowarp align-center"><?php echo $v['apply_time'] ? date('Y-m-d H:i', $v['apply_time']) : $lang['no_limit']; ?></td>
-                        <td class="nowarp align-center"><?php echo $v['add_time'] ? date('Y-m-d H:i', $v['add_time']) : $lang['no_limit']; ?></td>
+<!--                        <td class="nowarp align-center">--><?php //echo $v['add_time'] ? date('Y-m-d H:i', $v['add_time']) : $lang['no_limit']; ?><!--</td>-->
                         <td class="nowarp align-center"><?php echo $v['bz']?></td>
                         <td class="align-center w200">
                             <a href="index.php?act=provider_info&op=apply_edit&apply_id=<?php echo $v['apply_id'] ?>">编辑</a>
+                            |
+                            <a href="index.php?act=provider_info&op=apply_del&apply_id=<?php echo $v['apply_id'] ?>">删除</a>
                             <?php if(!empty($v['voucher_name'])) {?>
                                     |
                             <a target="_blank"
@@ -130,6 +144,7 @@
 <script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL;?>/layui/layui.js"></script>
 <link rel="stylesheet" type="text/css" href="<?php echo ADMIN_TEMPLATES_URL; ?>/layui/css/layui.css"/>
 <script>
+
     $(function () {
         // 日期选择器
         laydate.render({
@@ -153,5 +168,4 @@
             })
         })
     });
-    
 </script>

+ 88 - 12
admin/templates/default/provider.evidence.add.php

@@ -28,8 +28,10 @@
       <h3>上游信息管理</h3>
       <ul class="tab-base">
           <li><a href="index.php?act=provider_info&op=provider"><span>上游信息管理</span></a></li>
-          <li><a href="index.php?act=merchant&op=provider_evidence"><span>上游充值申请记录</span></a></li>
+          <li><a href="index.php?act=provider_info&op=add"><span>新增</span></a></li>
+          <li><a href="index.php?act=provider_info&op=provider_evidence"><span>上游充值申请记录</span></a></li>
           <li><a href="JavaScript:void(0);" class="current"><span>新增上游充值申请</span></a></li>
+          <li><a href="index.php?act=provider_info&op=import"><span>导入上游充值申请</span></a></li>
       </ul>
     </div>
   </div>
@@ -44,8 +46,8 @@
         </tr>
         <tr class="">
           <td class="">
-              <select name="provider_id" class="layui_in" lay-verify="" lay-search>
-                  <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+              <select name="provider_id" class="layui_in" id="provider_id" lay-verify="" lay-search lay-filter="provider_id">
+                  <option id="" value=""><?php echo $lang['nc_please_choose']; ?></option>
                   <?php foreach($output['provider_list'] as $provider){?>
                       <option value="<?php echo $provider['provider_id']?>"><?php echo $provider['store_name']?></option>
                   <?php }?>
@@ -78,18 +80,24 @@
         <tr class="noborder">
             <td colspan="2" class="required"><label class="validation">上游收款转账开户人姓名:</label></td>
         </tr>
-        <tr class="noborder">
-            <td class="vatop rowform">
-                <input type="text" name="to_bank_username" id="to_bank_username" class="txt" value="">
+        <tr class="">
+            <td class=" ">
+                <select name="to_bank_username" id="to_bank_username">
+                    <option value="">请选择</option>
+                </select>
+            </td>
             <td class="vatop tips"></td>
         </tr>
         <tr class="noborder">
             <td colspan="2" class="required"><label class="validation">上游收款转账银行名称:</label></td>
         </tr>
-        <tr class="noborder">
-            <td class="vatop rowform">
-                <input type="text" name="to_bank_name" id="to_bank_name" class="txt" value="">
-            <td class="vatop tips"></td>
+        <tr class="">
+             <td class="">
+                 <select name="to_bank_name" id="to_bank_name">
+                 <option value="">请选择</option>
+                 </select>
+             </td>
+        <td class="vatop tips"></td>
         </tr>
         <tr>
             <td colspan="2"><label>充值申请凭证:</label></td>
@@ -132,12 +140,13 @@
 <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/i18n/zh-CN.js"
         charset="utf-8"></script>
  <link rel="stylesheet" type="text/css"
-      href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css"/> 
+      href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css"/>
 <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/refill/layer.js"></script>
 <script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL;?>/layui/layui.js"></script>
 <link rel="stylesheet" type="text/css" href="<?php echo ADMIN_TEMPLATES_URL; ?>/layui/css/layui.css"/>
 
 <script type="text/javascript">
+var ji=null;
 $(function(){
     $("#voucher").change(function(){
         $("#textfield1").val($(this).val());
@@ -147,6 +156,71 @@ $(function(){
             $("#points_form").submit();
         }
     });
+        layui.use(['form'], function(){
+            var form = layui.form;
+            form.on('select(provider_id)', function (data) {
+                let category = data.value;
+                form.render('select')
+                $.get('index.php?act=provider_info&op=get_provider_info&provider_id='+ category,function(data) {
+                    data = JSON.parse(data)
+                    let html='';
+                    data.to_bank_username.forEach(item=>{
+                        html+=`<option value="${item}">${item}</option>`;
+                        
+                    })
+                    $('#to_bank_username').empty().append(html);
+
+                    html='';
+                    data.to_bank_name.forEach(item=>{
+                        html+=`<option value="${item}">${item}</option>`;
+                    })
+                    $('#to_bank_name').empty().append(html);
+                    form.render();
+                })
+            })
+        
+        //    form.on('select(city)', function (data) {
+        //       let city_1 = data.value;
+        //       let city_2 = data.elem[data.elem.selectedIndex].text;
+        //       form.render('select')
+        //       let city_3 = {name: [], value: []}
+        //      //   city_3.push(city_1)
+        //       //   city_3.push(city_2)
+
+        //     //   console.log(city_3);
+        //    $.get('index.php?act=provider_info&op=get_provider_info',
+        //      {
+        //         provider_id:city_3,
+
+
+        //       },function(data) {
+        //           data = JSON.parse(data)
+        //              city_3.value.push(city_1)
+        //              city_3.name.push(city_2)
+        //          data.to_bank_username.push(city_3)
+        //         //  data.to_bank_username.push(city_2),
+        //          console.log(data);
+        //          })
+        //   })
+        //   form.on('select(city_q)', function (data) {
+        //       let city_4 = data.value;
+        //       let city_5 = data.elem[data.elem.selectedIndex].text;
+        //       form.render('select')
+        //       let city_6 = {name: [], value: []}
+        //     //   city_3.push(city_1)
+        //     //   city_3.push(city_2)
+
+        //       console.log(city_6);
+        //    $.get('index.php?act=provider_info&op=get_provider_info&provider_id'+city_6,function(data) {
+        //           data = JSON.parse(data)
+        //              city_6.value.push(city_4)
+        //              city_6.name.push(city_5)
+        //          data.to_bank_name.push(city_6)
+        //         //  data.to_bank_username.push(city_2),
+        //         //  console.log(data);
+        //          })
+        //   })
+
     $('#points_form').validate({
         errorPlacement: function (error, element) {
             error.appendTo(element.parent().parent().prev().find('td:first'));
@@ -204,5 +278,7 @@ $(function(){
         type: 'datetime',
         trigger: 'click'
     });
-});
+ });
+
+})
 </script>

+ 49 - 0
admin/templates/default/provider.evidence.import.php

@@ -0,0 +1,49 @@
+<?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=provider_info&op=provider"><span>上游信息管理</span></a></li>
+            <li><a href="index.php?act=provider_info&op=add"><span>新增</span></a></li>
+            <li><a href="index.php?act=provider_info&op=provider_evidence"><span>上游充值申请记录</span></a></li>
+            <li><a href="index.php?act=provider_info&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
+            <li><a href="JavaScript:void(0);" class="current"><span>导入上游充值申请</span></a></li>
+        </ul>
+    </div>
+  </div>
+  <div class="fixed-empty"></div>
+  <form method="post" enctype="multipart/form-data" name="form1">
+    <input type="hidden" name="form_submit" value="ok" />
+    <input type="hidden" name="charset" value="gbk" />
+    <table class="table tb-type2">
+      <tbody>
+        <tr class="noborder">
+          <td colspan="2" class="required"><label>请选择文件:</label></td>
+        </tr>
+        <tr class="noborder">
+          <td class="vatop rowform"><span class="type-file-box">
+            <input type="file" name="csv" id="csv" class="type-file-file"  size="30"  />
+            </span></td>
+          <td class="vatop tips">如果导入速度较慢,建议您把文件拆分为几个小文件,然后分别导入</td>
+        </tr>
+      </tbody>
+      <tfoot>
+        <tr class="tfoot">
+          <td colspan="2"><a href="JavaScript:document.form1.submit();" class="btn"><span>导入</span></a></td>
+        </tr>
+      </tfoot>
+    </table>
+  </form>
+</div>
+
+<script type="text/javascript">
+	$(function(){
+    var textButton="<input type='text' name='textfield' id='textfield1' class='type-file-text' /><input type='button' name='button' id='button1' value='' class='type-file-button' />"
+	$(textButton).insertBefore("#csv");
+	$("#csv").change(function(){
+	$("#textfield1").val($("#csv").val());
+	});
+});
+</script> 

+ 3 - 2
admin/templates/default/provider.info.add.php

@@ -28,8 +28,9 @@
             <ul class="tab-base">
                 <li><a href="index.php?act=provider_info&op=index"><span>上游信息管理</span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span>新增</span></a></li>
-                <li><a href="index.php?act=merchant&op=provider_evidence"><span>上游充值申请记录</span></a></li>
-                <li><a href="index.php?act=merchant&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
+                <li><a href="index.php?act=provider_info&op=provider_evidence"><span>上游充值申请记录</span></a></li>
+                <li><a href="index.php?act=provider_info&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
+                <li><a href="index.php?act=provider_info&op=import"><span>导入上游充值申请</span></a></li>
             </ul>
         </div>
     </div>

+ 3 - 2
admin/templates/default/provider.info.edit.php

@@ -11,8 +11,9 @@
             <ul class="tab-base">
                 <li><a href="index.php?act=provider_info&op=index"><span>上游信息管理</span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span>编辑</span></a></li>
-                <li><a href="index.php?act=merchant&op=provider_evidence"><span>上游充值申请记录</span></a></li>
-                <li><a href="index.php?act=merchant&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
+                <li><a href="index.php?act=provider_info&op=provider_evidence"><span>上游充值申请记录</span></a></li>
+                <li><a href="index.php?act=provider_info&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
+                <li><a href="index.php?act=provider_info&op=import"><span>导入上游充值申请</span></a></li>
             </ul>
         </div>
     </div>

+ 8 - 3
admin/templates/default/provider.info.php

@@ -22,8 +22,9 @@
             <ul class="tab-base">
                 <li><a href="JavaScript:void(0);" class="current"><span>上游信息管理</span></a></li>
                 <li><a href="index.php?act=provider_info&op=add"><span>新增</span></a></li>
-                <li><a href="index.php?act=merchant&op=provider_evidence"><span>上游充值申请记录</span></a></li>
-                <li><a href="index.php?act=merchant&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
+                <li><a href="index.php?act=provider_info&op=provider_evidence"><span>上游充值申请记录</span></a></li>
+                <li><a href="index.php?act=provider_info&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
+                <li><a href="index.php?act=provider_info&op=import"><span>导入上游充值申请</span></a></li>
             </ul>
         </div>
     </div>
@@ -80,7 +81,11 @@
                         <td class="align-center"><?php echo $v['bank_name']; ?></td>
                         <td class="align-center"><?php echo $v['bank_username']; ?></td>
                         <td class="align-center"><?php echo $v['bank_card_no']; ?></td>
-                        <td class="align-center"><?php echo $v['admin_url']; ?></td>
+                        <td class="align-center">
+                            <a target="_blank" href="<?php echo $v['admin_url']; ?>">
+                                <?php echo $v['admin_url']; ?>
+                            </a>
+                        </td>
                         <td class="align-center"><?php echo $v['admin_name']; ?></td>
                         <td class="align-center"><?php echo $v['admin_pwd']; ?></td>
                         <td class="align-center w200">

+ 18 - 3
admin/templates/default/recharge.manual.edit.php

@@ -5,14 +5,14 @@
     <div class="item-title">
       <h3>预存款</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="index.php?act=merchant&op=merchant"><span><?php echo $lang['nc_manage'] ?></span></a></li>
           <li><a href="index.php?act=merchant&op=merchant_add"><span><?php echo $lang['nc_new'] ?></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="points_form" method="post" name="form1">
+    <form id="points_form" method="post" name="form1" enctype="multipart/form-data">
     <input type="hidden" name="form_submit" value="ok" />
       <input type="hidden" name="type" value="<?php echo $_GET['type'];?>" />
     <table class="table tb-type2 nobdb">
@@ -41,6 +41,19 @@
           <td class="vatop tips"></td>
         </tr>
         <tr>
+            <td colspan="2"><label>充值申请凭证:</label></td>
+        </tr>
+        <tr class="noborder">
+            <td class="vatop rowform">
+                <span class="type-file-box">
+                    <input type='text' name='textfield' id='textfield1' class='type-file-text' />
+                    <input type='button' name='button' id='button1' value='' class='type-file-button' />
+                    <input name="voucher" type="file" class="type-file-file" id="voucher" size="30" hidefocus="true">
+                </span>
+            </td>
+            <td class="vatop tips"></td>
+        </tr>
+        <tr>
           <td colspan="2" class="required"><label>描述信息:</label></td>
         </tr>
         <tr class="noborder">
@@ -58,7 +71,9 @@
 </div>
 <script type="text/javascript">
 $(function(){
-	
+    $("#voucher").change(function(){
+        $("#textfield1").val($(this).val());
+    });
     $('#points_form').validate({
         rules : {
             apply_id: {

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

@@ -886,7 +886,7 @@ class ModelDb
 
     protected function parseTable($options) 
     {
-    	if ($options['on']) return null;
+    	if (!empty($options['on'])) return null;
     	$tables = $options['table'];
         if(is_array($tables)) {// 别名定义
             $array   =  [];

+ 115 - 115
data/config/xyz/base.ini.php

@@ -1,116 +1,116 @@
-<?php declare(strict_types=1);
-
-defined('InShopNC') or exit('Access Invalid!');
-
-define('USE_REMOTE_IMAGE',false);
-define('DEBUG_MODE',true);
-define('MOBILE_PUBLISH',false);
-define('PUSH_OMS',true);
-define('LOCAL_DEBUG',false);
-define('BONUS_EXPIRY_DATE',true);
-define('USE_BONUS_RATE',false);
-define('SERVER_TYPE','panda');
-define('CROSS_DOAMIN',false);
-define('COMPANY_NAME', 'XYZ_COMPANY');
-define('ZERO_GOODS_ID', 6405);
-
-$config = [];
-$config['base_site_url']        = SRV_HOST;
-$config['client_site_url']      = SRV_HOST;
-$config['shop_site_url'] 		= SRV_HOST.'/shop';
-$config['cms_site_url'] 		= SRV_HOST.'/cms';
-$config['microshop_site_url'] 	= SRV_HOST.'/microshop';
-$config['circle_site_url'] 		= SRV_HOST.'/circle';
-$config['admin_site_url'] 		= SRV_HOST.'/admin';
-$config['mobile_site_url'] 		= SRV_HOST.'/mobile';
-$config['wap_site_url'] 		= SRV_HOST.'/wap';
-$config['chat_site_url'] 		= SRV_HOST.'/chat';
-$config['node_site_url'] 		= 'http://127.0.0.1:8090';
-$config['delivery_site_url']    = SRV_HOST.'/delivery';
-
-$config['system_manager_phones'] = [
-    '13911129867' , '18500608333' , '18500350111' , '15136908757'
-];
-
-if(defined('USE_REMOTE_IMAGE') && USE_REMOTE_IMAGE == true) {
-    $config['upload_site_url']		= REMOTE_IMG_HOST.'/data/upload';
-    $config['resource_site_url']	= REMOTE_IMG_HOST.'/data/resource';
-} else {
-    $config['upload_site_url']		= SRV_HOST.'/data/upload';
-    $config['resource_site_url']	= SRV_HOST.'/data/resource';
-}
-
-$config['version'] 	= '201502020388';
-$config['setup_date'] 	= '2015-08-22 15:52:34';
-$config['gip'] 		= 0;
-$config['dbdriver'] 	= 'mysqli';
-$config['tablepre']	= 'lrlz_';
-
-$config['db'][1]['dbhost']       = MASTER_DBHOST;
-$config['db'][1]['dbport']       = '3306';
-$config['db'][1]['dbuser']       = 'root';
-$config['db'][1]['dbpwd']        = 'XTZ@shop@951688';
-$config['db'][1]['dbname']       = 'xyzshop';
-$config['db'][1]['dbcharset']    = 'UTF-8';
-
-$config['db']['slave'][0]['dbhost']     = SLAVE_DBHOST;
-$config['db']['slave'][0]['dbport']     = '3306';
-$config['db']['slave'][0]['dbuser']     = 'root';
-$config['db']['slave'][0]['dbpwd']      = 'XTZ@shop@951688';
-$config['db']['slave'][0]['dbname']     = 'xyzshop';
-$config['db']['slave'][0]['dbcharset']  = 'UTF-8';
-
-$config['session_expire'] 	= 3600;
-$config['lang_type'] 		= 'zh_cn';
-$config['cookie_pre'] 		= '6B0C_';
-$config['thumb']['cut_type'] = 'gd';
-$config['thumb']['impath'] = '';
-
-$config['cache']['type'] 		= 'redis';
-$config['redis']['prefix']      	= 'nc_';
-$config['redis']['master']['host']     	= MASTER_REDISHOST;
-$config['redis']['master']['port']     	= 6379;
-$config['redis']['master']['pconnect'] 	= 0;
-$config['redis']['slave']['host']     	= SLAVE_REDISHOST;
-$config['redis']['slave']['port']     	= 6379;
-$config['redis']['slave']['pconnect'] 	= 0;
-
-$config['coroutine']['redis_host'] = '172.26.105.125';
-$config['coroutine']['redis_port'] = 6379;
-
-
-//$config['fullindexer']['open']      = false;
-//$config['fullindexer']['appname']   = '33hao';
-
-$config['debug'] 		      = false;
-$config['default_store_id'] = '1';
-//如果开始伪静态,这里设置为true
-$config['url_model'] = false;
-
-//如果店铺开启二级域名绑定的,这里填写主域名如baidu.com
-$config['subdomain_suffix'] = '';
-$config['session_type'] = 'redis';
-$config['session_save_path'] = SESSION_SAVE_PATH;
-$config['node_chat'] = true;
-
-//流量记录表数量,为1~10之间的数字,默认为3,数字设置完成后请不要轻易修改,否则可能造成流量统计功能数据错误
-$config['flowstat_tablenum'] = 3;
-$config['sms']['gwUrl'] = 'http://sdkhttp.eucp.b2m.cn/sdk/SDKService';
-$config['sms']['serialNumber'] = '';
-$config['sms']['password']     = '';
-$config['sms']['sessionKey']   = '';
-
-$config['queue']['open'] = true;
-$config['queue']['host'] = QUEUEHOST;
-$config['queue']['port'] = 6379;
-$config['cache_open']    = true;
-
-$config['return_address'] = ['address' => '上海市金山区朱吕公路7335号','name' => "大熊猫(丽帆供应链)",'tel_phone' => '17301603655','zip_code' => '201600'];
-$config['area_version'] = 5;
-$config['appjump_prefix'] = 'xyzshop://www.xyzshops.com';
-
-$config['client_setting'] = ['running' => 174,'home' => 0];
-$config['wsd_bradge_port'] = 60987;
-$config['card_key_stores'] = [6];
-
+<?php declare(strict_types=1);
+
+defined('InShopNC') or exit('Access Invalid!');
+
+define('USE_REMOTE_IMAGE',false);
+define('DEBUG_MODE',true);
+define('MOBILE_PUBLISH',false);
+define('PUSH_OMS',true);
+define('LOCAL_DEBUG',false);
+define('BONUS_EXPIRY_DATE',true);
+define('USE_BONUS_RATE',false);
+define('SERVER_TYPE','panda');
+define('CROSS_DOAMIN',false);
+define('COMPANY_NAME', 'XYZ_COMPANY');
+define('ZERO_GOODS_ID', 6405);
+
+$config = [];
+$config['base_site_url']        = SRV_HOST;
+$config['client_site_url']      = SRV_HOST;
+$config['shop_site_url'] 		= SRV_HOST.'/shop';
+$config['cms_site_url'] 		= SRV_HOST.'/cms';
+$config['microshop_site_url'] 	= SRV_HOST.'/microshop';
+$config['circle_site_url'] 		= SRV_HOST.'/circle';
+$config['admin_site_url'] 		= SRV_HOST.'/admin';
+$config['mobile_site_url'] 		= SRV_HOST.'/mobile';
+$config['wap_site_url'] 		= SRV_HOST.'/wap';
+$config['chat_site_url'] 		= SRV_HOST.'/chat';
+$config['node_site_url'] 		= 'http://127.0.0.1:8090';
+$config['delivery_site_url']    = SRV_HOST.'/delivery';
+
+$config['system_manager_phones'] = [
+    '15811535608' , '18500608333' , '18500350111' , '15136908757'
+];
+
+if(defined('USE_REMOTE_IMAGE') && USE_REMOTE_IMAGE == true) {
+    $config['upload_site_url']		= REMOTE_IMG_HOST.'/data/upload';
+    $config['resource_site_url']	= REMOTE_IMG_HOST.'/data/resource';
+} else {
+    $config['upload_site_url']		= SRV_HOST.'/data/upload';
+    $config['resource_site_url']	= SRV_HOST.'/data/resource';
+}
+
+$config['version'] 	= '201502020388';
+$config['setup_date'] 	= '2015-08-22 15:52:34';
+$config['gip'] 		= 0;
+$config['dbdriver'] 	= 'mysqli';
+$config['tablepre']	= 'lrlz_';
+
+$config['db'][1]['dbhost']       = MASTER_DBHOST;
+$config['db'][1]['dbport']       = '3306';
+$config['db'][1]['dbuser']       = 'root';
+$config['db'][1]['dbpwd']        = 'XTZ@shop@951688';
+$config['db'][1]['dbname']       = 'xyzshop';
+$config['db'][1]['dbcharset']    = 'UTF-8';
+
+$config['db']['slave'][0]['dbhost']     = SLAVE_DBHOST;
+$config['db']['slave'][0]['dbport']     = '3306';
+$config['db']['slave'][0]['dbuser']     = 'root';
+$config['db']['slave'][0]['dbpwd']      = 'XTZ@shop@951688';
+$config['db']['slave'][0]['dbname']     = 'xyzshop';
+$config['db']['slave'][0]['dbcharset']  = 'UTF-8';
+
+$config['session_expire'] 	= 3600;
+$config['lang_type'] 		= 'zh_cn';
+$config['cookie_pre'] 		= '6B0C_';
+$config['thumb']['cut_type'] = 'gd';
+$config['thumb']['impath'] = '';
+
+$config['cache']['type'] 		= 'redis';
+$config['redis']['prefix']      	= 'nc_';
+$config['redis']['master']['host']     	= MASTER_REDISHOST;
+$config['redis']['master']['port']     	= 6379;
+$config['redis']['master']['pconnect'] 	= 0;
+$config['redis']['slave']['host']     	= SLAVE_REDISHOST;
+$config['redis']['slave']['port']     	= 6379;
+$config['redis']['slave']['pconnect'] 	= 0;
+
+$config['coroutine']['redis_host'] = '172.26.105.125';
+$config['coroutine']['redis_port'] = 6379;
+
+
+//$config['fullindexer']['open']      = false;
+//$config['fullindexer']['appname']   = '33hao';
+
+$config['debug'] 		      = false;
+$config['default_store_id'] = '1';
+//如果开始伪静态,这里设置为true
+$config['url_model'] = false;
+
+//如果店铺开启二级域名绑定的,这里填写主域名如baidu.com
+$config['subdomain_suffix'] = '';
+$config['session_type'] = 'redis';
+$config['session_save_path'] = SESSION_SAVE_PATH;
+$config['node_chat'] = true;
+
+//流量记录表数量,为1~10之间的数字,默认为3,数字设置完成后请不要轻易修改,否则可能造成流量统计功能数据错误
+$config['flowstat_tablenum'] = 3;
+$config['sms']['gwUrl'] = 'http://sdkhttp.eucp.b2m.cn/sdk/SDKService';
+$config['sms']['serialNumber'] = '';
+$config['sms']['password']     = '';
+$config['sms']['sessionKey']   = '';
+
+$config['queue']['open'] = true;
+$config['queue']['host'] = QUEUEHOST;
+$config['queue']['port'] = 6379;
+$config['cache_open']    = true;
+
+$config['return_address'] = ['address' => '上海市金山区朱吕公路7335号','name' => "大熊猫(丽帆供应链)",'tel_phone' => '17301603655','zip_code' => '201600'];
+$config['area_version'] = 5;
+$config['appjump_prefix'] = 'xyzshop://www.xyzshops.com';
+
+$config['client_setting'] = ['running' => 174,'home' => 0];
+$config['wsd_bradge_port'] = 60987;
+$config['card_key_stores'] = [6];
+
 $config['phone_life_check'] = true;

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

@@ -31,4 +31,9 @@ class provider_evidenceModel extends Model
     {
         return $this->where($condition)->find();
     }
+
+    public function DelProviderEvidence($condition)
+    {
+        return $this->where($condition)->delete();
+    }
 }

+ 1 - 1
helper/PHPExcel/PHPExcel/Shared/OLE.php

@@ -287,7 +287,7 @@ class PHPExcel_Shared_OLE
 				$pps = new PHPExcel_Shared_OLE_PPS_File($name);
 				break;
 			default:
-				continue;
+                break;
 			}
 			fseek($fh, 1, SEEK_CUR);
 			$pps->Type    = $type;

+ 60 - 60
helper/refill/api/xyz/yunling/RefillCallBack.php

@@ -1,61 +1,61 @@
-<?php
-
-
-namespace refill\yunling;
-
-require_once(BASE_HELPER_RAPI_PATH . '/yunling/config.php');
-
-
-use refill;
-use Log;
-
-class RefillCallBack implements refill\IRefillCallBack
-{
-    public function verify($params): bool
-    {
-        $sign = $this->sign($params);
-        if ($params['sign'] == $sign) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    private function sign($params)
-    {
-        $userid = config::USER_ID;
-        $key = config::KEY;
-        $content = "userid={$userid}&orderid={$params['orderid']}&sporderid={$params['sporderid']}&merchantsubmittime={$params['merchantsubmittime']}";
-        $content .= "&resultno={$params['resultno']}&key={$key}";
-        return md5($content);
-    }
-
-    public function notify($params)
-    {
-        Log::record("notify params:" . json_encode($params),Log::DEBUG);
-
-        $status = intval($params['resultno']);
-        $order_sn = $params['sporderid'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
-        if (empty($order_info)) {
-            return [false, false, false,false];
-        }
-        $order_id = $order_info['order_id'];
-
-        if(empty($params['supnumber'])) {
-            $data['official_sn'] = '';
-        }
-        else {
-            $data['official_sn'] = strtolower($params['supnumber']) == 'null' ? '' : $params['supnumber'];
-        }
-
-        if ($status === 1) {
-            Model('refill_order')->edit($order_id, $data);
-            return [$order_id, true, false, true];
-        } elseif ($status === 9) {
-            return [$order_id, false, true, true];
-        } else {
-            return [$order_id, false, false, false];
-        }
-    }
+<?php
+
+
+namespace refill\yunling;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yunling/config.php');
+
+
+use refill;
+use Log;
+
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&orderid={$params['orderid']}&sporderid={$params['sporderid']}&merchantsubmittime={$params['merchantsubmittime']}";
+        $content .= "&resultno={$params['resultno']}&key={$key}";
+        return strtoupper(md5($content));
+    }
+
+    public function notify($params)
+    {
+        Log::record("notify params:" . json_encode($params),Log::DEBUG);
+
+        $status = intval($params['resultno']);
+        $order_sn = $params['sporderid'];
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+
+        if(empty($params['remark1'])) {
+            $data['official_sn'] = '';
+        }
+        else {
+            $data['official_sn'] = strtolower($params['remark1']) == 'null' ? '' : $params['remark1'];
+        }
+
+        if ($status === 1) {
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false, true];
+        } elseif ($status === 9) {
+            return [$order_id, false, true, true];
+        } else {
+            return [$order_id, false, false, false];
+        }
+    }
 }

+ 156 - 153
helper/refill/api/xyz/yunling/RefillPhone.php

@@ -1,154 +1,157 @@
-<?php
-
-namespace refill\yunling;
-
-require_once(BASE_HELPER_RAPI_PATH . '/yunling/config.php');
-
-use refill;
-use Log;
-
-class RefillPhone extends refill\IRefillPhone
-{
-    public function __construct($cfgs)
-    {
-        parent::__construct($cfgs);
-    }
-
-    private function req_params(int $phone, int $amount, string $order_sn)
-    {
-        $params['userid'] = config::USER_ID;
-        $params['productid'] = '';
-        $params['productType'] = '1';
-        $params['price'] = $amount;
-        $params['num'] = 1;
-        $params['mobile'] = $phone;
-        $params['spordertime'] = date("YmdHis");
-        $params['sporderid'] = $order_sn;
-        $params['back_url'] = config::NOTIFY_URL;
-        return $params;
-    }
-
-    public function add($card_no, $card_type, $amount, $params)
-    {
-        $order_sn = $params['order_sn'];
-        $params = $this->req_params($card_no, $amount, $order_sn);
-        $params['operator'] = config::operator[$card_type];
-        $region = $this->getPhoneInfo($card_no);
-        if($region === false) {
-            return [false, '归属地获取失败', false];
-        }
-
-        $params['region'] = $region;
-        $sign = $this->sign($params);
-        $params['sign'] = $sign;
-
-        $resp = http_request(config::ORDER_URL, $params);
-
-        if (empty($resp)) {
-            return [false, '网络错误', true];
-        }
-        else
-        {
-            Log::record($resp, Log::DEBUG);
-            $resp = $this->xmlToArray($resp);
-            if (empty($resp)) {
-                return [false, '网络错误', true];
-            }
-            $resultno = intval($resp['resultno']);
-            if (in_array($resultno, [0,1,2])) {
-                return [true, $resp['orderid'], false];
-            } else {
-                return [false, $resp['message'], false];
-            }
-        }
-    }
-
-    public function query($refill_info)
-    {
-        $params['sporderid'] = $refill_info['order_sn'];
-        $params['userid'] = config::USER_ID;
-
-        $resp = http_request(config::QUERY_URL, $params);
-
-        if (empty($resp)) {
-            return [false, '网络错误'];
-        }
-        else
-        {
-            Log::record($resp, Log::DEBUG);
-            $resp = $this->xmlToArray($resp);
-            if (empty($resp)) {
-                return [false, '网络错误'];
-            }
-            $resultno = intval($resp['resultno']);
-            if ($resultno === 1) {
-                $order_state = ORDER_STATE_SUCCESS;
-                $updata['official_sn'] = $resp['supnumber'];
-                Model('refill_order')->edit($refill_info['order_id'], $updata);
-            } elseif ($resultno === 9) {
-                $order_state = ORDER_STATE_CANCEL;
-            } elseif (in_array($resultno, [0,2])) {
-                $order_state = ORDER_STATE_SEND;
-            } else {
-                return [false, $resp['message']];
-            }
-            return [true, $order_state];
-        }
-    }
-
-    private function sign($params)
-    {
-        $userid = config::USER_ID;
-        $key = config::KEY;
-        $content = "userid={$userid}&productid={$params['productid']}&price={$params['price']}&num={$params['num']}&mobile={$params['mobile']}&spordertime={$params['spordertime']}";
-        $content .= "&sporderid={$params['sporderid']}&key={$key}";
-        return md5($content);
-    }
-
-    public function xmlToArray($xml)
-    {
-        //禁止引用外部xml实体
-        libxml_disable_entity_loader(true);
-        $xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
-        $val = json_decode(json_encode($xmlstring), true);
-
-        return $val;
-    }
-
-    private function getPhoneInfo($phone)
-    {
-        $url = "https://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel={$phone}";
-        $resp = http_request($url);  //获取API返回 的数据
-        $resp = mb_convert_encoding($resp, 'UTF-8', 'UTF-8,GBK,GB2312,BIG5'); //解决中文乱码
-
-        $datas = explode('=', $resp);
-        if(count($datas) == 2)
-        {
-            $body = trim($datas[1]);
-            if(preg_match_all("/(\w+):'([^']+)/", $body, $m)) {
-                $res = array_combine($m[1], $m[2]);
-                return $this->formatProvince($res['province']);
-            }
-        }
-        return false;
-    }
-
-    public 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;
-    }
+<?php
+
+namespace refill\yunling;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yunling/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $phone, int $card_type, int $amount, string $order_sn)
+    {
+        $params['userid'] = config::USER_ID;
+        $params['productid'] = config::product_id[$card_type][$amount];
+        $params['productType'] = '1';
+        $params['price'] = $amount;
+        $params['num'] = 1;
+        $params['mobile'] = $phone;
+        $params['spordertime'] = date("YmdHis");
+        $params['sporderid'] = $order_sn;
+        $params['back_url'] = config::NOTIFY_URL;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params)
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $card_type, $amount, $order_sn);
+        if(empty($params['productid'])) {
+            return [false, '商品编号获取失败', false];
+        }
+        $params['operator'] = config::operator[$card_type];
+        $region = $this->getPhoneInfo($card_no);
+        if($region === false) {
+            return [false, '归属地获取失败', false];
+        }
+
+        $params['region'] = $region;
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params);
+
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            }
+            $resultno = intval($resp['resultno']);
+            if (in_array($resultno, [0,2])) {
+                return [true, $resp['orderid'], false];
+            } else {
+                return [false, $resp['message'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['sporderid'] = $refill_info['order_sn'];
+        $params['userid'] = config::USER_ID;
+
+        $resp = http_request(config::QUERY_URL, $params);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            }
+            $resultno = intval($resp['resultno']);
+            if ($resultno === 1) {
+                $order_state = ORDER_STATE_SUCCESS;
+                $updata['official_sn'] = $resp['remark1'];
+                Model('refill_order')->edit($refill_info['order_id'], $updata);
+            } elseif ($resultno === 9) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif (in_array($resultno, [0,2])) {
+                $order_state = ORDER_STATE_SEND;
+            } else {
+                return [false, $resp['message']];
+            }
+            return [true, $order_state];
+        }
+    }
+
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&productid={$params['productid']}&price={$params['price']}&num={$params['num']}&mobile={$params['mobile']}&spordertime={$params['spordertime']}";
+        $content .= "&sporderid={$params['sporderid']}&key={$key}";
+        return md5($content);
+    }
+
+    public function xmlToArray($xml)
+    {
+        //禁止引用外部xml实体
+        libxml_disable_entity_loader(true);
+        $xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
+        $val = json_decode(json_encode($xmlstring), true);
+
+        return $val;
+    }
+
+    private function getPhoneInfo($phone)
+    {
+        $url = "https://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel={$phone}";
+        $resp = http_request($url);  //获取API返回 的数据
+        $resp = mb_convert_encoding($resp, 'UTF-8', 'UTF-8,GBK,GB2312,BIG5'); //解决中文乱码
+
+        $datas = explode('=', $resp);
+        if(count($datas) == 2)
+        {
+            $body = trim($datas[1]);
+            if(preg_match_all("/(\w+):'([^']+)/", $body, $m)) {
+                $res = array_combine($m[1], $m[2]);
+                return $this->formatProvince($res['province']);
+            }
+        }
+        return false;
+    }
+
+    public 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;
+    }
 }

+ 38 - 18
helper/refill/api/xyz/yunling/config.php

@@ -1,19 +1,39 @@
-<?php
-
-
-namespace refill\yunling;
-
-use mtopcard;
-class config
-{
-    const ORDER_URL = 'http://39.101.180.197:8177/soft/onlinepay.do';
-    const QUERY_URL= 'http://39.101.180.197:8177/soft/searchpay.do';
-    const USER_ID= '10073505';
-    const KEY = 'FA302267C7EC5E3840264E6044E48CD1';
-    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_yunling.php";
-    const operator = [
-        mtopcard\ChinaMobileCard  => '移动',
-        mtopcard\ChinaUnicomCard  => '联通',
-        mtopcard\ChinaTelecomCard => '电信'
-    ];
+<?php
+
+
+namespace refill\yunling;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://121.89.243.74:9086/onlinepay.do';
+    const QUERY_URL= 'http://121.89.243.74:9086/searchpay.do';
+    const USER_ID= '10002504';
+    const KEY = 'HdxxWScBF6aYykbB33r8S5CQcS5myYZZ';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_yunling.php";
+    const operator = [
+        mtopcard\ChinaMobileCard  => '移动',
+        mtopcard\ChinaUnicomCard  => '联通',
+        mtopcard\ChinaTelecomCard => '电信'
+    ];
+    const product_id = [
+        mtopcard\ChinaMobileCard => [
+            30 => '30000000908',
+            50 => '30000000909',
+            100 => '30000000910',
+            200 => '30000000911'
+        ],
+        mtopcard\ChinaUnicomCard => [
+            30 => '30000000731',
+            50 => '30000000732',
+            100 => '30000000733',
+            200 => '30000000992'
+        ],
+        mtopcard\ChinaTelecomCard => [
+            30 => '30000000736',
+            50 => '30000000737',
+            100 => '30000000738',
+            200 => '30000000739'
+        ],
+    ];
 }

+ 13 - 0
helper/refill/api/xyz/yunling/新系椰子通代理信息.txt

@@ -0,0 +1,13 @@
+代理平台:
+代理登录地址:http://121.89.243.74:7080/login.jsp
+登录账号:yezi
+登录密码:yezi123
+
+
+
+接口使用:
+用户编号(userid):10002504
+秘钥(key):HdxxWScBF6aYykbB33r8S5CQcS5myYZZ
+余额查询地址:http://121.89.243.74:9086/searchbalance.do
+接口充值地址:http://121.89.243.74:9086/onlinepay.do
+主动查单地址:http://121.89.243.74:9086/searchpay.do

BIN
helper/refill/api/xyz/yunling/新系统通信充值接口 - 副本.doc


+ 4 - 4
mobile/refill_yunling.php

@@ -1,4 +1,4 @@
-<?php
-
-refill\util::push_notify('yunling',$_POST);
-echo ('SUCCESS');
+<?php
+
+refill\util::push_notify('yunling',$_POST);
+echo ('OK');

+ 5 - 5
test/TestRefill.php

@@ -631,11 +631,11 @@ class TestRefill extends TestCase
     public function testYunlingPhone()
     {
         $providers = new refill\yunling\RefillPhone([]);
-        $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
-//        $resp = $providers->query(['order_sn' => '40241617777847227476']);
-//        $data = '{"userid":"10073505","sporderid":"7761230671186470456129","orderid":"8BE7B813A399AD2173505","resultno":"1","merchantsubmittime":"20210408084145","ordermoney":"28.68","verifystring":"28711bba302fadf95387b1d863d47a98","sign":"2e49e034ead64880f4fd605e378dd42b","supnumber":"510568880044465061"}';
-//        $input = json_decode($data, true);
-//        refill\RefillFactory::instance()->notify('yunling',$input);
+//        $resp = $providers->add(18074608795, 6, 30, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '73791623147517199719']);
+        $data = '{"orderid":"EAF21060818183032772","sporderid":"73791623147517199719","userid":"10002504","merchantsubmittime":"20210608181912","resultno":"1","parvalue":"30","remark1":"1000000083421060818483137636","payno":"1000000083421060818483137636","fundbalance":"-28.59","sign":"8D77517AC3905ED88BF79EE789A5FA86"}';
+        $input = json_decode($data, true);
+        refill\RefillFactory::instance()->notify('yunling',$input);
     }
 
     public function testZhongstPhone()