Explorar o código

Merge branch 'rcard' into rtest

ayHaru %!s(int64=4) %!d(string=hai) anos
pai
achega
fd9bb6a5c8

+ 8 - 0
data/model/card_key.model.php

@@ -106,6 +106,14 @@ class card_keyModel extends Model
                     ->update(['card_state' => FreezedCard, 'errmsg' => $errmsg, 'order_id' => 0]);
     }
 
+    public function manual_freeze($card_id,$errmsg = '')
+    {
+        //只有已经预留了的卡才可以重新回收使用。
+        return $this->where(['card_id' => $card_id, 'card_state' => UnusedCard])
+            ->lock(true)
+            ->update(['card_state' => FreezedCard, 'errmsg' => $errmsg, 'order_id' => 0]);
+    }
+
     public function unfreeze($card_id)
     {
         //只有已经预留了的卡才可以重新回收使用。

+ 15 - 0
helper/mtopcard/cards_helper.php

@@ -105,6 +105,21 @@ class cards_helper
             return false;
         }
     }
+    static public function manual_freeze($card_id,$err_msg='')
+    {
+        try {
+            $model = Model('card_key');
+            $trans = new trans_wapper($model, __METHOD__);
+            $ret = $model->manual_freeze($card_id,$err_msg);
+            $rows = $model->affected_rows();
+            $trans->commit();
+            return ($ret && $rows > 0);
+        } catch (Exception $e) {
+            Log::record("cards_helper::manual_freeze exception {$e}", Log::ERR);
+            $trans->rollback();
+            return false;
+        }
+    }
     static public function unfreeze($card_id)
     {
         try {

+ 1 - 1
helper/refill/api/lingzh/legou/config.php

@@ -15,5 +15,5 @@ class config
     const ExtHeaders = ['ContentType: application/x-www-form-urlencoded;charset=utf-8'];
 
     const ProductIDS = [mtopcard\ChinaMobileCard => 400002,mtopcard\ChinaUnicomCard => 400003,mtopcard\ChinaTelecomCard => 400004];
-    const StoreIDS = [42];
+    const StoreIDS = [43];
 }

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

@@ -38,7 +38,7 @@ class RefillPhone extends refill\IRefillPhone
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
             if($resp['code'] == 200 && $resp['result'] == 'success') {
-                return [true,$resp['result'], false];
+                return [true,'', false];
             }
             else {
                 return [false,$resp['info'], false];

+ 4 - 3
helper/refill/policy/quaility.php

@@ -52,19 +52,20 @@ class Quality
             else {
                 $org = self::ThirdNormal;
                 $qualities = $this->mQualities[$org];
+                $time_out = $this->mSpeeds[$org]['retry_timeout'];
             }
         }
         elseif(array_key_exists($quality,$this->mQualities)) {
             $org = $quality;
             $qualities = $this->mQualities[$quality];
-            $time_out = $this->mSpeeds[$org]['retry_timeout'];
+            [$sucdess,$setting_quality,$time_out] = $this->mMchctl->getCtls($mchid);
         }
         else {
             Log::record("find_quality: cannot find any quality",Log::DEBUG);
             return [0,[]];
         }
-
-        if(empty($time_out)) {
+        
+        if($time_out <= 0) {
             $time_out = $this->mSpeeds[$org]['retry_timeout'];
         }
 

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

@@ -29,7 +29,7 @@ class quality_ploy extends Quality
 
             self::SlowNormal => [self::Slow, self::Normal],
             self::ThirdNormal => [self::ThirdShop, self::Normal],
-            self::DefSuccess => [self::ThirdShop, self::CardKey, self::Normal, self::Quick]
+            self::DefSuccess => [self::ThirdShop, self::Normal, self::CardKey, self::Quick]
         ];
     }
 }

+ 5 - 86
shop/control/card_key.php

@@ -1,7 +1,5 @@
 <?php
 
-require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
-
 defined('InShopNC') or exit('Access Invalid!');
 
 class card_keycontrol extends BaseSellerControl
@@ -21,7 +19,6 @@ class card_keycontrol extends BaseSellerControl
             $card_type = $_POST['card_type'];
             $amount = $_POST['amount'];
             $goods = $this->goods($card_type);
-
             if (!in_array($amount, $goods)) {
                 showDialog('面值错误。', 'reload', 'error');
             }
@@ -45,7 +42,8 @@ class card_keycontrol extends BaseSellerControl
             $mod_card = Model('card_key');
             $res = $mod_card->addCards($inserts);
             if($res) {
-                showDialog('处理成功','index.php?act=card_key&op=list','succ');
+                $count = count($inserts);
+                showDialog("处理成功,成功添加卡密:{$count}张",'index.php?act=card_key&op=list','succ');
             }else{
                 showDialog('处理失败', 'reload', 'error');
             }
@@ -54,90 +52,11 @@ class card_keycontrol extends BaseSellerControl
         }
     }
 
-    public function listOp()
-    {
-        $mod_card = Model('card_key');
-        if(!empty($_GET['card_type'])) {
-            $condition['card_type'] = $_GET['card_type'];
-        }
-        if(!empty($_GET['card_no'])) {
-            $condition['card_no'] = $_GET['card_no'];
-        }
-        if(!empty($_GET['card_state'])) {
-            $condition['card_state'] = $_GET['card_state'];
-        }
-        $cards = $mod_card->getCardsList($condition);
-        $card_state_text = ['未使用', '暂时绑定', '已绑定'];
-        $card_type_texts = [1=>'中石油', 2=>'中石化', 4=>'中国移动', 5=>'中国联通', 6=>'中国电信'];
-        foreach ($cards as $key => $card) {
-            $cards[$key]['card_state_text'] = $card_state_text[$card['card_state']];
-            $cards[$key]['card_type_text'] = $card_type_texts[$card['card_type']];
-        }
-        Tpl::output('cards', $cards);
-        Tpl::output('show_page',$mod_card->showpage());
-        Tpl::showpage('card_key.list');
-    }
-
-    public function editOp()
-    {
-        $card_id = $_GET['card_id'] ?? $_POST['card_id'];
-        $mod_card = Model('card_key');
-        $card = $mod_card->getCards(['card_id' => $card_id]);
-        if(empty($card)){
-            showDialog('卡密不存在', 'reload', 'error');
-        }
-        $card = $card[0];
-        $card_state_text = ['未使用', '暂时绑定', '已绑定'];
-        $card_type_texts = [1=>'中石油', 2=>'中石化', 4=>'中国移动', 5=>'中国联通', 6=>'中国电信'];
-        $cards['card_state_text'] = $card_state_text[$card['card_state']];
-        $cards['card_type_text'] = $card_type_texts[$card['card_type']];
-        if (chksubmit()) {
-            $card_type = $_POST['card_type'];
-            $card_no = $_POST['card_no'];
-            $card_key = $_POST['card_key'];
-            $card_state = $_POST['card_state'];
-            if($card['card_state'] != 0) {
-                showDialog('此卡密已被绑定', 'reload', 'error');
-            }
-            if($card['card_state'] != 3 && !empty($card_state)){
-                showDialog('非锁定状态下,不可更改卡密使用状态', 'reload', 'error');
-            }
-            [$state , $msg] = $this->checkCardKey($card_no , $card_key, $card_type);
-            if($state == false) {
-                showDialog($msg, 'reload', 'error');
-            }
-            $check_card = $mod_card->getCards(['card_no' => $card_no , 'card_key' => $card_key , 'card_id' => ['neq' , $card_id]]);
-            if(!empty($check_card)) {
-                showDialog('此卡号和卡密已存在', 'reload', 'error');
-            }
-            $update['card_no'] = $card_no;
-            $update['card_key'] = $card_key;
-            $update['card_state'] = $card_state;
-            $res = $mod_card->where(['card_id' => $card_id])->update($update);
-            if($res) {
-                showDialog('处理成功','index.php?act=card_key&op=list','succ');
-            }else{
-                showDialog('处理失败', 'reload', 'error');
-            }
-        }
-        Tpl::output('card', $card);
-        Tpl::showpage('card_key.edit');
-    }
-
     private function goods($type)
     {
-        $result = refill\RefillFactory::instance()->goods();
-        $sorter = function (array $items) {
-            $ret = [];
-            foreach ($items as $key => $val) {
-                sort($val);
-                $ret[$key] = $val;
-            }
-            return $ret;
-        };
-
-        $result = $sorter($result);
-        return $result[$type];
+        global $config;
+        $type = mtopcard\scard_type($type);
+        return $config['refill_specs'][$type];
     }
 
     private function checkCardKey($card_no, $card_key, $card_type)

+ 174 - 0
shop/control/card_keylist.php

@@ -0,0 +1,174 @@
+<?php
+defined('InShopNC') or exit('Access Invalid!');
+
+require_once(BASE_HELPER_PATH . '/mtopcard/mtopcard.php');
+
+class card_keylistcontrol extends BaseSellerControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function listOp()
+    {
+        $mod_card = Model('card_key');
+        if (!empty($_GET['card_type'])) {
+            $condition['card_type'] = $_GET['card_type'];
+        }
+        if (!empty($_GET['card_no'])) {
+            $condition['card_no'] = $_GET['card_no'];
+        }
+        if (!empty($_GET['card_state'])) {
+            $condition['card_state'] = $_GET['card_state'];
+        }
+        $cards = $mod_card->getCardsList($condition, 15);
+        $card_state_text = ['未使用', '充值中', '已使用', '冻结'];
+        $card_type_texts = [1 => '中石油', 2 => '中石化', 4 => '中国移动', 5 => '中国联通', 6 => '中国电信'];
+        foreach ($cards as $key => $card) {
+            $cards[$key]['card_state_text'] = $card_state_text[$card['card_state']];
+            $cards[$key]['card_type_text'] = $card_type_texts[$card['card_type']];
+        }
+        Tpl::output('cards', $cards);
+        Tpl::output('show_page', $mod_card->showpage());
+        Tpl::showpage('card_key.list');
+    }
+
+    public function statsOp()
+    {
+        $condition = [];
+        if (!empty($_GET['card_state'])) {
+            $condition['card_state'] = $_GET['card_state'];
+        }
+        $counts = Model('')->table('card_key')
+            ->field('count(*) as card_count, card_type, amount')
+            ->where($condition)
+            ->group('card_type,amount')
+            ->select();
+        $card_count = 0;
+        $card_type_texts = [1 => '中石油', 2 => '中石化', 4 => '中国移动', 5 => '中国联通', 6 => '中国电信'];
+        $stats = [];
+        foreach ($counts as $key => $count) {
+            $card_count += $count['card_count'];
+            $count['card_type_text'] = $card_type_texts[$count['card_type']];
+            $count['amount'] = intval($count['amount']);
+            $stats[$count['card_type']][] = $count;
+        }
+        Tpl::output('card_count', $card_count);
+        Tpl::output('stats', $stats);
+        Tpl::showpage('card_key.stats');
+    }
+
+    public function editOp()
+    {
+        $card_id = $_GET['card_id'] ?? $_POST['card_id'];
+        $mod_card = Model('card_key');
+        $card = $mod_card->getCards(['card_id' => $card_id]);
+        if (empty($card)) {
+            showDialog('卡密不存在', 'reload', 'error');
+        }
+        if ($card['card_state'] != mtopcard\FreezedCard && !empty($card_state)) {
+            showDialog('非冻结状态下,不可更改卡密使用状态', 'reload', 'error');
+        }
+        $card = $card[0];
+        $card_state_text = ['未使用', '暂时绑定', '已绑定', '冻结'];
+        $card_type_texts = [1 => '中石油', 2 => '中石化', 4 => '中国移动', 5 => '中国联通', 6 => '中国电信'];
+        $cards['card_state_text'] = $card_state_text[$card['card_state']];
+        $cards['card_type_text'] = $card_type_texts[$card['card_type']];
+        if (chksubmit()) {
+            $card_type = $_POST['card_type'];
+            $card_no = $_POST['card_no'];
+            $card_key = $_POST['card_key'];
+            $unfreeze = empty($_POST['unfreeze']) ? false : true;
+
+            [$state, $msg] = $this->checkCardKey($card_no, $card_key, $card_type);
+            if ($state == false) {
+                showDialog($msg, 'reload', 'error');
+            }
+            $check_card_no = $mod_card->getCards(['card_no' => $card_no, 'card_id' => ['neq', $card_id]]);
+            $check_card_key = $mod_card->getCards(['card_key' => $card_key, 'card_id' => ['neq', $card_id]]);
+            if (!empty($check_card_no) || !empty($check_card_key)) {
+                showDialog('此卡号或卡密已存在', 'reload', 'error');
+            }
+            $update['card_no'] = $card_no;
+            $update['card_key'] = $card_key;
+
+            try {
+                $trans = new trans_wapper($mod_card, __METHOD__);
+                $res = $mod_card->where(['card_id' => $card_id])->update($update);
+                $unfreeze_resp = true;
+                if ($unfreeze == true) {
+                    $unfreeze_resp = mtopcard\cards_helper::unfreeze($card_id);
+                }
+                if ($res && $unfreeze_resp) {
+                    $trans->commit();
+                    showDialog('处理成功', 'index.php?act=card_keylist&op=list', 'succ');
+                } else {
+                    $trans->rollback();
+                    showDialog('处理失败', 'reload', 'error');
+                }
+            } catch (Exception $e) {
+                $trans->rollback();
+                showDialog('处理失败', 'reload', 'error');
+            }
+        }
+        Tpl::output('card', $card);
+        Tpl::showpage('card_key.edit');
+    }
+
+    public function editStateOp()
+    {
+        $card_id = $_GET['card_id'] ?? $_POST['card_id'];
+        $mod_card = Model('card_key');
+        $card = $mod_card->getCards(['card_id' => $card_id]);
+        if (empty($card)) {
+            showDialog('卡密不存在', 'reload', 'error');
+        }
+        if ($card['card_state'] != mtopcard\UnusedCard) {
+            showDialog('只有未使用的卡密可冻结', 'reload', 'error');
+        }
+
+        $res = mtopcard\cards_helper::manual_freeze($card_id, '手动冻结');
+        if ($res) {
+            showDialog('处理成功', 'index.php?act=card_keylist&op=list', 'succ');
+        } else {
+            showDialog('处理失败', 'reload', 'error');
+        }
+    }
+
+    private function checkCardKey($card_no, $card_key, $card_type)
+    {
+        switch ($card_type) {
+//            case 1:
+//                $card_no_check = '/^[0-9a-zA-Z]{17}$/';
+//                $card_key_check = '/^[0-9a-zA-Z]{20}$/';
+//                break;
+            case 2:
+                $card_no_check = '/^[0-9a-zA-Z]{16}$/';
+                $card_key_check = '/^[0-9a-zA-Z]{20}$/';
+                break;
+            case 4:
+                $card_no_check = '/^[0-9a-zA-Z]{17}$/';
+                $card_key_check = '/^[0-9a-zA-Z]{18}$/';
+                break;
+            case 5:
+                $card_no_check = '/^[0-9a-zA-Z]{15}$/';
+                $card_key_check = '/^[0-9a-zA-Z]{19}$/';
+                break;
+            case 6:
+                $card_no_check = '/^[0-9a-zA-Z]{19}$/';
+                $card_key_check = '/^[0-9a-zA-Z]{18}$/';
+                break;
+            default:
+                return [false, '卡种类型错误'];
+                break;
+        }
+        if (!preg_match($card_no_check, $card_no, $matches)) {
+            return [false, "卡号:{$card_no}卡密:{$card_key},卡号验证错误"];
+        }
+        if (!preg_match($card_key_check, $card_key, $matches)) {
+            return [false, "卡号:{$card_no}卡密:{$card_key},卡密验证错误"];
+        }
+        return [true, 'success'];
+    }
+}

+ 2 - 1
shop/control/control.php

@@ -1054,7 +1054,8 @@ class BaseSellerControl extends Control {
                 array('name' => '关联版式', 'act'=>'store_plate', 'op'=>'index'),
                 array('name' => '商品规格', 'act' => 'store_spec', 'op' => 'index'),
                 array('name' => '图片空间', 'act'=>'store_album', 'op'=>'album_cate'),
-                array('name' => '卡密管理', 'act'=>'card_key', 'op'=>'list')
+                array('name' => '卡密导入', 'act'=>'card_key', 'op'=>'index'),
+                array('name' => '卡密管理', 'act'=>'card_keylist', 'op'=>'list')
             )),
             'order' => array('name' => '订单物流', 'child' => array(
                 array('name' => '实物交易订单', 'act'=>'store_order', 'op'=>'index'),

+ 24 - 25
shop/templates/default/seller/card_key.edit.php

@@ -21,14 +21,22 @@
   text-align: left;
   margin-left: 70px;
 }
+.bottom .submit {
+  min-width: 70px;
+  height: 31px;
+  line-height: 31px;
+}
+#thawBtn {
+  border-color: #fa803b #fa803b #fa803b #fa803b;
+  background-color: #fa803b;
+}
 </style>
 <?php defined('InShopNC') or exit('Access Invalid!'); ?>
 
 <div class="tabmenu">
     <ul class="tab pngFix" id="tab">
-        <li class="normal"><a target="" href="<?php echo urlShop('card_key', 'list'); ?>">卡密列表</a></li>
-        <li class="normal" id="phoneCard"><a target="" href="<?php echo urlShop('card_key', 'index'); ?>">手机卡卡密</a></li>
-        <li class="normal" id="oilCard"><a target="" href="<?php echo urlShop('card_key', 'oil_index'); ?>">油卡卡密</a>
+        <li class="normal"><a target="" href="<?php echo urlShop('card_keylist', 'list'); ?>">卡密列表</a></li>
+        <li class="normal"><a target="" href="<?php echo urlShop('card_keylist', 'stats'); ?>">卡密统计</a></li>
         <li class="active"><a target="" href="#">卡密编辑</a></li>
         </li>
     </ul>
@@ -38,39 +46,25 @@
     <input type="hidden" name="form_submit" value="ok" />
       <input type="hidden" name="card_id" value="<?php echo $output['card']['card_id']?>" />
       <input type="hidden" name="card_type" value="<?php echo $output['card']['card_type']?>" />
+      <input id="unfreeze" type="hidden" name="unfreeze" value="" />
     <dl>
       <dt>卡号:</dt>
       <dd>
-        <input type="text" name="card_no" value="<?php echo $output['card']['card_no']?>" <?php if($output['card']['card_state'] != 0){ echo 'disabled';}?>>
+        <input type="text" name="card_no" value="<?php echo $output['card']['card_no']?>" <?php if($output['card']['card_state'] != 3){ echo 'disabled';}?>>
         <span class="error_tip">提示信息</span>
       </dd>
     </dl>
     <dl>
       <dt>卡密:</dt>
       <dd>
-        <input type="text" name="card_key" value="<?php echo $output['card']['card_key']?>" <?php if($output['card']['card_state'] != 0){ echo 'disabled';}?>>
+        <input type="text" name="card_key" value="<?php echo $output['card']['card_key']?>" <?php if($output['card']['card_state'] != 3){ echo 'disabled';}?>>
         <span class="error_tip">提示信息</span>
       </dd>
     </dl>
-    <dl>
-      <dt>卡密状态:</dt>
-      <dd>
-        <label>
-          <input type="radio" name="card_state" value="0" <?php if ($output['card']['card_state'] == 0) { ?>checked="checked"<?php } ?>>
-          未使用
-        </label>
-        <label>
-          <input type="radio" name="card_state" value="1" <?php if ($output['card']['card_state'] == 1) { ?>checked="checked"<?php } ?>>
-          暂时绑定
-        </label>
-        <label>
-          <input type="radio" name="card_state" value="2" <?php if ($output['card']['card_state'] == 2) { ?>checked="checked"<?php } ?>>
-          已绑定
-        </label>
-      </dd>
-    </dl>
+
     <div class="bottom">
-      <label class="submit-border" id="btn"><input type="submit" class="submit" value="确认提交" /></label>
+        <label class="submit-border" id="btn" style="margin-right:20px"><input type="submit" class="submit" value="提交" /></label>
+      <label class="submit-border" id="thawBtn"><input type="submit" class="submit" value="提交并解冻" style="background-color:#fa803b;" /></label>
     </div>
   </form>
 </div>
@@ -209,8 +203,13 @@
       }
     }
   })
-$('form').submit(function() {
-  // $('#btn').click(function() {
+// $('form').submit(function() {
+  $('#btn').click(function() {
+    // $('#unfreeze').val(false)
+    return isTrue
+  })
+  $('#thawBtn').click(function() {
+    $('#unfreeze').val(true)
     return isTrue
   })
 </script>

+ 6 - 7
shop/templates/default/seller/card_key.form.php

@@ -138,7 +138,6 @@
 </style>
 <div class="tabmenu">
     <ul class="tab pngFix" id="tab">
-        <li class="normal"><a target="" href="<?php echo urlShop('card_key', 'list'); ?>">卡密列表</a></li>
         <li class="active" id="phoneCard"><a target="" href="<?php echo urlShop('card_key', 'index'); ?>">手机卡卡密</a></li>
         <li class="normal" id="oilCard"><a target="" href="<?php echo urlShop('card_key', 'oil_index'); ?>">油卡卡密</a></li>
     </ul>
@@ -297,7 +296,7 @@
       regSplitArr = textSplitArr.map(function(item,idx) {
         item = item.replace(/\s+/ig," ")
         if (item.length != 36) {
-          layer.msg('请按规则正确的移动卡号+卡密');
+          layer.msg('请按规则正确的移动卡号+卡密');
           isTrue = false
           return 
         } else {
@@ -320,7 +319,7 @@
       regSplitArr = textSplitArr.map(function(item,idx) {
         item = item.replace(/\s+/ig," ")
         if (item.length != 35) {
-          layer.msg('请按规则正确的联通卡号+卡密');
+          layer.msg('请按规则正确的联通卡号+卡密');
           isTrue = false
           return isTrue
         } else {
@@ -343,7 +342,7 @@
       regSplitArr = textSplitArr.map(function(item,idx) {
         item = item.replace(/\s+/ig," ")
         if (item.length != 38) {
-          layer.msg('请按规则正确的电信卡号+卡密');
+          layer.msg('请按规则正确的电信卡号+卡密');
           isTrue = false
           return
         } else {
@@ -414,7 +413,7 @@
       regSplitArr = textSplitArr.map(function(item,idx) {
         item = item.replace(/\s+/ig," ")
         if (item.length != 36) {
-          layer.msg('请按规则正确的移动卡号+卡密');
+          layer.msg('请按规则正确的移动卡号+卡密');
           isTrue = false
           return 
         } else {
@@ -438,7 +437,7 @@
       regSplitArr = textSplitArr.map(function(item,idx) {
         item = item.replace(/\s+/ig," ")
         if (item.length != 35) {
-          layer.msg('请按规则正确的联通卡号+卡密');
+          layer.msg('请按规则正确的联通卡号+卡密');
           isTrue = false
           return
         } else {
@@ -462,7 +461,7 @@
       regSplitArr = textSplitArr.map(function(item,idx) {
         item = item.replace(/\s+/ig," ")
         if (item.length != 38) {
-          layer.msg('请按规则正确的电信卡号+卡密');
+          layer.msg('请按规则正确的电信卡号+卡密');
           isTrue = false
           return
         } else {

+ 28 - 11
shop/templates/default/seller/card_key.list.php

@@ -1,16 +1,21 @@
 <?php defined('InShopNC') or exit('Access Invalid!'); ?>
-
+<style>
+    .footTip {
+        padding-top: 0;
+        font-size: 14px;
+        font-weight: 700;
+    }
+</style>
 <div class="tabmenu">
     <ul class="tab pngFix" id="tab">
-        <li class="active"><a target="" href="<?php echo urlShop('card_key', 'list'); ?>">卡密列表</a></li>
-        <li class="normal" id="phoneCard"><a target="" href="<?php echo urlShop('card_key', 'index'); ?>">手机卡卡密</a></li>
-        <li class="normal" id="oilCard"><a target="" href="<?php echo urlShop('card_key', 'oil_index'); ?>">油卡卡密</a>
+        <li class="active"><a target="" href="#">卡密列表</a></li>
+        <li class="normal"><a target="" href="<?php echo urlShop('card_keylist', 'stats'); ?>">卡密统计</a></li>
         </li>
     </ul>
 </div>
 <form method="get" action="index.php">
     <table class="search-form">
-        <input type="hidden" name="act" value="card_key"/>
+        <input type="hidden" name="act" value="card_keylist"/>
         <input type="hidden" name="op" value="list"/>
         <tr>
             <td>&nbsp;</td>
@@ -29,8 +34,9 @@
                 <select name="card_state">
                     <option value=""><?php echo $lang['nc_please_choose']; ?></option>
                     <option value="0"<?php if (isset($_GET['type']) && $_GET['type'] == 0) { ?>selected="selected"<?php } ?>>未使用</option>
-                    <option value="1" <?php if ($_GET['type'] == 1) { ?>selected="selected"<?php } ?>>暂时绑定</option>
-                    <option value="2" <?php if ($_GET['type'] == 2) { ?>selected="selected"<?php } ?>>已绑定</option>
+                    <option value="1" <?php if ($_GET['type'] == 1) { ?>selected="selected"<?php } ?>>充值中</option>
+                    <option value="2" <?php if ($_GET['type'] == 2) { ?>selected="selected"<?php } ?>>已使用</option>
+                    <option value="3" <?php if ($_GET['type'] == 3) { ?>selected="selected"<?php } ?>>冻结</option>
                 </select>
             </td>
             <th>卡号</th>
@@ -52,7 +58,7 @@
         <th class="w100">卡密状态</th>
         <th class="w100">添加人</th>
         <th class="w100">添加时间</th>
-        <th class="w100">已绑定卡号</th>
+<!--        <th class="w100">已绑定卡号</th>-->
         <th class="w120"><?php echo $lang['nc_handle']; ?></th>
     </tr>
     </thead>
@@ -67,10 +73,16 @@
             <td><?php echo $val['card_state_text'];?></td>
             <td><?php echo $val['allocator'];?></td>
             <td><?php echo date('Y-m-d H:i:s', $val['add_time']); ?></td>
-            <td><?php echo $val['receive_card_no'];?></td>
+<!--            <td>--><?php //echo $val['receive_card_no'];?><!--</td>-->
             <td>
-                <a href="index.php?act=card_key&op=edit&card_id=<?php echo $val['card_id']; ?>">
+                <?php if(!in_array($val['card_state'] , [0,1,2])){ ?>
+                <a href="index.php?act=card_keylist&op=edit&card_id=<?php echo $val['card_id']; ?>">
                     编辑</a>
+                <?php }?>
+                <?php if($val['card_state'] == 0){ ?>
+                <a href="index.php?act=card_keylist&op=editState&card_id=<?php echo $val['card_id']; ?>">
+                    冻结</a>
+                <?php }?>
             </td>
             </tr>
         <?php } ?>
@@ -85,10 +97,15 @@
     </tbody>
     <tfoot>
     <tr class="tfoot">
-        <td colspan="9" id="dataFuncs">
+        <td colspan="8" id="dataFuncs" style="padding: 0;">
             <div class="pagination"> <?php echo $output['show_page']; ?> </div>
         </td>
     </tr>
+    <tr>
+        <td colspan="8" class="footTip">
+            <span style="color: red">只有对卡密先进行冻结后,才可编辑。</span>
+        </td>
+    </tr>
     </tfoot>
 </table>
 <script src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.poshytip.min.js"></script>

+ 2 - 3
shop/templates/default/seller/card_key.oil.form.php

@@ -138,7 +138,6 @@
 </style>
 <div class="tabmenu">
     <ul class="tab pngFix" id="tab">
-        <li class="normal"><a target="" href="<?php echo urlShop('card_key', 'list'); ?>">卡密列表</a></li>
         <li class="normal" id="phoneCard"><a target="" href="<?php echo urlShop('card_key', 'index'); ?>">手机卡卡密</a></li>
         <li class="active" id="oilCard"><a target="" href="<?php echo urlShop('card_key', 'oil_index'); ?>">油卡卡密</a></li>
     </ul>
@@ -268,7 +267,7 @@
       regSplitArr = textSplitArr.map(function(item,idx) {
         item = item.replace(/\s+/ig," ")
         if (item.length != 37) {
-          layer.msg('请按规则正确的中石化卡号+卡密');
+          layer.msg('请按规则正确的中石化卡号+卡密');
           isTrue = false
           return
         } else {
@@ -335,7 +334,7 @@
       regSplitArr = textSplitArr.map(function(item,idx) {
         item = item.replace(/\s+/ig," ")
         if (item.length != 37) {
-          layer.msg('请按规则正确的中石化卡号+卡密');
+          layer.msg('请按规则正确的中石化卡号+卡密');
           isTrue = false
           return
         } else {

+ 90 - 0
shop/templates/default/seller/card_key.stats.php

@@ -0,0 +1,90 @@
+<?php defined('InShopNC') or exit('Access Invalid!'); ?>
+<style>
+    .search-form {
+        color: #000;
+    }
+    .count {
+        font-weight: 700;
+    }
+    .ncsc-default-table {
+        display: block;
+        padding: 0 20px;
+        font-size: 13px;
+    }
+    .ncsc-default-table tbody td {
+        text-align: left;
+        color: #040404;
+    }
+    .cardPassword {
+        width: 100px;
+    }
+    .money {
+        color: red;
+    }
+    .number {
+        color: #1890FF;
+    }
+</style>
+<div class="tabmenu">
+    <ul class="tab pngFix" id="tab">
+        <li class="normal"><a target="" href="<?php echo urlShop('card_keylist', 'list'); ?>">卡密列表</a></li>
+        <li class="active"><a target="" href="#">卡密统计</a></li>
+        </li>
+    </ul>
+</div>
+<form method="get" action="index.php">
+    <table class="search-form">
+        <input type="hidden" name="act" value="card_keylist"/>
+        <input type="hidden" name="op" value="stats"/>
+        <tr>
+            <td class="count">共<?php echo $output['card_count']?>张&nbsp;</td>
+            <th>卡密状态</th>
+            <td class="w100">
+                <select name="card_state">
+                    <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                    <option value="0"<?php if (isset($_GET['type']) && $_GET['type'] == 0) { ?>selected="selected"<?php } ?>>未使用</option>
+                    <option value="1" <?php if ($_GET['type'] == 1) { ?>selected="selected"<?php } ?>>充值中</option>
+                    <option value="2" <?php if ($_GET['type'] == 2) { ?>selected="selected"<?php } ?>>已使用</option>
+                    <option value="3" <?php if ($_GET['type'] == 3) { ?>selected="selected"<?php } ?>>冻结</option>
+                </select>
+            </td>
+            <td class="w70 tc"><label class="submit-border">
+                    <input type="submit" class="submit" value="搜索"/>
+                </label></td>
+        </tr>
+    </table>
+</form>
+<table class="ncsc-default-table">
+    <tbody>
+    <?php if (!empty($output['stats'])) { ?>
+        <?php foreach ($output['stats'] as $val) { ?>
+            <tr>
+            <td class="cardPassword"><?php echo $val[0]['card_type_text']?>卡密</td>
+            <td>
+            <?php foreach($val as $count) {?>
+                <span class="money"><?php echo $count['amount']?>元:</span><span class="number"><?php echo $count['card_count']?>张</span>&nbsp;&nbsp;&nbsp;
+            <?php }?>
+            </td>
+            </tr>
+        <?php } ?>
+    <?php } else { ?>
+        <tr>
+            <td colspan="20" class="norecord">
+                <div class="warning-option"><i
+                            class="icon-warning-sign"></i><span><?php echo $lang['no_record']; ?></span></div>
+            </td>
+        </tr>
+    <?php } ?>
+    </tbody>
+    <tfoot>
+    <tr class="tfoot">
+        <td colspan="9" id="dataFuncs">
+            <div class="pagination"> <?php echo $output['show_page']; ?> </div>
+        </td>
+    </tr>
+    </tfoot>
+</table>
+<script src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.poshytip.min.js"></script>
+<script src="<?php echo SHOP_RESOURCE_SITE_URL; ?>/js/store_goods_list.js"></script>
+<script>
+</script>