Bläddra i källkod

取消点赞,删消息

lizhen 3 dagar sedan
förälder
incheckning
e28a4ca13b
2 ändrade filer med 4 tillägg och 46 borttagningar
  1. 0 46
      application/api/controller/Message.php
  2. 4 0
      application/api/controller/Topicdongtai.php

+ 0 - 46
application/api/controller/Message.php

@@ -13,52 +13,6 @@ class Message extends Api
     protected $noNeedRight = ['*'];
 
 
-    //个人消息全部改为已读
-    public function message_read(){
-        Db::startTrans();
-        //读取即为已读
-        $map = [
-            'user_id'  => $this->auth->id,
-            'status'   => 0,
-        ];
-        $rs = Db::name('message')->where($map)->update(['status'=>1]);
-        if($rs === false){
-            Db::rollback();
-            $this->error('操作失败');
-        }
-
-
-        //系统消息
-        //全部未读
-        $rs = Db::name('user_messagesys')->where('user_id',$this->auth->id)->delete();
-        if($rs === false){
-            Db::rollback();
-            $this->error('操作失败');
-        }
-
-        //循环全部已读
-        $list = Db::name('message_sys')->column('id');
-        if(!empty($list)){
-            $newall = [];
-            foreach($list as $key => $msg_id){
-                $newall[] = [
-                    'user_id' => $this->auth->id,
-                    'msg_id' => $msg_id,
-                ];
-            }
-            if(!empty($newall)){
-                $rs = Db::name('user_messagesys')->insertAll($newall);
-                if($rs === false){
-                    Db::rollback();
-                    $this->error('操作失败');
-                }
-            }
-        }
-
-        Db::commit();
-        $this->success();
-    }
-
     //我的个人消息列表
     public function mylist(){
         $list = Db::name('message')

+ 4 - 0
application/api/controller/Topicdongtai.php

@@ -206,6 +206,10 @@ class Topicdongtai extends Api
         if($check){
             Db::name('topic_dongtai_good')->where($where)->delete();
             $down = Db::name('topic_dongtai')->where('id',$id)->setDec('goodnum');
+
+            //删除消息通知
+            Db::name('message')->where('dt_id',$id)->where('user_id',$this->auth->id)->where('infotype','dongtai_good')->delete();
+
             $this->success('已取消点赞');
         }else{