|
|
|
|
@ -1,14 +1,19 @@
|
|
|
|
|
package com.flossom.miniProgram.controller;
|
|
|
|
|
|
|
|
|
|
import com.flossom.common.core.constant.Constants;
|
|
|
|
|
import com.flossom.common.core.domain.R;
|
|
|
|
|
import com.flossom.common.core.domain.SysFile;
|
|
|
|
|
import com.flossom.common.core.exception.ServiceException;
|
|
|
|
|
import com.flossom.common.core.utils.StringUtils;
|
|
|
|
|
import com.flossom.common.core.web.controller.BaseController;
|
|
|
|
|
import com.flossom.common.core.web.domain.AjaxResult;
|
|
|
|
|
import com.flossom.miniProgram.domain.vo.UserMemberUpdateVo;
|
|
|
|
|
import com.flossom.miniProgram.service.IWxUserMemberService;
|
|
|
|
|
import com.flossom.system.api.RemoteFileService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import javax.validation.constraints.Size;
|
|
|
|
|
@ -20,6 +25,9 @@ public class UserMemberController extends BaseController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private IWxUserMemberService wxUserMemberService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RemoteFileService remoteFileService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 登录接口
|
|
|
|
|
*
|
|
|
|
|
@ -59,7 +67,17 @@ public class UserMemberController extends BaseController {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/updateUser")
|
|
|
|
|
public R updateUser(@RequestBody @Validated UserMemberUpdateVo userMemberUpdateVo) {
|
|
|
|
|
public R updateUser(@RequestParam(value = "file", required = false) MultipartFile file, @Validated UserMemberUpdateVo userMemberUpdateVo) {
|
|
|
|
|
if (file != null) {
|
|
|
|
|
R<SysFile> result = remoteFileService.upload(file);
|
|
|
|
|
if (result.getCode() != Constants.SUCCESS) {
|
|
|
|
|
logger.error("上传头像失败");
|
|
|
|
|
throw new ServiceException("上传头像失败");
|
|
|
|
|
}
|
|
|
|
|
userMemberUpdateVo.setHeadimg(result.getData().getUrl());
|
|
|
|
|
} else {
|
|
|
|
|
userMemberUpdateVo.setHeadimg(null);
|
|
|
|
|
}
|
|
|
|
|
return R.ok(wxUserMemberService.updateUser(userMemberUpdateVo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|