From e1d07590869b1cf6d09edc2bee67c2e7386d835d Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 21 二月 2025 09:34:34 +0800
Subject: [PATCH] 补充管理后台文件上传

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
index 56cd613..5178dc2 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -52,6 +52,7 @@
 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;
@@ -63,6 +64,7 @@
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 /**
@@ -120,6 +122,9 @@
     private TAppUserCarService carService;
     @Resource
     private IntegralRuleClient integralRuleClient;
+    
+    @Resource
+    private RedisTemplate redisTemplate;
 
 
     @Resource
@@ -715,6 +720,12 @@
     @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);
@@ -969,6 +980,10 @@
     public R<TAppUser> getUserById(@PathVariable Long id){
         TAppUser appUser = appUserService.getById(id);
         return R.ok(appUser);
+    }
+    @PostMapping(value = "/user/getAllUser")
+    public R<List<TAppUser>> getAllUser(){
+        return R.ok(appUserService.list(null));
     }
 
 
@@ -1324,8 +1339,16 @@
                 return R.ok(result3);
         }
     }
-    
-    
+
+
+    public static void main(String[] args) {
+//        String reqStr1 = MsgUtil.codeMsg("19983174515", "123456");
+//        String result1 = HttpUtils.post(MsgConstants.SEND_URL, reqStr1);
+
+        String reqStr3 = MsgUtil.faultMsg("18398968484", "长河服务区充电站(遂", "123");
+        String result3 = HttpUtils.post(MsgConstants.SEND_URL, reqStr3);
+        System.err.println(result3);
+    }
     @PostMapping(value = "/user/logOut")
     @ApiOperation(value = "退出登录", tags = {"小程序-个人中心"})
     public AjaxResult logOut(){

--
Gitblit v1.7.1