1 个管道
的构建
通过
耗费
0 秒
Merge branch 'master' of http://114.215.101.231:8099/guosheng/community into liuzhen
# Conflicts: # application/api/controller/House.php
正在显示
6 个修改的文件
包含
162 行增加
和
20 行删除
@@ -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); |
@@ -285,7 +284,6 @@ class House extends Api | @@ -285,7 +284,6 @@ class House extends Api | ||
285 | */ | 284 | */ |
286 | public function house_list() | 285 | public function house_list() |
287 | { | 286 | { |
288 | - $qiniu = get_addon_config('qiniu')['cdnurl']; | ||
289 | $type = $this->request->param('type',1,'intval'); | 287 | $type = $this->request->param('type',1,'intval'); |
290 | $user_id = $this->auth->id; | 288 | $user_id = $this->auth->id; |
291 | $area = $this->request->param('area'); | 289 | $area = $this->request->param('area'); |
@@ -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); |
@@ -260,7 +259,6 @@ class HouseBoard extends Api | @@ -260,7 +259,6 @@ class HouseBoard extends Api | ||
260 | "msg": "成功", | 259 | "msg": "成功", |
261 | "time": "1571492001", | 260 | "time": "1571492001", |
262 | "data": { | 261 | "data": { |
263 | - "id"://id | ||
264 | "user_id"://用户id | 262 | "user_id"://用户id |
265 | "avatar"://管理员头像 | 263 | "avatar"://管理员头像 |
266 | "nickname"://昵称 | 264 | "nickname"://昵称 |
@@ -280,7 +278,7 @@ class HouseBoard extends Api | @@ -280,7 +278,7 @@ class HouseBoard extends Api | ||
280 | ->alias('a') | 278 | ->alias('a') |
281 | ->join('user b','a.user_id = b.id') | 279 | ->join('user b','a.user_id = b.id') |
282 | ->where('a.house_id',$house_id) | 280 | ->where('a.house_id',$house_id) |
283 | - ->field('a.id,a.user_id,b.avatar,b.nickname') | 281 | + ->field('a.user_id,b.avatar,b.nickname') |
284 | ->order('a.is_direct') | 282 | ->order('a.is_direct') |
285 | ->select(); | 283 | ->select(); |
286 | foreach ($data as &$v){ | 284 | foreach ($data as &$v){ |
@@ -331,7 +329,6 @@ class HouseBoard extends Api | @@ -331,7 +329,6 @@ class HouseBoard extends Api | ||
331 | */ | 329 | */ |
332 | public function chat_record() | 330 | public function chat_record() |
333 | { | 331 | { |
334 | - $qiniu = get_addon_config('qiniu')['cdnurl']; | ||
335 | $user_id = $this->auth->id; //当前登录用户id | 332 | $user_id = $this->auth->id; //当前登录用户id |
336 | $house_id = $this->request->param('house_id'); //社区id | 333 | $house_id = $this->request->param('house_id'); //社区id |
337 | $wuye_user_id = $this->request->param('user_id'); //物业用户id | 334 | $wuye_user_id = $this->request->param('user_id'); //物业用户id |
@@ -353,7 +350,7 @@ class HouseBoard extends Api | @@ -353,7 +350,7 @@ class HouseBoard extends Api | ||
353 | foreach ($data as &$v){ | 350 | foreach ($data as &$v){ |
354 | $v['is_right'] = 1; | 351 | $v['is_right'] = 1; |
355 | if($v['type'] == 2){ | 352 | if($v['type'] == 2){ |
356 | - $v['image'] = $qiniu.$v['image']; | 353 | + $v['image'] = cdnurl($v['image'],true); |
357 | } | 354 | } |
358 | } | 355 | } |
359 | $arr = Db::name('message') | 356 | $arr = Db::name('message') |
@@ -365,7 +362,7 @@ class HouseBoard extends Api | @@ -365,7 +362,7 @@ class HouseBoard extends Api | ||
365 | foreach ($arr as &$v){ | 362 | foreach ($arr as &$v){ |
366 | $v['is_right'] = 2; | 363 | $v['is_right'] = 2; |
367 | if($v['type'] == 2){ | 364 | if($v['type'] == 2){ |
368 | - $v['image'] = $qiniu.$v['image']; | 365 | + $v['image'] = cdnurl($v['image'],true); |
369 | } | 366 | } |
370 | } | 367 | } |
371 | 368 | ||
@@ -396,7 +393,7 @@ class HouseBoard extends Api | @@ -396,7 +393,7 @@ class HouseBoard extends Api | ||
396 | { | 393 | { |
397 | "id": // 活动id | 394 | "id": // 活动id |
398 | "title": // 活动标题 | 395 | "title": // 活动标题 |
399 | - "spec_type": // 活动规格:0=无规格(免费),1=单规格,2=多规格 | 396 | + "spec_type": // 活动规格:0=无规格,免费,1=单规格,2=多规格 |
400 | "content": // 活动描述 | 397 | "content": // 活动描述 |
401 | "activity_time": 活动日期 | 398 | "activity_time": 活动日期 |
402 | "price": // 报名费用 | 399 | "price": // 报名费用 |
@@ -432,7 +429,7 @@ class HouseBoard extends Api | @@ -432,7 +429,7 @@ class HouseBoard extends Api | ||
432 | "data": { | 429 | "data": { |
433 | "id": // 活动id | 430 | "id": // 活动id |
434 | "title": // 活动标题 | 431 | "title": // 活动标题 |
435 | - "spec_type": // 活动规格:0=无规格(免费),1=单规格,2=多规格 | 432 | + "spec_type": // 活动规格:0=无规格,免费,1=单规格,2=多规格 |
436 | "content": // 活动描述 | 433 | "content": // 活动描述 |
437 | "activity_time": 活动日期 | 434 | "activity_time": 活动日期 |
438 | "price": // 报名费用 | 435 | "price": // 报名费用 |
@@ -7,6 +7,8 @@ use app\common\library\Ems; | @@ -7,6 +7,8 @@ use app\common\library\Ems; | ||
7 | use app\common\library\Sms; | 7 | use app\common\library\Sms; |
8 | use fast\Random; | 8 | use fast\Random; |
9 | use think\Validate; | 9 | use think\Validate; |
10 | +use think\Cache; | ||
11 | +use app\api\model\HouseJoin; | ||
10 | 12 | ||
11 | /** | 13 | /** |
12 | * 会员接口 | 14 | * 会员接口 |
@@ -75,11 +77,129 @@ class User extends Api | @@ -75,11 +77,129 @@ class User extends Api | ||
75 | } | 77 | } |
76 | 78 | ||
77 | /** | 79 | /** |
78 | - * 会员中心 | 80 | + * @ApiTitle (个人中心-首页) |
81 | + * @ApiSummary (个人中心-首页) | ||
82 | + * @ApiMethod (POST) | ||
83 | + * @ApiRoute (/api/user/index) | ||
84 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
85 | + * @ApiReturn ({ | ||
86 | + "code": 1, | ||
87 | + "msg": "成功", | ||
88 | + "time": "1598667600", | ||
89 | + "data": { | ||
90 | + "id": 2, //用户ID | ||
91 | + "username": "何先生", //用户名 | ||
92 | + "nickname": "何先生", //昵称 | ||
93 | + "avatar": "http://cloud.caiyunpan.brotop.cn/assets/img/avatar.png", //头像 | ||
94 | + "money": "0.00", //余额 | ||
95 | + "id_num": "100001", //ID | ||
96 | + "url": "/u/2", | ||
97 | + "house": { //小区信息 | ||
98 | + "id": 17, //小区ID | ||
99 | + "name": "碧海花园小区" //小区名称 | ||
100 | + }, | ||
101 | + "today_money": 10, //今日收益 | ||
102 | + "total_money": 10, //总收益 | ||
103 | + "message_num": 0 //未读消息数量 | ||
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 | + $data = [ | ||
112 | + // 当前小区信息 | ||
113 | + 'house' => \app\api\model\House::get($user['house_id']) | ||
114 | + ->visible(['id','name'])->toArray(), | ||
115 | + // 今日收益 | ||
116 | + 'today_money' => $store_inform_log | ||
117 | + ->where('user_id',$this->auth->id) | ||
118 | + ->whereTime('createtime', 'today') | ||
119 | + ->sum('money'), | ||
120 | + // 总收益 | ||
121 | + 'total_money' => $store_inform_log | ||
122 | + ->where('user_id',$this->auth->id) | ||
123 | + ->sum('money'), | ||
124 | + // 未读消息数量 | ||
125 | + 'message_num' => \app\api\model\Message::where('to_user_id',$user['id']) | ||
126 | + ->where('is_read',2) | ||
127 | + ->count() | ||
128 | + ]; | ||
129 | + $user = $user->visible([ | ||
130 | + 'id', | ||
131 | + 'username', | ||
132 | + 'nickname', | ||
133 | + 'avatar', | ||
134 | + 'id_num', | ||
135 | + 'money' | ||
136 | + ])->toArray(); | ||
137 | + $this->success('成功', array_merge($user,$data)); | ||
138 | + } | ||
139 | + | ||
140 | + /** | ||
141 | + * @ApiTitle (个人中心-我的活动) | ||
142 | + * @ApiSummary (个人中心-我的活动) | ||
143 | + * @ApiMethod (POST) | ||
144 | + * @ApiRoute (/api/user/activity) | ||
145 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
146 | + * @ApiReturn ({ | ||
147 | + "code": 1, | ||
148 | + "msg": "成功", | ||
149 | + "time": "1598673648", | ||
150 | + "data": [{ | ||
151 | + "id": 20, //活动报名ID | ||
152 | + "title": "澳大利亚政府这人品:我只要不承认,就不是针对中国", //活动标题 | ||
153 | + "content": "", //活动内容 | ||
154 | + "activity_time": "2020-08-28-2020-08-28" //活动时间 | ||
155 | + }] | ||
156 | + }) | ||
157 | + */ | ||
158 | + public function activity() | ||
159 | + { | ||
160 | + $list = HouseJoin::where('user_id',$this->auth->id) | ||
161 | + ->where('join_status','1') | ||
162 | + ->field('id,title,content,start_time,end_time') | ||
163 | + ->select(); | ||
164 | + foreach ($list as &$v) { | ||
165 | + // 活动日期 | ||
166 | + $v['activity_time'] = date('Y-m-d',$v['start_time']).'-'.date('Y-m-d',$v['end_time']); | ||
167 | + unset($v['start_time'],$v['end_time']); | ||
168 | + } | ||
169 | + $this->success('成功', $list); | ||
170 | + } | ||
171 | + | ||
172 | + /** | ||
173 | + * @ApiTitle (个人中心-我的活动-详情) | ||
174 | + * @ApiSummary (个人中心-我的活动-详情) | ||
175 | + * @ApiMethod (POST) | ||
176 | + * @ApiRoute (/api/user/activityInfo) | ||
177 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
178 | + * @ApiParams (name="house_join_id", type="string", required=true, description="报名ID") | ||
179 | + | ||
180 | + * @ApiReturn ({ | ||
181 | + "code": 1, | ||
182 | + "msg": "成功", | ||
183 | + "time": "1598673648", | ||
184 | + "data": [{ | ||
185 | + "id": 20, //报名ID | ||
186 | + "title": "澳大利亚政府这人品:我只要不承认,就不是针对中国", //活动标题 | ||
187 | + "content": "", //活动内容 | ||
188 | + "activity_time": "2020-08-28-2020-08-28" //活动时间 | ||
189 | + }] | ||
190 | + }) | ||
191 | + */ | ||
192 | + public function activityInfo() | ||
193 | + { | ||
194 | + $house_join_id = $this->request->param('house_join_id'); | ||
195 | + empty($house_join_id) && $this->error('请传入必填参数'); | ||
196 | + $info = HouseJoin::get(['user_id'=>$this->auth->id,'id'=>$house_join_id]); | ||
197 | + empty($info) && $this->error('活动信息不存在'); | ||
198 | + $info['activity_time'] = date('Y-m-d',$info['start_time']).'-'.date('Y-m-d',$info['end_time']); | ||
199 | + $info = $info->visible([ | ||
200 | + 'title', | ||
201 | + ]); | ||
202 | + $this->success('成功', $info); | ||
83 | } | 203 | } |
84 | 204 | ||
85 | /** | 205 | /** |
@@ -195,14 +315,12 @@ class User extends Api | @@ -195,14 +315,12 @@ class User extends Api | ||
195 | * @param string $avatar 头像地址 | 315 | * @param string $avatar 头像地址 |
196 | * @param string $username 用户名 | 316 | * @param string $username 用户名 |
197 | * @param string $nickname 昵称 | 317 | * @param string $nickname 昵称 |
198 | - * @param string $bio 个人简介 | ||
199 | */ | 318 | */ |
200 | public function profile() | 319 | public function profile() |
201 | { | 320 | { |
202 | $user = $this->auth->getUser(); | 321 | $user = $this->auth->getUser(); |
203 | $username = $this->request->request('username'); | 322 | $username = $this->request->request('username'); |
204 | $nickname = $this->request->request('nickname'); | 323 | $nickname = $this->request->request('nickname'); |
205 | - $bio = $this->request->request('bio'); | ||
206 | $avatar = $this->request->request('avatar', '', 'trim,strip_tags,htmlspecialchars'); | 324 | $avatar = $this->request->request('avatar', '', 'trim,strip_tags,htmlspecialchars'); |
207 | if ($username) { | 325 | if ($username) { |
208 | $exists = \app\common\model\User::where('username', $username)->where('id', '<>', $this->auth->id)->find(); | 326 | $exists = \app\common\model\User::where('username', $username)->where('id', '<>', $this->auth->id)->find(); |
@@ -212,7 +330,6 @@ class User extends Api | @@ -212,7 +330,6 @@ class User extends Api | ||
212 | $user->username = $username; | 330 | $user->username = $username; |
213 | } | 331 | } |
214 | $user->nickname = $nickname; | 332 | $user->nickname = $nickname; |
215 | - $user->bio = $bio; | ||
216 | $user->avatar = $avatar; | 333 | $user->avatar = $avatar; |
217 | $user->save(); | 334 | $user->save(); |
218 | $this->success(); | 335 | $this->success(); |
@@ -272,8 +389,8 @@ class User extends Api | @@ -272,8 +389,8 @@ class User extends Api | ||
272 | if (\app\common\model\User::where('mobile', $mobile)->where('id', '<>', $user->id)->find()) { | 389 | if (\app\common\model\User::where('mobile', $mobile)->where('id', '<>', $user->id)->find()) { |
273 | $this->error(__('Mobile already exists')); | 390 | $this->error(__('Mobile already exists')); |
274 | } | 391 | } |
275 | - $result = Sms::check($mobile, $captcha, 'changemobile'); | ||
276 | - if (!$result) { | 392 | + $code = Cache::get($mobile); |
393 | + if ($code != $captcha) { | ||
277 | $this->error(__('Captcha is incorrect')); | 394 | $this->error(__('Captcha is incorrect')); |
278 | } | 395 | } |
279 | $verification = $user->verification; | 396 | $verification = $user->verification; |
@@ -282,7 +399,7 @@ class User extends Api | @@ -282,7 +399,7 @@ class User extends Api | ||
282 | $user->mobile = $mobile; | 399 | $user->mobile = $mobile; |
283 | $user->save(); | 400 | $user->save(); |
284 | 401 | ||
285 | - Sms::flush($mobile, 'changemobile'); | 402 | + Cache::rm($mobile); |
286 | $this->success(); | 403 | $this->success(); |
287 | } | 404 | } |
288 | 405 |
application/api/model/House.php
0 → 100644
application/api/model/HouseJoin.php
0 → 100644
-
请 注册 或 登录 后发表评论