qifengquan 1 year ago
parent
commit
379e09c61f
2 changed files with 10 additions and 3 deletions
  1. 6 2
      application/api/controller/Information.php
  2. 4 1
      application/common/model/Apply.php

+ 6 - 2
application/api/controller/Information.php

@@ -27,7 +27,11 @@ class Information extends Api
      * 彼此喜欢
      */
     public function eachLike(){
-        $like = Like::with('like')->where(['uid'=>$this->auth->id])->order('id','desc')->select();
+        $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]);
@@ -42,7 +46,7 @@ class Information extends Api
      */
     public function weApply(){
         $uid = $this->auth->id;
-        $data = Apply::all(['uid'=>$uid]);
+        $data = Apply::all(['uid'=>$uid],['Nuser']);
         $this->success('',$data);
     }
     /**

+ 4 - 1
application/common/model/Apply.php

@@ -40,8 +40,11 @@ class Apply extends Model
         return $this->belongsTo('User','nid','id',[],"LEFT")/*->field('id,id_authentication,avatar,username,avatar')*/;
     }
     /**
-     *
+     * 被申请信息
      */
+    public function Nuser(){
+        return $this->belongsTo('User','nid','id',[],"LEFT")->field('id,id_authentication,avatar,username,avatar');
+    }
     public static function read($arr){
         foreach ($arr as $v){
             Apply::update(['is_read'=>1],['id'=>$v['id']]);