qifengquan 1 anno fa
parent
commit
9e7f1bfcfe

+ 8 - 9
application/api/controller/Information.php

@@ -52,17 +52,16 @@ class Information extends Api
      */
     public function eachLike(){
         $where = [
-            'type'=>1,
             'uid'=>$this->auth->id
         ];
-        $like = Like::with('like')->where($where)->order('id','desc')->select();
-        foreach ($like as $k=>&$v){
-            if($v['like']==null){
-                unset($like[$k]);
-            }else{
-                $v['like_user'] = User::where('id',$v['like']['uid'])->field('id,id_authentication,avatar,createtime,nickname,username')->find();
-            }
-        }
+        $like = LikeMutually::with('user')->where($where)->order('id','desc')->select();
+//        foreach ($like as $k=>&$v){
+//            if($v['like']==null){
+//                unset($like[$k]);
+//            }else{
+//                $v['like_user'] = User::where('id',$v['like']['uid'])->field('id,id_authentication,avatar,createtime,username')->find();
+//            }
+//        }
         LikeMutually::read($like);
         $this->success('',$like);
     }

+ 1 - 1
application/common/model/LikeMutually.php

@@ -7,7 +7,7 @@ use think\Model;
 class LikeMutually extends Model
 {
     public function user(){
-        return $this->belongsTo('User','nid','id',[],'LEFT')->field('id,username');
+        return $this->belongsTo('User','nid','id',[],'LEFT')->field('id,id_authentication,avatar,createtime,username');
     }
 
     public static function read($arr){