| | |
| | | import com.stylefeng.guns.modular.account.server.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.account.util.OssUploadUtil; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.TDriverPromotionActivity; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.model.UserWithdrawal; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | 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.service.*; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.WeChatUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.LoginWarpper; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang.time.DateUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @Autowired |
| | | private HttpServletRequest request; |
| | | |
| | | @Autowired |
| | | private TDriverPromotionActivityService driverPromotionActivityService; |
| | | |
| | | |
| | | /** |
| | |
| | | @ApiImplicitParam(value = "ip地址", name = "registIp", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "登录端口-小程序传Applets", name = "loginType", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "当前定位区县行政编号", name = "registAreaCode", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "司机id", name = "driverId", required = false, dataType = "int"), |
| | | }) |
| | | public ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType,String jsCode,Integer driverId){ |
| | | public ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType,String jsCode){ |
| | | try { |
| | | return userInfoService.captchaLogin(phone, code, registIp, registAreaCode,loginType,driverId); |
| | | return userInfoService.captchaLogin(phone, code, registIp, registAreaCode,loginType); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | /** |
| | | * 设置绑定司机 |
| | | * @param driverId |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/bindingDriver") |
| | | @ApiOperation(value = "绑定司机", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "司机id", name = "driverId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<LoginWarpper> bindingDriver(Integer driverId,HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | |
| | | // 是否需要绑定司机 |
| | | TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("districtCode", userInfo.getRegistAreaCode()).ge("startTime", new Date()).lt("endTime", new Date()).last(" limit 1")); |
| | | if(tDriverPromotionActivity!=null){ |
| | | if(userInfo.getBindDriverId()==null || userInfo.getBindExpireDate().getTime()<=System.currentTimeMillis()){ |
| | | Integer bindingDays = tDriverPromotionActivity.getBindingDays(); |
| | | // 当前时间+绑定天数 |
| | | Date endTime = DateUtils.addDays(new Date(), bindingDays); |
| | | userInfo.setBindDriverId(driverId); |
| | | userInfo.setBindExpireDate(endTime); |
| | | userInfo.setBindDate(new Date()); |
| | | userInfoService.updateById(userInfo); |
| | | } |
| | | |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Autowired |