where(['uid'=>$this->auth->id])->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(); } } $this->success('',$like); } /** * 我申请的 */ public function weApply(){ $uid = $this->auth->id; $data = Apply::all(['uid'=>$uid]); $this->success('',$data); } /** * 系统通知 */ public function systemMessages(){ $uid = $this->auth->id; $systemMessages = SystemMessages::all(['uid'=>$uid,'type'=>1,'status'=>1]); foreach ($systemMessages as $v){ $v->save(['isread'=>1]); } $this->success('',$systemMessages); } }