123
This commit is contained in:
@@ -4,7 +4,9 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.util.PhoneUtil;
|
||||
import com.ruoyi.cai.auth.*;
|
||||
import com.ruoyi.cai.domain.User;
|
||||
import com.ruoyi.cai.dto.app.vo.LoginVo;
|
||||
import com.ruoyi.cai.enums.CodeEnum;
|
||||
import com.ruoyi.cai.manager.CurrentUserManager;
|
||||
import com.ruoyi.cai.service.SmsVerifyService;
|
||||
import com.ruoyi.cai.service.UserService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
@@ -36,10 +38,12 @@ public class AuthAppController {
|
||||
private SmsVerifyService smsVerifyService;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private CurrentUserManager currentUserManager;
|
||||
|
||||
@PostMapping("/register")
|
||||
@Operation(summary = "注册")
|
||||
@Log(title = "用户主播入驻协议", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
@Log(title = "注册", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
public R<Map<String, Object>> register(@Validated @RequestBody CaiRegisterUser caiUser){
|
||||
boolean mobile = PhoneUtil.isMobile(caiUser.getUsername());
|
||||
if(!mobile){
|
||||
@@ -53,7 +57,7 @@ public class AuthAppController {
|
||||
|
||||
@PostMapping("/register/code")
|
||||
@Operation(summary = "获取注册验证码")
|
||||
@Log(title = "用户主播入驻协议", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
@Log(title = "获取注册验证码", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
public R<Map<String,String>> registerCode(@Validated @RequestBody RegisterCode code){
|
||||
boolean mobile = PhoneUtil.isMobile(code.getMobile());
|
||||
if(!mobile){
|
||||
@@ -65,7 +69,7 @@ public class AuthAppController {
|
||||
|
||||
@PostMapping("/resetPassword/code")
|
||||
@Operation(summary = "获取重置密码验证码")
|
||||
@Log(title = "用户主播入驻协议", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
@Log(title = "获取重置密码验证码", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
public R<Map<String,String>> resetPasswordCode(@Validated @RequestBody RegisterCode code){
|
||||
boolean mobile = PhoneUtil.isMobile(code.getMobile());
|
||||
if(!mobile){
|
||||
@@ -81,17 +85,18 @@ public class AuthAppController {
|
||||
|
||||
@PostMapping("/login")
|
||||
@Operation(summary = "登陆")
|
||||
@Log(title = "用户主播入驻协议", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
public R<Map<String,Object>> login(@Validated @RequestBody LoginCaiUser loginBody){
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
@Log(title = "登陆", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
public R<LoginVo> login(@Validated @RequestBody LoginCaiUser loginBody){
|
||||
LoginVo vo = new LoginVo();
|
||||
String token = caiLoginManager.login(loginBody.getUsername(), loginBody.getPassword());
|
||||
ajax.put("token",token);
|
||||
return R.ok(ajax);
|
||||
vo.setToken(token);
|
||||
vo.setUserInfo(currentUserManager.currentInfo());
|
||||
return R.ok(vo);
|
||||
}
|
||||
|
||||
@PostMapping("/resetPassword")
|
||||
@Operation(summary = "重置密码")
|
||||
@Log(title = "用户主播入驻协议", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
@Log(title = "重置密码", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
public R<Boolean> resetPassword(@RequestBody ResetPasswordReq code){
|
||||
caiLoginManager.resetPassword(code);
|
||||
return R.ok(true);
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.ruoyi.cai.dto.app.query.AlbumResetReq;
|
||||
import com.ruoyi.cai.dto.app.query.IdRes;
|
||||
import com.ruoyi.cai.dto.app.query.UserUpdateReq;
|
||||
import com.ruoyi.cai.dto.app.vo.CurrentUserInfoVo;
|
||||
import com.ruoyi.cai.dto.app.vo.user.CurrentUserUpdateInfoVo;
|
||||
import com.ruoyi.cai.dto.app.vo.user.MemberInfoVo;
|
||||
import com.ruoyi.cai.manager.CurrentUserManager;
|
||||
import com.ruoyi.cai.service.UserAlbumService;
|
||||
@@ -40,6 +41,13 @@ public class UserAppController {
|
||||
return R.ok(currentUserManager.currentInfo());
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary = "当前用户信息(用于编辑用户的时候查询,带审核数据)")
|
||||
@Log(title = "当前用户信息", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
public R<CurrentUserUpdateInfoVo> currentUpdateInfo(){
|
||||
return R.ok(currentUserManager.currentUpdateInfo());
|
||||
}
|
||||
|
||||
@GetMapping("/member")
|
||||
@Operation(summary = "当前会员信息")
|
||||
@Log(title = "当前会员信息", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
@@ -53,6 +61,12 @@ public class UserAppController {
|
||||
return R.ok(userMemberService.memberApp(userId,type));
|
||||
}
|
||||
|
||||
/*@PostMapping("/update/one")
|
||||
@Operation(summary = "完善用户必填信息")
|
||||
@Log(title = "完善用户必填信息", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
public R<Boolean> finishUser(@Validated @RequestBody FinishUserUpdateReq res){
|
||||
return R.ok(currentUserManager.finishUser(res));
|
||||
}*/
|
||||
|
||||
@PostMapping("/update")
|
||||
@Operation(summary = "修改当前用户信息")
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ruoyi.cai.dto.app.query;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class FinishUserUpdateReq {
|
||||
@Schema(description = "用户ID",accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Long userId;
|
||||
@Schema(description = "城市")
|
||||
@NotNull(message = "城市不能为空")
|
||||
private Integer cityId;
|
||||
@Schema(description = "昵称")
|
||||
private String nickname;
|
||||
@Schema(description = "生日")
|
||||
@NotNull(message = "生日必填")
|
||||
private LocalDate birthday;
|
||||
@Schema(description = "性别")
|
||||
@NotNull(message = "性别必填")
|
||||
private Integer gender;
|
||||
@Schema(description = "头像")
|
||||
private String avatar;
|
||||
}
|
||||
@@ -82,8 +82,8 @@ public class CurrentUserInfoVo {
|
||||
/**
|
||||
* 相册
|
||||
*/
|
||||
@Schema(description = "相册")
|
||||
private List<UserAlbumDTO> userAlbumList;
|
||||
// @Schema(description = "相册")
|
||||
// private List<UserAlbumDTO> userAlbumList;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ruoyi.cai.dto.app.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LoginVo {
|
||||
private String token;
|
||||
private CurrentUserInfoVo userInfo;
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.ruoyi.cai.dto.app.vo.user;
|
||||
|
||||
import com.ruoyi.cai.enums.AuditStatusEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CurrentUserUpdateInfoVo implements Serializable {
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户号/ID号
|
||||
*/
|
||||
@Schema(description = "蜜瓜号")
|
||||
private String usercode;
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@Schema(description = "昵称")
|
||||
private String nickname;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@Schema(description = "审核头像对象")
|
||||
private Avatar auditAvatar;
|
||||
/**
|
||||
* 头像状态,0 系统默认头像,1 用户自定义头像
|
||||
*/
|
||||
@Schema(description = "头像状态 0-默认 1-自定义")
|
||||
private Integer avatarState;
|
||||
/**
|
||||
* 性别 0 未知 1 女 2 男
|
||||
*/
|
||||
@Schema(description = "性别 0-未知 1-女 2-男")
|
||||
private Integer gender;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Schema(description = "生日")
|
||||
private LocalDate birthday;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
@Schema(description = "城市ID")
|
||||
private Integer cityId;
|
||||
@Schema(description = "城市")
|
||||
private String city;
|
||||
/**
|
||||
* 是否是播主 0 否 1 是
|
||||
*/
|
||||
@Schema(description = "主播 0-否 1-是")
|
||||
private Integer isAnchor;
|
||||
/**
|
||||
* 开启视频接听 0 未开启 1 已开启
|
||||
*/
|
||||
@Schema(description = "开启视频接听 0-否 1-是")
|
||||
private Integer openVideoStatus;
|
||||
/**
|
||||
* 状态 0 可用 1 不可用
|
||||
*/
|
||||
@Schema(description = "可用状态 0-可用 1-封禁")
|
||||
private Integer status;
|
||||
/**
|
||||
* 资料是否完成 0 未完成 1已完成
|
||||
*/
|
||||
@Schema(description = "资料是否完成 0 未完成 1已完成")
|
||||
private Integer finishStatus;
|
||||
|
||||
/**
|
||||
* 相册
|
||||
*/
|
||||
@Schema(description = "相册")
|
||||
private List<UserAlbumDTO> userAlbumList;
|
||||
|
||||
|
||||
@Schema(description = "头像修改模型")
|
||||
@Data
|
||||
public static class Avatar {
|
||||
@Schema(description = "头像")
|
||||
private String avatar;
|
||||
@Schema(description = "状态 0-未审核 1-审核通过 2-审核未通过")
|
||||
private Integer auditStatus = AuditStatusEnum.SUCCESS.getCode();
|
||||
@Schema(description = "审核时间")
|
||||
private LocalDateTime auditTime;
|
||||
/**
|
||||
* 审核备注
|
||||
*/
|
||||
@Schema(description = "审核备注")
|
||||
private String auditRemark;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.ruoyi.cai.dto.app.vo.user;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -28,7 +27,7 @@ public class UserAlbumDTO {
|
||||
* 状态 0 未审核 1 审核通过 2 审核未通过
|
||||
*/
|
||||
@Schema(description = "状态 0-未审核 1-审核通过 2-审核未通过")
|
||||
private Integer status;
|
||||
private Integer auditStatus;
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
@@ -40,6 +39,4 @@ public class UserAlbumDTO {
|
||||
@Schema(description = "审核备注")
|
||||
private String auditRemark;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer orderBy;
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cai.domain.*;
|
||||
import com.ruoyi.cai.dto.app.query.AccountAliBankCardRes;
|
||||
import com.ruoyi.cai.dto.app.query.AnchorUpdateReq;
|
||||
import com.ruoyi.cai.dto.app.query.FinishUserUpdateReq;
|
||||
import com.ruoyi.cai.dto.app.query.UserUpdateReq;
|
||||
import com.ruoyi.cai.dto.app.vo.AnchorVo;
|
||||
import com.ruoyi.cai.dto.app.vo.CurrentUserInfoVo;
|
||||
import com.ruoyi.cai.dto.app.vo.user.CurrentUserUpdateInfoVo;
|
||||
import com.ruoyi.cai.dto.app.vo.user.UserAccountVo;
|
||||
import com.ruoyi.cai.dto.app.vo.user.UserAlbumDTO;
|
||||
import com.ruoyi.cai.dto.app.vo.user.UserCountVo;
|
||||
@@ -59,6 +61,21 @@ public class CurrentUserManager {
|
||||
res.setUserCount(BeanConvertUtil.convertTo(userCount, UserCountVo::new));
|
||||
Account account = accountService.getByUserId(userId);
|
||||
res.setUserAccount(BeanConvertUtil.convertTo(account, UserAccountVo::new));
|
||||
// List<UserAlbum> userAlbums = userAlbumService.listByUserId(userId);
|
||||
// res.setUserAlbumList(BeanConvertUtil.convertListTo(userAlbums, UserAlbumDTO::new));
|
||||
return res;
|
||||
}
|
||||
|
||||
public CurrentUserUpdateInfoVo currentUpdateInfo() {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
User user = userService.getById(userId);
|
||||
CurrentUserUpdateInfoVo res = BeanConvertUtil.convertTo(user, CurrentUserUpdateInfoVo::new);
|
||||
CurrentUserUpdateInfoVo.Avatar avatar = new CurrentUserUpdateInfoVo.Avatar();
|
||||
avatar.setAvatar(user.getAvatar());
|
||||
res.setAuditAvatar(avatar);
|
||||
res.setUserId(userId);
|
||||
Anchor anchor = anchorService.getByUserId(userId);
|
||||
res.setOpenVideoStatus(anchor == null ? 1 : anchor.getOpenVideoStatus());
|
||||
List<UserAlbum> userAlbums = userAlbumService.listByUserId(userId);
|
||||
res.setUserAlbumList(BeanConvertUtil.convertListTo(userAlbums, UserAlbumDTO::new));
|
||||
return res;
|
||||
@@ -170,4 +187,6 @@ public class CurrentUserManager {
|
||||
bankcard.setCardAccount(res.getCardAccount());
|
||||
accountBankcardService.saveOrUpdate(bankcard);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user