| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private TAppUserCarService carService; |
| | | @Resource |
| | | private IntegralRuleClient integralRuleClient; |
| | | |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | |
| | | @Resource |
| | |
| | | @GetMapping(value = "/user/set/avatar") |
| | | public R avatar(String url) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | String fileName = redisTemplate.opsForValue().get("file:" + userId).toString(); |
| | | String substring = url.substring(url.lastIndexOf("/") + 1); |
| | | if(StringUtils.isEmpty(fileName) || fileName.equals(substring)){ |
| | | return R.fail("请重新上传头像"); |
| | | } |
| | | |
| | | TAppUser byId = appUserService.getById(userId); |
| | | byId.setAvatar(url); |
| | | appUserService.updateById(byId); |