...
|
...
|
@@ -282,14 +282,57 @@ class User extends Api |
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1599017563",
|
|
|
"data": "暂不登录提示内容" //暂不登录提示内容
|
|
|
"time": "1602813642",
|
|
|
"data": {
|
|
|
"id": 15,
|
|
|
"group_id": 1, //身份:0=个人用户,1=企业用户
|
|
|
"username": "",
|
|
|
"nickname": "", //真实姓名
|
|
|
"password": "743fee718194570689974bad08666a56",
|
|
|
"salt": "UDnPtj",
|
|
|
"email": "",
|
|
|
"mobile": "15133120361",
|
|
|
"avatar": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgaGVpZ2h0PSIxMDAiIHdpZHRoPSIxMDAiPjxyZWN0IGZpbGw9InJnYigxNjAsMjI5LDE3OSkiIHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIj48L3JlY3Q+PHRleHQgeD0iNTAiIHk9IjUwIiBmb250LXNpemU9IjUwIiB0ZXh0LWNvcHk9ImZhc3QiIGZpbGw9IiNmZmZmZmYiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHRleHQtcmlnaHRzPSJhZG1pbiIgYWxpZ25tZW50LWJhc2VsaW5lPSJjZW50cmFsIj48L3RleHQ+PC9zdmc+",
|
|
|
"level": 1,
|
|
|
"gender": 0,
|
|
|
"birthday": null,
|
|
|
"bio": "",
|
|
|
"money": "0.00",
|
|
|
"score": 0,
|
|
|
"successions": 1,
|
|
|
"maxsuccessions": 3,
|
|
|
"prevtime": 1601340700,
|
|
|
"logintime": 1602242130,
|
|
|
"loginip": "127.0.0.1",
|
|
|
"loginfailure": 0,
|
|
|
"joinip": "127.0.0.1",
|
|
|
"jointime": 1599914736,
|
|
|
"createtime": 1599914736,
|
|
|
"updatetime": 1602242130,
|
|
|
"token": "",
|
|
|
"status": "normal",
|
|
|
"verification": {
|
|
|
"email": 0,
|
|
|
"mobile": 0
|
|
|
},
|
|
|
"pwd": null,
|
|
|
"card": null,
|
|
|
"sex": null,
|
|
|
"phone": null,
|
|
|
"work_address": null,
|
|
|
"image": "", //头像
|
|
|
"expirationtime": null,
|
|
|
"studynum": null,
|
|
|
"message_count": 1, //未读消息数量
|
|
|
"url": "/u/15"
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function index()
|
|
|
{
|
|
|
$user = $this->auth->getUser();
|
|
|
$user->image = !empty($user->image) ? cdnurl($user->image,true) : '';
|
|
|
$user->message_count = Message::where('user_id',$user->id)->where('is_read','0')->count();
|
|
|
$this->success('成功', $user);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -1039,7 +1082,7 @@ class User extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiWeigh (43)
|
|
|
* @ApiWeigh (44)
|
|
|
* @ApiTitle (消息)
|
|
|
* @ApiSummary (消息)
|
|
|
* @ApiMethod (POST)
|
...
|
...
|
@@ -1049,18 +1092,19 @@ class User extends Api |
|
|
* @ApiParams (name="page_num", type="inter", required=false, description="每页显示数据个数(默认10)")
|
|
|
*
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1600167138",
|
|
|
"data": {
|
|
|
"total": 1, //数据总数
|
|
|
"list": [{
|
|
|
"id": 7, //消息ID
|
|
|
"title": "这是个消息", //消息标题
|
|
|
"createtime": "2020.09.12 20:45" //发送时间
|
|
|
}]
|
|
|
}
|
|
|
})
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1602813893",
|
|
|
"data": {
|
|
|
"total": 1, //数据总数
|
|
|
"list": [{
|
|
|
"id": 7, //消息ID
|
|
|
"title": "这是个消息", //消息标题
|
|
|
"is_read": "1", //是否已读:0=否,1=是
|
|
|
"createtime": "2020.09.12 20:45" //发送时间
|
|
|
}]
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function messageList()
|
|
|
{
|
...
|
...
|
@@ -1071,13 +1115,41 @@ class User extends Api |
|
|
->paginate($page_num,false,['page'=>$page])
|
|
|
->each(function($v){
|
|
|
$v['createtime'] = date('Y.m.d H:i',$v['createtime']);
|
|
|
$v->visible(['id','title','createtime']);
|
|
|
$v->visible(['id','title','is_read','createtime']);
|
|
|
})->toArray();
|
|
|
$this->success('成功', ['total'=>$data['total'],'list'=>$data['data']]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiWeigh (43)
|
|
|
* @ApiTitle (消息-一键已读)
|
|
|
* @ApiSummary (消息-一键已读)
|
|
|
* @ApiMethod (POST)
|
|
|
*
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
*
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1600167138",
|
|
|
"data": {
|
|
|
"total": 1, //数据总数
|
|
|
"list": [{
|
|
|
"id": 7, //消息ID
|
|
|
"title": "这是个消息", //消息标题
|
|
|
"createtime": "2020.09.12 20:45" //发送时间
|
|
|
}]
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function allRead()
|
|
|
{
|
|
|
Message::where('user_id',$this->auth->id)->update(['is_read'=>'1']);
|
|
|
$this->success('成功');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiWeigh (43)
|
|
|
* @ApiTitle (消息-详情)
|
|
|
* @ApiSummary (消息-详情)
|
|
|
* @ApiMethod (POST)
|
...
|
...
|
|