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());
|
}
|
}
|
|
}
|