puzhibing
2023-05-29 d6b28b2d38ae32c1d147e263c1cb4cff6b32a503
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
package com.agentdriving.user.modular.api;
 
import com.agentdriving.user.core.common.annotion.ServiceLog;
import com.agentdriving.user.core.util.ToolUtil;
import com.agentdriving.user.modular.system.service.*;
import com.agentdriving.user.modular.system.warpper.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.agentdriving.user.modular.system.model.AppUser;
import com.agentdriving.user.modular.system.model.SystemConfig;
import com.agentdriving.user.modular.system.util.PayMoneyUtil;
import com.agentdriving.user.modular.system.util.RedisUtil;
import com.agentdriving.user.modular.system.util.ResultUtil;
import com.agentdriving.user.modular.system.util.UUIDUtil;
import com.agentdriving.user.modular.system.util.huawei.OBSUtil;
import com.agentdriving.user.modular.system.util.huawei.SMSUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;
 
/**
 * 用户控制器
 */
@RestController
@RequestMapping("")
public class AppUserController {
 
    @Autowired
    private IAppUserService appUserService;
 
    @Autowired
    private IDriverService driverService;
 
    @Autowired
    private ISystemConfigService systemConfigService;
 
    @Autowired
    private PayMoneyUtil payMoneyUtil;
 
    @Autowired
    private IUserToCouponService userToCouponService;
 
    @Autowired
    private IAccountChangeDetailService accountChangeDetailService;
 
    @Autowired
    private IComplaintService complaintService;
 
    @Autowired
    private RedisUtil redisUtil;
 
 
 
 
 
    @ResponseBody
    @PostMapping("/base/appUser/appUserLogin")
//    @ServiceLog(name = "微信登录", url = "/base/appUser/appUserLogin")
    @ApiOperation(value = "微信登录", tags = {"用户端-首页"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "微信jscode", name = "jscode", required = true, dataType = "string"),
    })
    public ResponseWarpper appUserLogin(String jscode){
        if(ToolUtil.isEmpty(jscode)){
            return ResponseWarpper.success(ResultUtil.paranErr("jscode"));
        }
        try {
            ResultUtil resultUtil = appUserService.appUserLogin(jscode);
            return ResponseWarpper.success(resultUtil);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
 
    @ResponseBody
    @PostMapping("/base/appUser/signInToRegister")
//    @ServiceLog(name = "微信手机授权登录", url = "/base/appUser/signInToRegister")
    @ApiOperation(value = "微信手机授权登录", tags = {"用户端-首页"}, notes = "")
    @ApiImplicitParams({
    })
    public ResponseWarpper<SignInToRegisterWarpper> signInToRegister(SignInToRegister signInToRegister){
        try {
            ResultUtil<SignInToRegisterWarpper> resultUtil = appUserService.signInToRegister(signInToRegister);
            return ResponseWarpper.success(resultUtil);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
 
    @ResponseBody
    @PostMapping("/base/appUser/queryNearbyDrivers")
    @ServiceLog(name = "获取附近的司机", url = "/base/appUser/queryNearbyDrivers")
    @ApiOperation(value = "获取附近的司机", tags = {"用户端-首页"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "经度", name = "lon", required = true, dataType = "string"),
            @ApiImplicitParam(value = "纬度", name = "lat", required = true, dataType = "string"),
    })
    public ResponseWarpper<List<NearbyDriverWarpper>> queryNearbyDrivers(String lon, String lat){
        if(ToolUtil.isEmpty(lat)){
            return ResponseWarpper.success(ResultUtil.paranErr("lat"));
        }
        if(ToolUtil.isEmpty(lon)){
            return ResponseWarpper.success(ResultUtil.paranErr("lon"));
        }
        try {
            List<NearbyDriverWarpper> list = driverService.queryDriverPosition(lon, lat, 5D);
            return ResponseWarpper.success(list);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
    @ResponseBody
    @PostMapping("/base/appUser/setEmergencyContact")
//    @ServiceLog(name = "设置紧急联系人", url = "/base/appUser/queryNearbyDrivers")
    @ApiOperation(value = "设置紧急联系人", tags = {"用户端-首页"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "姓名", name = "name", required = true, dataType = "string"),
            @ApiImplicitParam(value = "电话", name = "phone", required = true, dataType = "string"),
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper setEmergencyContact(String name, String phone){
        if(ToolUtil.isEmpty(name)){
            return ResponseWarpper.success(ResultUtil.paranErr("name"));
        }
        if(ToolUtil.isEmpty(phone)){
            return ResponseWarpper.success(ResultUtil.paranErr("phone"));
        }
        try {
            Integer uid = appUserService.getUserByRequest();
            if(null == uid){
                return ResponseWarpper.success(ResultUtil.tokenErr());
            }
            AppUser appUser = appUserService.selectById(uid);
            appUser.setEmergencyContact(name);
            appUser.setEmergencyPhone(phone);
            appUserService.updateById(appUser);
            return ResponseWarpper.success();
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
    @ResponseBody
    @PostMapping("/api/appUser/queryUserInfo")
//    @ServiceLog(name = "获取个人信息", url = "/api/appUser/queryUserInfo")
    @ApiOperation(value = "获取个人信息", tags = {"用户端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper<UserInfoWarpper> queryUserInfo(){
        try {
            Integer uid = appUserService.getUserByRequest();
            if(null == uid){
                return ResponseWarpper.success(ResultUtil.tokenErr());
            }
            AppUser appUser = appUserService.selectById(uid);
            UserInfoWarpper userInfoWarpper = new UserInfoWarpper();
            BeanUtils.copyProperties(appUser, userInfoWarpper);
            SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 7));
            if(null != systemConfig){
                JSONObject jsonObject = JSON.parseObject(systemConfig.getContent());
                userInfoWarpper.setServiceCell(jsonObject.getString("num1"));
            }
            return ResponseWarpper.success(userInfoWarpper);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
    @ResponseBody
    @PostMapping("/api/appUser/uploadImg")
//    @ServiceLog(name = "上传头像图片", url = "/api/appUser/uploadImg")
    @ApiOperation(value = "上传头像图片", tags = {"用户端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "图片文件", name = "file", required = true, dataType = "file"),
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper<String> uploadImg(MultipartFile file){
        try {
            InputStream inputStream = file.getInputStream();
            String name = file.getOriginalFilename();
            name = UUIDUtil.getRandomCode() + name.substring(name.lastIndexOf("."));
            String s = OBSUtil.putObjectToBucket(inputStream, name);
            return ResponseWarpper.success(s);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
 
    @ResponseBody
    @PostMapping("/api/appUser/updateUserInfo")
//    @ServiceLog(name = "修改个人信息", url = "/api/appUser/updateUserInfo")
    @ApiOperation(value = "修改个人信息", tags = {"用户端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper updateUserInfo(UserInfo userInfo){
        try {
            Integer uid = appUserService.getUserByRequest();
            if(null == uid){
                return ResponseWarpper.success(ResultUtil.tokenErr());
            }
            ResultUtil resultUtil = appUserService.updateUserInfo(uid, userInfo);
            return ResponseWarpper.success(resultUtil);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
 
 
    @ResponseBody
    @PostMapping("/api/appUser/queryPriceRules")
//    @ServiceLog(name = "获取价格表", url = "/api/appUser/queryPriceRules")
    @ApiOperation(value = "获取价格表", tags = {"用户端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper<PriceRulesWarpper> queryPriceRules(){
        try {
            PriceRulesWarpper priceRulesWarpper = systemConfigService.queryPriceRules();
            return ResponseWarpper.success(priceRulesWarpper);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
    @ResponseBody
    @PostMapping("/api/appUser/queryTopUpPrompt")
//    @ServiceLog(name = "获取充值优惠提示", url = "/api/appUser/queryTopUpPrompt")
    @ApiOperation(value = "获取充值优惠提示", tags = {"用户端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper<String> queryTopUpPrompt(){
        try {
            SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 6));
            if(null != systemConfig){
                JSONObject jsonObject = JSON.parseObject(systemConfig.getContent());
                return ResponseWarpper.success("充值满" + jsonObject.getDouble("num2") + "元,下单享9折优惠!");
            }
            return ResponseWarpper.success();
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
    @ResponseBody
    @PostMapping("/api/appUser/rechargeBalance")
//    @ServiceLog(name = "充值操作", url = "/api/appUser/rechargeBalance")
    @ApiOperation(value = "充值操作", tags = {"用户端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "充值金额", name = "amount", required = true, dataType = "double"),
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper rechargeBalance(Double amount){
        if(null == amount){
            return ResponseWarpper.success(ResultUtil.paranErr("amount"));
        }
        try {
            Integer uid = appUserService.getUserByRequest();
            if(null == uid){
                return ResponseWarpper.success(ResultUtil.tokenErr());
            }
            ResultUtil resultUtil = appUserService.rechargeBalance(uid, amount);
            return ResponseWarpper.success(resultUtil);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
 
    @ResponseBody
    @PostMapping("/base/appUser/rechargeBalanceCallback")
//    @ServiceLog(name = "余额充值回调", url = "/base/appUser/rechargeBalanceCallback")
    public void rechargeBalanceCallback(HttpServletRequest request, HttpServletResponse response){
        try {
            Map<String, String> map = payMoneyUtil.weixinpayCallback(request);
            if(null != map){
                String out_trade_no = map.get("out_trade_no");
                String transaction_id = map.get("transaction_id");
                String result = map.get("result");
                String orderId = out_trade_no.substring(17);
                appUserService.rechargeBalanceCallback(out_trade_no, transaction_id);
                PrintWriter out = response.getWriter();
                out.print(result);
                out.flush();
                out.close();
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
 
 
    @ResponseBody
    @PostMapping("/api/appUser/queryMyCoupons")
//    @ServiceLog(name = "获取优惠券列表", url = "/api/appUser/queryMyCoupons")
    @ApiOperation(value = "获取优惠券列表", tags = {"用户端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "状态(1=未使用,2=已使用,3=已过期)", name = "state", required = true, dataType = "int"),
            @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"),
            @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"),
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper<List<CouponsWarpper>> queryMyCoupons(Integer state, Integer pageNum, Integer pageSize){
        if(null == state){
            return ResponseWarpper.success(ResultUtil.paranErr("state"));
        }
        if(null == pageNum){
            return ResponseWarpper.success(ResultUtil.paranErr("pageNum"));
        }
        if(null == pageSize){
            return ResponseWarpper.success(ResultUtil.paranErr("pageSize"));
        }
        try {
            Integer uid = appUserService.getUserByRequest();
            if(null == uid){
                return ResponseWarpper.success(ResultUtil.tokenErr());
            }
            List<CouponsWarpper> couponsWarppers = userToCouponService.queryMyCoupons(uid, state, pageNum, pageSize);
            return ResponseWarpper.success(couponsWarppers);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
    @ResponseBody
    @PostMapping("/api/appUser/queryUsedCouponNum")
//    @ServiceLog(name = "获取已使用优惠券数量", url = "/api/appUser/queryUsedCouponNum")
    @ApiOperation(value = "获取已使用优惠券数量", tags = {"用户端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper<Integer> queryUsedCouponNum(){
        try {
            Integer uid = appUserService.getUserByRequest();
            if(null == uid){
                return ResponseWarpper.success(ResultUtil.tokenErr());
            }
            Integer integer = userToCouponService.queryUsedCouponNum(uid);
            return ResponseWarpper.success(integer);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
    @ResponseBody
    @PostMapping("/api/appUser/queryBalanceDetails")
//    @ServiceLog(name = "获取余额明细", url = "/api/appUser/queryBalanceDetails")
    @ApiOperation(value = "获取余额明细", tags = {"用户端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "统计时间", name = "time", required = true, dataType = "string"),
            @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"),
            @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"),
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper<List<BalanceDetailsWarpper>> queryBalanceDetails(String time, Integer pageNum, Integer pageSize){
        if(ToolUtil.isEmpty(time)){
            return ResponseWarpper.success(ResultUtil.paranErr("time"));
        }
        if(null == pageNum){
            return ResponseWarpper.success(ResultUtil.paranErr("pageNum"));
        }
        if(null == pageSize){
            return ResponseWarpper.success(ResultUtil.paranErr("pageSize"));
        }
        try {
            Integer uid = appUserService.getUserByRequest();
            if(null == uid){
                return ResponseWarpper.success(ResultUtil.tokenErr());
            }
            List<BalanceDetailsWarpper> balanceDetailsWarppers = accountChangeDetailService.queryBalanceDetails(uid, time, pageNum, pageSize);
            return ResponseWarpper.success(balanceDetailsWarppers);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
    @ResponseBody
    @PostMapping("/api/appUser/cancelAccount")
//    @ServiceLog(name = "注销账号", url = "/api/appUser/cancelAccount")
    @ApiOperation(value = "注销账号", tags = {"用户端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper cancelAccount(){
        try {
            Integer uid = appUserService.getUserByRequest();
            if(null == uid){
                return ResponseWarpper.success(ResultUtil.tokenErr());
            }
            AppUser appUser = appUserService.selectById(uid);
            appUser.setStatus(3);
            appUserService.updateById(appUser);
            return ResponseWarpper.success();
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
    @ResponseBody
    @PostMapping("/api/appUser/feedback")
//    @ServiceLog(name = "投诉反馈", url = "/api/appUser/feedback")
    @ApiOperation(value = "投诉反馈", tags = {"用户端-首页", "用户端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = false, dataType = "int"),
            @ApiImplicitParam(value = "反馈内容", name = "content", required = true, dataType = "string"),
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper feedback(Integer orderId, String content){
        if(null == content){
            return ResponseWarpper.success(ResultUtil.paranErr("content"));
        }
        try {
            Integer uid = appUserService.getUserByRequest();
            if(null == uid){
                return ResponseWarpper.success(ResultUtil.tokenErr());
            }
            complaintService.feedback(uid, orderId, content);
            return ResponseWarpper.success();
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
 
    @ResponseBody
    @PostMapping("/base/appUser/getVerificationCode")
//    @ServiceLog(name = "获取短信验证码", url = "/base/appUser/getVerificationCode")
    @ApiOperation(value = "获取短信验证码", tags = {"用户端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "国家代码+86", name = "receiver", required = true, dataType = "string"),
            @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "string"),
    })
    public ResponseWarpper getVerificationCode(String receiver, String phone){
        if(ToolUtil.isEmpty(receiver)){
            return ResponseWarpper.success(ResultUtil.paranErr("receiver"));
        }
        if(ToolUtil.isEmpty(phone)){
            return ResponseWarpper.success(ResultUtil.paranErr("phone"));
        }
        try {
            String numberRandom = UUIDUtil.getNumberRandom(5);
            SMSUtil.send(phone, "4d18e74a95ca400d802755fe0f903589", "[\"" + numberRandom + "\"]");
            redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期
            return ResponseWarpper.success(ResultUtil.success());
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
 
    @ResponseBody
    @PostMapping("/base/appUser/verifySMSCode")
//    @ServiceLog(name = "验证短信验证码", url = "/base/appUser/verifySMSCode")
    @ApiOperation(value = "验证短信验证码", tags = {"用户端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "String"),
            @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String"),
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper verifySMSCode(String phone, String code){
        if(ToolUtil.isEmpty(phone)){
            return ResponseWarpper.success(ResultUtil.paranErr("phone"));
        }
        if(ToolUtil.isEmpty(phone)){
            return ResponseWarpper.success(ResultUtil.paranErr("code"));
        }
        try {
            ResultUtil resultUtil = ResultUtil.success();
            phone = phone.indexOf("+86") < 0 ? "+86" + phone : phone;
            String value = redisUtil.getValue(phone);
            if(ToolUtil.isEmpty(value) || !value.equals(code)){
                return ResponseWarpper.success(ResultUtil.error("验证码无效"));
            }
            redisUtil.remove(phone);
            return ResponseWarpper.success(resultUtil);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
 
}