| | |
| | | import com.ruoyi.account.wx.model.WeixinProperties; |
| | | import com.ruoyi.account.wx.tools.WxAppletTools; |
| | | import com.ruoyi.account.util.GiveVipUtil; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.aspectj.weaver.loadtime.Aj; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | |
| | | private ExchangeOrderClient exchangeOrderClient; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | | @Resource |
| | | private TAppUserSignService signService; |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "更换手机号", tags = {"小程序-用户管理-更换手机号"}) |
| | | @PostMapping(value = "/user/updatePhone") |
| | | public AjaxResult<String> updatePhone(@Validated @RequestBody UpdatePhoneDTO dto) { |
| | | String code = redisService.getCacheObject(dto.getPhone() + Constants.APPLET); |
| | | if(StringUtils.isEmpty(code)){ |
| | | return AjaxResult.error("验证码已过期,请重新获取验证码!"); |
| | | } |
| | | if(!code.equals(dto.getCode())){ |
| | | return AjaxResult.error("验证码错误!"); |
| | | } |
| | | // 获取当前用户信息 |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser appUser = appUserService.getById(userId); |
| | | appUser.setPhone(dto.getPhone()); |
| | | appUserService.updateById(appUser); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id查询用户信息 |
| | | * @param appUserIds 用户id |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 通过手机号查询用户 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @GetMapping("/user/selectByPhone") |
| | | public R<TAppUser> selectByPhone(@RequestParam("phone") String phone){ |
| | | return R.ok(appUserService.getOne(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getPhone,phone) |
| | | .last("LIMIT 1"))); |
| | | } |
| | | |
| | | // @ApiOperation(value = "签到", tags = {"小程序-个人中心-签到"}) |
| | | // @PostMapping(value = "/user/sign") |