Browse Source

动态修改,取消置顶等

lizhen_gitee 1 year ago
parent
commit
978f85bea7

+ 15 - 0
application/admin/controller/Topicdongtai.php

@@ -90,6 +90,21 @@ class Topicdongtai extends Backend
     }
 
     /**
+     * 取消置顶
+     */
+    public function untoptime(){
+
+        if ($this->request->isAjax()) {
+            $id = input('id',0);
+
+            $rs = Db::name('topic_dongtai')->where('id',$id)->update(['toptime'=>0]);
+
+            $this->success('完成');
+        }
+
+    }
+
+    /**
      * 删除
      */
     public function del($ids = "")

+ 1 - 0
application/admin/view/topicdongtai/index.html

@@ -26,6 +26,7 @@
                            data-operate-edit="{:$auth->check('topicdongtai/edit')}" 
                            data-operate-del="{:$auth->check('topicdongtai/del')}" 
                            data-operate-toptime="{:$auth->check('topicdongtai/toptime')}"
+                           data-operate-untoptime="{:$auth->check('topicdongtai/untoptime')}"
                            width="100%">
                     </table>
                 </div>

+ 1 - 1
application/api/controller/Topicdongtai.php

@@ -512,7 +512,7 @@ class Topicdongtai extends Api
         $msg_id = \app\common\model\Message::addMessage($msg_user_id,$msg_title,$msg_content,'dongtai_answer',$infotype_id);
 
         Db::commit();
-        $this->success('评成功');
+        $this->success('评成功');
     }
 
     //对评论点赞

+ 19 - 0
public/assets/js/backend/topicdongtai.js

@@ -58,6 +58,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     url:'topicdongtai/toptime/id/{ids}?dialog=1',
                                     target:'_self',
                                     refresh:true,
+                                },
+                                {
+                                    name:'untoptime',
+                                    text:'取消置顶',
+                                    title:'取消置顶',
+                                    icon:'fa fa-exclamation-circle',
+                                    classname:'btn btn-xs btn-info btn-ajax',
+                                    url:'topicdongtai/untoptime/id/{ids}?dialog=1',
+                                    target:'_self',
+                                    hidden:function(row){
+                                        if(row.toptime > 0){
+                                            return false;
+                                        }
+                                        return true;
+                                    },
+                                    refresh:true,
                                 }
                             ],
                             events: Table.api.events.operate, formatter: Table.api.formatter.operate}
@@ -71,6 +87,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         toptime: function () {
             Controller.api.bindevent();
         },
+        untoptime: function () {
+            Controller.api.bindevent();
+        },
         add: function () {
             Controller.api.bindevent();
         },