...
|
...
|
@@ -87,34 +87,35 @@ class User extends Api |
|
|
* @ApiRoute (/api/user/index)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiReturn ({
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1598667600",
|
|
|
"data": {
|
|
|
"id": 2, //用户ID
|
|
|
"username": "何先生", //用户名
|
|
|
"nickname": "何先生", //昵称
|
|
|
"avatar": "http://cloud.caiyunpan.brotop.cn/assets/img/avatar.png", //头像
|
|
|
"money": "0.00", //余额
|
|
|
"id_num": "100001", //ID
|
|
|
"url": "/u/2",
|
|
|
"house": { //小区信息
|
|
|
"id": 17, //小区ID
|
|
|
"name": "碧海花园小区" //小区名称
|
|
|
},
|
|
|
"today_money": 10, //今日收益
|
|
|
"total_money": 10, //总收益
|
|
|
"message_num": 0 //未读消息数量
|
|
|
}
|
|
|
})
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1598667600",
|
|
|
"data": {
|
|
|
"id": 2, //用户ID
|
|
|
"username": "何先生", //用户名
|
|
|
"nickname": "何先生", //昵称
|
|
|
"avatar": "http://cloud.caiyunpan.brotop.cn/assets/img/avatar.png", //头像
|
|
|
"money": "0.00", //余额
|
|
|
"id_num": "100001", //ID
|
|
|
"identity": 0, //身份0普通用户1主管理员2子管理员3商家
|
|
|
"url": "/u/2",
|
|
|
"house": { //小区信息
|
|
|
"id": 17, //小区ID
|
|
|
"name": "碧海花园小区" //小区名称
|
|
|
},
|
|
|
"today_money": 10, //今日收益
|
|
|
"total_money": 10, //总收益
|
|
|
"message_num": 0 //未读消息数量
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function index()
|
|
|
{
|
|
|
$user = $this->auth->getUser();
|
|
|
$house = \app\api\model\House::get($user['house_id']);
|
|
|
$data = [
|
|
|
// 当前小区信息
|
|
|
'house' => \app\api\model\House::get($user['house_id'])
|
|
|
->visible(['id','name'])->toArray(),
|
|
|
'house' => !empty($house) ? $house->visible(['id','name'])->toArray() : [],
|
|
|
// 今日收益
|
|
|
'today_money' => UserMoneyLog::where('user_id',$this->auth->id)
|
|
|
->where('money','>',0)
|
...
|
...
|
@@ -135,7 +136,8 @@ class User extends Api |
|
|
'nickname',
|
|
|
'avatar',
|
|
|
'id_num',
|
|
|
'money'
|
|
|
'money',
|
|
|
'identity'
|
|
|
])->toArray();
|
|
|
$this->success('成功', array_merge($user,$data));
|
|
|
}
|
...
|
...
|
|