上传头像功能实现
This commit is contained in:
@@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
@@ -236,6 +237,17 @@ public class UserController {
|
||||
sysUserService.changePassword(request.getUserId(), request.getOldPassword(), request.getNewPassword());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户头像:校验图片(非空/≤20MB/扩展名白名单)→ 压缩 → 存储并写入 profile_picture,<br>
|
||||
* 返回新头像完整 Web URL。multipart 直传(form 字段 userId + 文件 part file)。<br>
|
||||
* 与修改密码一致,仅由过滤器层强制应用签名;POST 自动记 OapiLog(文件内容不落库,仅记文件名元数据)。
|
||||
*/
|
||||
@PostMapping("profilePicture")
|
||||
public String profilePicture(@RequestParam("userId") Integer userId,
|
||||
@RequestParam("file") MultipartFile file) {
|
||||
return sysUserService.changeProfilePicture(userId, file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户在指定组上的状态(转出/恢复)。<br>
|
||||
* state=1 转出、state=0 恢复正常;仅作关系标记,不影响成员查询、组织链与下游推送。
|
||||
|
||||
Reference in New Issue
Block a user