lizhen_gitee 1 год назад
Родитель
Сommit
f4d178431e

+ 2 - 4
application/api/controller/Message.php

@@ -15,8 +15,8 @@ class Message extends Api
     //消息页信息
     public function index(){
         $rs = [
-            'msg_first'      => Db::name('message')->where('user_id',$this->auth->id)->order('status asc,id desc')->find(),
-            'msg_unread_num' => Db::name('message')->where('user_id',$this->auth->id)->where('infotype','neq','newfriend')->where('status',0)->count(),
+            'msg_first'      => Db::name('message')->where('user_id',$this->auth->id)->order('id desc')->find(),
+            'msg_unread_num' => Db::name('message')->where('user_id',$this->auth->id)->where('status',0)->count(),
             'msgsys_first'   => Db::name('message_sys')->order('id desc')->find(),
         ];
 
@@ -35,7 +35,6 @@ class Message extends Api
         $map = [
             'user_id'  => $this->auth->id,
             'status'   => 0,
-            'infotype' => ['neq','newfriend']
         ];
         $rs = Db::name('message')->where($map)->update(['status'=>1]);
         if($rs === false){
@@ -83,7 +82,6 @@ class Message extends Api
         $map = [
             'user_id' => $this->auth->id,
             'status' => 0,
-            'infotype' => ['neq','newfriend']
         ];
         Db::name('message')->where($map)->update(['status'=>1]);
         $this->success('success',$list);

+ 3 - 2
application/api/controller/Userfollow.php

@@ -152,7 +152,7 @@ class Userfollow extends Api
             ->join('user user','user.id = msg.infotype_id','LEFT')
             ->join('user_wallet uw','user.id = uw.user_id','LEFT')
             ->field('msg.id as msg_id,user.id,user.username,user.nickname,user.avatar,user.bio,user.birthday,user.gender,user.attribute,uw.vip_endtime')
-            ->where(['msg.infotype'=>'newfriend','msg.user_id'=>$this->auth->id,'msg.status'=>0])
+            ->where(['msg.infotype'=>'newfriend','msg.user_id'=>$this->auth->id,'msg.audit_status'=>0])
             ->where('msg.infotype_id','NOT IN',$my_follow_uids)
             ->order('msg.id desc')->autopage()->select();
 
@@ -177,7 +177,7 @@ class Userfollow extends Api
         $id = input('msg_id',0);
 
         $msg_info = Db::name('message')->where('id',$id)->find();
-        Db::name('message')->where('id',$id)->update(['status'=>1]);
+        Db::name('message')->where('id',$id)->update(['audit_status'=>1]);
 
         //拒绝给个消息
         if($msg_info['infotype'] == 'newfriend' && !empty($msg_info['infotype_id'])){
@@ -246,6 +246,7 @@ class Userfollow extends Api
 
         //我从好友审核列表过来的,我又回关了
         if(!empty($msg_id)){
+            Db::name('message')->where('id',$id)->update(['audit_status'=>1]);
             $msg_id = \app\common\model\Message::addMessage($follow_uid,'好友申请已通过',$this->auth->nickname.'同意了您的好友请求');
         }