| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.contstant.RedisConstant; |
| | | import com.ruoyi.system.dto.UpdatePhoneDto; |
| | | import com.ruoyi.system.dto.UpdateUserDto; |
| | | import com.ruoyi.system.enums.UserTypeEnum; |
| | | import com.ruoyi.system.model.TAppUser; |
| | | import com.ruoyi.system.service.TAppUserService; |
| | | import com.ruoyi.system.service.TCommissionTransactionFlowService; |
| | | import com.ruoyi.system.utils.wx.WxQrCodeUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 个人中心相关接口 |
| | |
| | | private final TAppUserService tAppUserService; |
| | | private final TokenService tokenService; |
| | | private final TCommissionTransactionFlowService commissionTransactionFlowService; |
| | | private final WxQrCodeUtil wxQrCodeUtil; |
| | | private final RedisTemplate redisTemplate; |
| | | |
| | | @ApiOperation(value = "个人中心--用户信息",response = TAppUser.class) |
| | | @GetMapping(value = "/getUserInfo") |
| | | public R<TAppUser> getUserInfo() { |
| | | Integer userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser appUser = tAppUserService.getById(userId); |
| | | if (!appUser.getUserType().equals(UserTypeEnum.VISITOR.getCode())) { |
| | | Object cache = redisTemplate.opsForValue().get(RedisConstant.APP_USER_WX_IMG + appUser.getId()); |
| | | if (Objects.isNull(cache)) { |
| | | if (StringUtils.isNotBlank(appUser.getCode())) { |
| | | // 获取推广码 |
| | | String qrCodeBase64 = null; |
| | | try { |
| | | qrCodeBase64 = wxQrCodeUtil.getQrCodeBase64(appUser.getCode(), 2, RedisConstant.APP_USER_WX_IMG + appUser.getId()); |
| | | } catch (Exception e) { |
| | | log.error("生成推广二维码失败,用户ID:{}", appUser.getId(), e); |
| | | } |
| | | appUser.setPromotionQrCode(qrCodeBase64); |
| | | |
| | | return R.ok(); |
| | | } |
| | | } else { |
| | | appUser.setPromotionQrCode(cache.toString()); |
| | | } |
| | | } |
| | | //todo 查询预估积分 |
| | | return R.ok(appUser); |
| | | } |
| | | |
| | | @ApiOperation(value = "个人中心--修改手机号") |