diff --git a/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/controller/UserController.java b/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/controller/UserController.java index 6a5d98b..c35282d 100644 --- a/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/controller/UserController.java +++ b/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/controller/UserController.java @@ -8,6 +8,7 @@ import com.fanxb.bookmark.common.util.UserContextHolder; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; /** * 类功能简述: @@ -63,6 +64,17 @@ public class UserController { return Result.success(userService.getUserInfo(UserContextHolder.get().getUserId())); } + + /** + * 修改用户头像 + * + * @param file 头像文件 + */ + @PostMapping("/icon") + public Result pushIcon(@RequestParam("file") MultipartFile file) { + return Result.success(userService.updateIcon(file)); + } + /** * Description: 用户登录 * diff --git a/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/service/UserService.java b/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/service/UserService.java index be84311..24359f5 100644 --- a/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/service/UserService.java +++ b/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/service/UserService.java @@ -11,6 +11,7 @@ import com.fanxb.bookmark.common.exception.FormDataException; import com.fanxb.bookmark.common.util.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; import java.util.HashMap; import java.util.Map; @@ -155,4 +156,13 @@ public class UserService { public User getUserInfo(int userId) { return userDao.selectByUserId(userId); } + + /** + * 修改用户头像 + * @param file file + * @return 修改后的路径 + */ + public String updateIcon(MultipartFile file){ + return "asdf"; + } } diff --git a/bookMarkService/pom.xml b/bookMarkService/pom.xml index 73ef8bc..01671fe 100644 --- a/bookMarkService/pom.xml +++ b/bookMarkService/pom.xml @@ -1 +1 @@ - 4.0.0 com.fanxb bookMarkService pom 1.0-SNAPSHOT common business web utf-8 utf-8 11 org.springframework.boot spring-boot-starter-parent 2.1.6.RELEASE org.elasticsearch.client elasticsearch-rest-high-level-client 7.2.0 org.elasticsearch elasticsearch 7.2.0 org.elasticsearch.client elasticsearch-rest-client 7.2.0 org.springframework.boot spring-boot-starter-web \ No newline at end of file + 4.0.0 com.fanxb bookMarkService pom 1.0-SNAPSHOT common business web utf-8 utf-8 8 org.springframework.boot spring-boot-starter-parent 2.1.6.RELEASE org.elasticsearch.client elasticsearch-rest-high-level-client 7.2.0 org.elasticsearch elasticsearch 7.2.0 org.elasticsearch.client elasticsearch-rest-client 7.2.0 org.springframework.boot spring-boot-starter-web \ No newline at end of file diff --git a/bookMarkService/web/src/main/resources/application.yml b/bookMarkService/web/src/main/resources/application.yml index e74b703..e87e17e 100644 --- a/bookMarkService/web/src/main/resources/application.yml +++ b/bookMarkService/web/src/main/resources/application.yml @@ -66,3 +66,6 @@ es: host: localhost port: 9200 scheme: http + +# 默认文件上传基路径 +fileSavePath: ./