From e88aac5bbb0b7e5b586b9427da06ab000ec3c20c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= <zoujingli@qq.com>
Date: Fri, 21 Apr 2017 16:55:38 +0800
Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E5=BE=AE=E4=BF=A1=E5=85=B3?=
 =?UTF-8?q?=E9=94=AE=E5=AD=97=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 application/wechat/controller/Keys.php  | 23 +++++++++++++++++++++++
 application/wechat/view/keys.index.html | 18 ++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/application/wechat/controller/Keys.php b/application/wechat/controller/Keys.php
index 754ae41b3..0dd397aff 100644
--- a/application/wechat/controller/Keys.php
+++ b/application/wechat/controller/Keys.php
@@ -95,6 +95,29 @@ class Keys extends BasicAdmin {
         $this->error("关键字删除失败,请稍候再试!");
     }
 
+
+    /**
+     * 关键字禁用
+     */
+    public function forbid() {
+        if (DataService::update($this->table)) {
+            $this->success("关键字禁用成功!", '');
+        } else {
+            $this->error("关键字禁用失败,请稍候再试!");
+        }
+    }
+
+    /**
+     * 关键字禁用
+     */
+    public function resume() {
+        if (DataService::update($this->table)) {
+            $this->success("关键字启用成功!", '');
+        } else {
+            $this->error("关键字启用失败,请稍候再试!");
+        }
+    }
+
     /**
      * 关注默认回复
      */
diff --git a/application/wechat/view/keys.index.html b/application/wechat/view/keys.index.html
index 31dc7adce..d492e0c3b 100644
--- a/application/wechat/view/keys.index.html
+++ b/application/wechat/view/keys.index.html
@@ -16,6 +16,7 @@
             <th class="text-center">回复类型</th>
             <th class="text-center">回复内容</th>
             <th class="text-center">更新时间</th>
+            <th class="text-center">状态</th>
             <th class="text-center">操作</th>
         </tr>
         </thead>
@@ -50,6 +51,13 @@
                 {/if}
             </td>
             <td class="text-center">{$vo.create_at}</td>
+            <td class='text-center'>
+                {if $vo.status eq 0}
+                <span>已禁用</span>
+                {elseif $vo.status eq 1}
+                <span style="color:#090">使用中</span>
+                {/if}
+            </td>
             <td class='text-center nowrap'>
 
                 {if auth("$classuri/edit")}
@@ -57,6 +65,16 @@
                 <a data-open='{:url("edit")}?id={$vo.id}'>编辑</a>
                 {/if}
 
+                {if $vo.status eq 1 and auth("$classuri/forbid")}
+                <span class="text-explode">|</span>
+                <a data-update="{$vo.id}" data-field='status' data-value='0' data-action='{:url("$classuri/forbid")}'
+                   href="javascript:void(0)">禁用</a>
+                {elseif auth("$classuri/resume")}
+                <span class="text-explode">|</span>
+                <a data-update="{$vo.id}" data-field='status' data-value='1' data-action='{:url("$classuri/resume")}'
+                   href="javascript:void(0)">启用</a>
+                {/if}
+
                 {if auth("$classuri/del")}
                 <span class="text-explode">|</span>
                 <a data-update="{$vo.id}" data-field='delete' data-action='{:url("del")}'