| | |
| | | import com.stylefeng.guns.modular.system.service.ISmsrecordService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.service.IVerifiedService; |
| | | import com.stylefeng.guns.modular.system.util.ALiApiUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.warpper.LoginWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.UserInfoWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.UserInviteInfoWarpper; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 用户控制器 |
| | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private ALiApiUtil aLiApiUtil; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/isEnterEmergencyContact") |
| | |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/sedEmail") |
| | | @ApiOperation(value = "获取邮箱验证码【1.0】", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "邮箱地址", name = "email", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil sedEmail(String email){ |
| | | try { |
| | | if(ToolUtil.isEmpty(email)){ |
| | | return ResultUtil.error("邮箱地址不能为空"); |
| | | } |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for(int i = 0; i < 4; i++){ |
| | | sb.append((int) (random.nextDouble() * 10)); |
| | | } |
| | | String authCode = sb.toString(); |
| | | redisUtil.setStrValue(email, authCode, 5 * 60); |
| | | EmailUtil.getMimeMessage(email, "验证码", "您的验证码:<span style=\"color:red;\">" + authCode + "</span>"); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/facebookLogin") |
| | | @ApiOperation(value = "FaceBook授权登录【1.0】", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "FaceBook用户id", name = "id", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "FaceBook用户名称", name = "name", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "FaceBook绑定的email", name = "email", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "当前定位区县行政编号", name = "registAreaCode", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "分享的用户id", name = "uid", required = false, dataType = "int"), |
| | | }) |
| | | public ResultUtil facebookLogin(String id, String name, String email, String registAreaCode, Integer uid){ |
| | | try { |
| | | return userInfoService.facebookLogin(id, name, email, registAreaCode, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 设置电话号码 |
| | | * @param phone |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/bindingEmail") |
| | | @ApiOperation(value = "设置邮箱地址【1.0】", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "绑定类型(1=注册账号绑定,2=个人中心绑定)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "邮箱地址", name = "email", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<LoginWarpper> bindingEmail(Integer type, String email, String code, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userInfoService.bindingEmail(uid, type, email, code); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户个人信息 |
| | | * @param request |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/queryUserInfo") |
| | | @ApiOperation(value = "获取用户详情", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取用户详情【1.0】", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |