正在显示
4 个修改的文件
包含
65 行增加
和
6 行删除
@@ -45,10 +45,9 @@ class House extends Api | @@ -45,10 +45,9 @@ class House extends Api | ||
45 | */ | 45 | */ |
46 | public function banner() | 46 | public function banner() |
47 | { | 47 | { |
48 | - $qiniu = get_addon_config('qiniu')['cdnurl']; | ||
49 | $data = Db::name('banner')->field('updatetime',true)->order('createtime desc')->select(); | 48 | $data = Db::name('banner')->field('updatetime',true)->order('createtime desc')->select(); |
50 | foreach ($data as &$v){ | 49 | foreach ($data as &$v){ |
51 | - $v['image'] = $qiniu.$v['image']; | 50 | + $v['image'] = cdnurl($v['image'],true); |
52 | $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']); | 51 | $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']); |
53 | } | 52 | } |
54 | $this->success('success',$data); | 53 | $this->success('success',$data); |
@@ -136,10 +136,9 @@ class HouseBoard extends Api | @@ -136,10 +136,9 @@ class HouseBoard extends Api | ||
136 | */ | 136 | */ |
137 | public function banner() | 137 | public function banner() |
138 | { | 138 | { |
139 | - $qiniu = get_addon_config('qiniu')['cdnurl']; | ||
140 | $data = Db::name('advertising')->field('updatetime',true)->order('createtime desc')->select(); | 139 | $data = Db::name('advertising')->field('updatetime',true)->order('createtime desc')->select(); |
141 | foreach ($data as &$v){ | 140 | foreach ($data as &$v){ |
142 | - $v['image'] = $qiniu.$v['image']; | 141 | + $v['image'] = cdnurl($v['image'],true); |
143 | $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']); | 142 | $v['createtime'] = date('Y-m-d H:i:s',$v['createtime']); |
144 | } | 143 | } |
145 | $this->success('success',$data); | 144 | $this->success('success',$data); |
@@ -75,11 +75,62 @@ class User extends Api | @@ -75,11 +75,62 @@ class User extends Api | ||
75 | } | 75 | } |
76 | 76 | ||
77 | /** | 77 | /** |
78 | - * 会员中心 | 78 | + * @ApiTitle (个人中心-首页) |
79 | + * @ApiSummary (个人中心-首页) | ||
80 | + * @ApiMethod (POST) | ||
81 | + * @ApiRoute (/api/user/index) | ||
82 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
83 | + * @ApiReturn ({ | ||
84 | + "code": 1, | ||
85 | + "msg": "成功", | ||
86 | + "time": "1598664523", | ||
87 | + "data": { | ||
88 | + "user": { | ||
89 | + "id": 2, //用户ID | ||
90 | + "username": "何先生", //用户名 | ||
91 | + "nickname": "何先生", //昵称 | ||
92 | + "avatar": "http://cloud.caiyunpan.brotop.cn/assets/img/avatar.png", //头像 | ||
93 | + "money": "0.00", //钱包余额 | ||
94 | + "house_id": 17, //当前小区ID | ||
95 | + "id_num": "100001", //ID | ||
96 | + "url": "/u/2", | ||
97 | + "today_money": 10, //今日收益 | ||
98 | + "total_money": 10 //总收益 | ||
99 | + }, | ||
100 | + "house": { //当前小区信息 | ||
101 | + "id": 17, //小区ID | ||
102 | + "name": "碧海花园小区" //小区名称 | ||
103 | + } | ||
104 | + } | ||
105 | + }) | ||
79 | */ | 106 | */ |
80 | public function index() | 107 | public function index() |
81 | { | 108 | { |
82 | - $this->success('', ['welcome' => $this->auth->nickname]); | 109 | + $user = $this->auth->getUser(); |
110 | + $store_inform_log = new \app\api\model\StoreInformLog; | ||
111 | + // 今日收益 | ||
112 | + $user['today_money'] = $store_inform_log | ||
113 | + ->where('user_id',$this->auth->id) | ||
114 | + ->whereTime('createtime', 'today') | ||
115 | + ->sum('money'); | ||
116 | + // 总收益 | ||
117 | + $user['total_money'] = $store_inform_log | ||
118 | + ->where('user_id',$this->auth->id) | ||
119 | + ->sum('money'); | ||
120 | + $user = $user->visible([ | ||
121 | + 'id', | ||
122 | + 'username', | ||
123 | + 'nickname', | ||
124 | + 'avatar', | ||
125 | + 'id_num', | ||
126 | + 'house_id', | ||
127 | + 'money' | ||
128 | + ])->append([ | ||
129 | + 'today_money', | ||
130 | + 'total_money' | ||
131 | + ]); | ||
132 | + $house = \app\api\model\House::get($user['house_id'])->visible(['id','name']); | ||
133 | + $this->success('成功', compact('user','house')); | ||
83 | } | 134 | } |
84 | 135 | ||
85 | /** | 136 | /** |
-
请 注册 或 登录 后发表评论