...
|
...
|
@@ -75,11 +75,62 @@ class User extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 会员中心
|
|
|
* @ApiTitle (个人中心-首页)
|
|
|
* @ApiSummary (个人中心-首页)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/user/index)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiReturn ({
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1598664523",
|
|
|
"data": {
|
|
|
"user": {
|
|
|
"id": 2, //用户ID
|
|
|
"username": "何先生", //用户名
|
|
|
"nickname": "何先生", //昵称
|
|
|
"avatar": "http://cloud.caiyunpan.brotop.cn/assets/img/avatar.png", //头像
|
|
|
"money": "0.00", //钱包余额
|
|
|
"house_id": 17, //当前小区ID
|
|
|
"id_num": "100001", //ID
|
|
|
"url": "/u/2",
|
|
|
"today_money": 10, //今日收益
|
|
|
"total_money": 10 //总收益
|
|
|
},
|
|
|
"house": { //当前小区信息
|
|
|
"id": 17, //小区ID
|
|
|
"name": "碧海花园小区" //小区名称
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function index()
|
|
|
{
|
|
|
$this->success('', ['welcome' => $this->auth->nickname]);
|
|
|
$user = $this->auth->getUser();
|
|
|
$store_inform_log = new \app\api\model\StoreInformLog;
|
|
|
// 今日收益
|
|
|
$user['today_money'] = $store_inform_log
|
|
|
->where('user_id',$this->auth->id)
|
|
|
->whereTime('createtime', 'today')
|
|
|
->sum('money');
|
|
|
// 总收益
|
|
|
$user['total_money'] = $store_inform_log
|
|
|
->where('user_id',$this->auth->id)
|
|
|
->sum('money');
|
|
|
$user = $user->visible([
|
|
|
'id',
|
|
|
'username',
|
|
|
'nickname',
|
|
|
'avatar',
|
|
|
'id_num',
|
|
|
'house_id',
|
|
|
'money'
|
|
|
])->append([
|
|
|
'today_money',
|
|
|
'total_money'
|
|
|
]);
|
|
|
$house = \app\api\model\House::get($user['house_id'])->visible(['id','name']);
|
|
|
$this->success('成功', compact('user','house'));
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|