12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use app\common\model\Apply;
- use app\common\model\Like;
- use app\common\model\SystemMessages;
- use app\common\model\User;
- /**
- * 消息
- */
- class Information extends Api
- {
- protected $noNeedRight = ['*'];
- protected $noNeedLogin = [''];
- /**
- * 消息
- */
- public function index(){
- }
- /**
- * 彼此喜欢
- */
- public function eachLike(){
- $like = Like::with('like')->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);
- }
- }
|