|
@@ -3,7 +3,10 @@
|
|
namespace app\api\controller;
|
|
namespace app\api\controller;
|
|
|
|
|
|
use app\common\controller\Api;
|
|
use app\common\controller\Api;
|
|
|
|
+use app\common\model\Apply;
|
|
use app\common\model\Like;
|
|
use app\common\model\Like;
|
|
|
|
+use app\common\model\SystemMessages;
|
|
|
|
+use app\common\model\User;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 消息
|
|
* 消息
|
|
@@ -11,20 +14,48 @@ use app\common\model\Like;
|
|
class Information extends Api
|
|
class Information extends Api
|
|
{
|
|
{
|
|
protected $noNeedRight = ['*'];
|
|
protected $noNeedRight = ['*'];
|
|
- protected $noNeedLogin = ['*'];
|
|
|
|
|
|
+ protected $noNeedLogin = [''];
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 消息
|
|
|
|
+ */
|
|
|
|
+ public function index(){
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 彼此喜欢
|
|
* 彼此喜欢
|
|
*/
|
|
*/
|
|
public function eachLike(){
|
|
public function eachLike(){
|
|
- $like = Like::with('like')->where(['uid'=>$this->auth->id])->select();
|
|
|
|
|
|
+ $like = Like::with('like')->where(['uid'=>$this->auth->id])->order('id','desc')->select();
|
|
foreach ($like as $k=>&$v){
|
|
foreach ($like as $k=>&$v){
|
|
if($v['like']==null){
|
|
if($v['like']==null){
|
|
unset($like[$k]);
|
|
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);
|
|
$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);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|