feat 解决普通账号登录问题
This commit is contained in:
parent
b4ad8bb3a7
commit
5411b82755
|
|
@ -40,24 +40,23 @@ public class User implements Serializable {
|
|||
@ApiModelProperty("用户电话")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty("用户性别: [1=男, 2=女]")
|
||||
private Integer sex;
|
||||
|
||||
@ApiModelProperty("注册渠道")
|
||||
private Integer channel;
|
||||
|
||||
@ApiModelProperty("是否禁用: [0=否, 1=是]")
|
||||
private Integer isDisable;
|
||||
|
||||
@ApiModelProperty("用户钱包")
|
||||
private BigDecimal userMoney;
|
||||
|
||||
@ApiModelProperty("累计充值")
|
||||
private BigDecimal totalRechargeAmount;
|
||||
|
||||
@ApiModelProperty("注册渠道")
|
||||
private Integer channel;
|
||||
|
||||
// @ApiModelProperty("加密盐巴")
|
||||
// private String salt;
|
||||
|
||||
@ApiModelProperty("用户性别: [1=男, 2=女]")
|
||||
private Integer sex;
|
||||
|
||||
@ApiModelProperty("是否禁用: [0=否, 1=是]")
|
||||
private Integer isDisable;
|
||||
|
||||
@ApiModelProperty("最后登录IP")
|
||||
private String loginIp;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,23 +6,23 @@ public enum ErrorEnum {
|
|||
HIDE_MSG(0, "隐藏信息"),
|
||||
SUCCESS(1, "成功"),
|
||||
FAILED(0, "失败"),
|
||||
PARAMS_VALID_ERROR(310, "参数校验错误"),
|
||||
PARAMS_TYPE_ERROR(311, "参数类型错误"),
|
||||
REQUEST_METHOD_ERROR(312, "请求方法错误"),
|
||||
ASSERT_ARGUMENT_ERROR(313, "断言参数错误"),
|
||||
ASSERT_MYBATIS_ERROR(314, "断言Mybatis错误"),
|
||||
PARAMS_VALID_ERROR(0, "参数校验错误"),
|
||||
PARAMS_TYPE_ERROR(0, "参数类型错误"),
|
||||
REQUEST_METHOD_ERROR(0, "请求方法错误"),
|
||||
ASSERT_ARGUMENT_ERROR(0, "断言参数错误"),
|
||||
ASSERT_MYBATIS_ERROR(0, "断言Mybatis错误"),
|
||||
|
||||
LOGIN_ACCOUNT_ERROR(330, "登录账号或密码错误"),
|
||||
LOGIN_DISABLE_ERROR(331, "登录账号已被禁用了"),
|
||||
TOKEN_EMPTY(332, "token参数为空"),
|
||||
TOKEN_INVALID(333, "token参数无效"),
|
||||
CAPTCHA_ERROR(334, "验证码错误"),
|
||||
PAYMENT_ERROR(335, "发起支付失败"),
|
||||
LOGIN_ACCOUNT_ERROR(0, "登录账号或密码错误"),
|
||||
LOGIN_DISABLE_ERROR(0, "登录账号已被禁用了"),
|
||||
TOKEN_EMPTY(0, "登录超时,请重新登录"),
|
||||
TOKEN_INVALID(0, "token参数无效"),
|
||||
CAPTCHA_ERROR(0, "验证码错误"),
|
||||
PAYMENT_ERROR(0, "发起支付失败"),
|
||||
|
||||
NO_PERMISSION(403, "无相关权限"),
|
||||
REQUEST_404_ERROR(404, "请求接口不存在"),
|
||||
NO_PERMISSION(0, "无相关权限"),
|
||||
REQUEST_404_ERROR(0, "请求接口不存在"),
|
||||
|
||||
SYSTEM_ERROR(500, "系统错误");
|
||||
SYSTEM_ERROR(0, "系统错误");
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
package com.mdd.common.enums;
|
||||
|
||||
public enum UserEnum {
|
||||
|
||||
// 退款类型
|
||||
SEX_OTHER(0, "未知"),
|
||||
SEX_MEN(1, "男"),
|
||||
SEX_WOMAN(2, "女");
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
*/
|
||||
private final int code;
|
||||
private final String msg;
|
||||
UserEnum(int code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态码
|
||||
*
|
||||
* @author fzr
|
||||
* @return Long
|
||||
*/
|
||||
public int getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取提示
|
||||
*
|
||||
* @author fzr
|
||||
* @return String
|
||||
*/
|
||||
public String getMsg() {
|
||||
return this.msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单类型标识
|
||||
*
|
||||
* @author fzr
|
||||
* @param code 编码
|
||||
* @return String
|
||||
*/
|
||||
public static String getSexDesc(Integer code){
|
||||
switch (code) {
|
||||
case 1:
|
||||
return "男";
|
||||
case 2:
|
||||
return "女";
|
||||
}
|
||||
return "未知";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -124,10 +124,10 @@ public class LikeFrontInterceptor implements HandlerInterceptor {
|
|||
if (StringUtils.isNotNull(id)) {
|
||||
Integer userId = Integer.parseInt(id.toString());
|
||||
User user = userMapper.selectOne(new QueryWrapper<User>()
|
||||
.select("id,sn,username")
|
||||
.select("id,sn,account")
|
||||
.eq("id", userId)
|
||||
.eq("is_disable", 0)
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.last("limit 1"));
|
||||
|
||||
Integer uid = StringUtils.isNull(user) ? 0 : userId;
|
||||
|
|
@ -156,9 +156,9 @@ public class LikeFrontInterceptor implements HandlerInterceptor {
|
|||
// 用户信息缓存
|
||||
Integer userId = Integer.parseInt(id.toString());
|
||||
User user = userMapper.selectOne(new QueryWrapper<User>()
|
||||
.select("id,sn,username,nickname,mobile,is_disable")
|
||||
.select("id,sn,account,nickname,mobile,is_disable")
|
||||
.eq("id", userId)
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.last("limit 1"));
|
||||
|
||||
// 删除校验
|
||||
|
|
|
|||
|
|
@ -62,6 +62,18 @@ public class LikeFrontThreadLocal {
|
|||
return Integer.parseInt(adminId.toString());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取登录令牌
|
||||
*/
|
||||
public static String getToken() {
|
||||
Object token = LikeFrontThreadLocal.get("token");
|
||||
if (token == null || token.toString().equals("")) {
|
||||
return "";
|
||||
}
|
||||
return token.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除本地线程
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
package com.mdd.front.cache;
|
||||
|
||||
import com.mdd.common.util.RedisUtils;
|
||||
import com.mdd.common.util.StringUtils;
|
||||
import com.mdd.common.util.YmlUtils;
|
||||
import com.mdd.front.LikeFrontThreadLocal;
|
||||
|
||||
/**
|
||||
* 登录令牌缓存
|
||||
*/
|
||||
public class TokenLoginCache {
|
||||
|
||||
private static final String KEY = "login:front:token:";
|
||||
|
||||
public static Integer get() {
|
||||
Integer terminal = LikeFrontThreadLocal.getTerminal();
|
||||
String token = LikeFrontThreadLocal.getToken();
|
||||
String key = KEY + terminal + ":" + token;
|
||||
Object o = RedisUtils.get(key);
|
||||
if (StringUtils.isNull(o)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Integer.parseInt(o.toString());
|
||||
}
|
||||
|
||||
public static void set(String token, Object id) {
|
||||
int timeout = 7200;
|
||||
if (StringUtils.isNotNull(YmlUtils.get("like.login.timeout"))) {
|
||||
timeout = Integer.parseInt(YmlUtils.get("like.login.timeout"));
|
||||
}
|
||||
|
||||
Integer terminal = LikeFrontThreadLocal.getTerminal();
|
||||
String key = KEY + terminal + ":" + token;
|
||||
RedisUtils.set(key, id, timeout);
|
||||
}
|
||||
|
||||
public static void set(String token, Object id, String terminal) {
|
||||
int timeout = 7200;
|
||||
if (StringUtils.isNotNull(YmlUtils.get("like.login.timeout"))) {
|
||||
timeout = Integer.parseInt(YmlUtils.get("like.login.timeout"));
|
||||
}
|
||||
String key = KEY + terminal + ":" + token;
|
||||
RedisUtils.set(key, id, timeout);
|
||||
}
|
||||
|
||||
public static void del() {
|
||||
Integer terminal = LikeFrontThreadLocal.getTerminal();
|
||||
String token = LikeFrontThreadLocal.getToken();
|
||||
del(terminal, token);
|
||||
}
|
||||
|
||||
public static void del(Integer terminal, String token) {
|
||||
String key = KEY + terminal + ":" + token;
|
||||
System.out.println(key);
|
||||
RedisUtils.del(key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -38,9 +38,9 @@ public class ArticleController {
|
|||
}
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/list")
|
||||
@GetMapping("/lists")
|
||||
@ApiOperation(value="文章列表")
|
||||
public AjaxResult<PageResult<ArticleListedVo>> list(@Validated PageValidate pageValidate,
|
||||
public AjaxResult<PageResult<ArticleListedVo>> lists(@Validated PageValidate pageValidate,
|
||||
@Validated ArticleSearchValidate searchValidate) {
|
||||
Integer userId = LikeFrontThreadLocal.getUserId();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.mdd.front.controller;
|
||||
|
||||
import com.mdd.common.aop.NotLogin;
|
||||
import com.mdd.common.aop.NotPower;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import com.mdd.front.LikeFrontThreadLocal;
|
||||
import com.mdd.front.service.ILoginService;
|
||||
|
|
@ -14,6 +15,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
|
@ -31,22 +33,22 @@ public class LoginController {
|
|||
@ApiOperation(value="注册账号")
|
||||
public AjaxResult<Object> register(@Validated @RequestBody RegisterValidate registerValidate) {
|
||||
Integer terminal = LikeFrontThreadLocal.getTerminal();
|
||||
String username = registerValidate.getUsername();
|
||||
String account = registerValidate.getAccount();
|
||||
String password = registerValidate.getPassword();
|
||||
|
||||
iLoginService.register(username, password, terminal);
|
||||
iLoginService.register(account, password, terminal);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@NotLogin
|
||||
@PostMapping("/accountLogin")
|
||||
@PostMapping("/account")
|
||||
@ApiOperation(value="账号登录")
|
||||
public AjaxResult<LoginTokenVo> accountLogin(@Validated @RequestBody LoginPwdValidate loginPwdValidate) {
|
||||
public AjaxResult<LoginTokenVo> account(@Validated @RequestBody LoginPwdValidate loginPwdValidate) {
|
||||
Integer terminal = LikeFrontThreadLocal.getTerminal();
|
||||
String username = loginPwdValidate.getUsername();
|
||||
String account = loginPwdValidate.getAccount();
|
||||
String password = loginPwdValidate.getPassword();
|
||||
|
||||
LoginTokenVo vo = iLoginService.accountLogin(username, password, terminal);
|
||||
LoginTokenVo vo = iLoginService.accountLogin(account, password, terminal);
|
||||
return AjaxResult.success(vo);
|
||||
}
|
||||
|
||||
|
|
@ -115,4 +117,12 @@ public class LoginController {
|
|||
return AjaxResult.success(vo);
|
||||
}
|
||||
|
||||
@NotLogin
|
||||
@PostMapping("/logout")
|
||||
@ApiOperation(value="退出登录")
|
||||
public AjaxResult<Object> logout() {
|
||||
iLoginService.logout();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,18 +17,18 @@ public interface ILoginService {
|
|||
* @param password 密码
|
||||
* @param terminal 终端
|
||||
*/
|
||||
void register(String username, String password, Integer terminal);
|
||||
void register(String account, String password, Integer terminal);
|
||||
|
||||
/**
|
||||
* 账号登录
|
||||
*
|
||||
* @author fzr
|
||||
* @param username 账号
|
||||
* @param account 账号
|
||||
* @param password 密码
|
||||
* @param terminal 终端
|
||||
* @return LoginTokenVo
|
||||
*/
|
||||
LoginTokenVo accountLogin(String username, String password, Integer terminal);
|
||||
LoginTokenVo accountLogin(String account, String password, Integer terminal);
|
||||
|
||||
/**
|
||||
* 手机登录
|
||||
|
|
@ -90,4 +90,11 @@ public interface ILoginService {
|
|||
*/
|
||||
LoginTokenVo scanLogin(String code, String state, Integer terminal, HttpSession session);
|
||||
|
||||
/**
|
||||
* @notes 退出登录
|
||||
* @param $userInfo
|
||||
* @return bool
|
||||
* @author damonyuan
|
||||
*/
|
||||
void logout();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public class ArticleServiceImpl implements IArticleService {
|
|||
Integer pageSize = pageValidate.getPage_size();
|
||||
|
||||
QueryWrapper<Article> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("id,title,image,intro,visit,create_time");
|
||||
queryWrapper.select("id,cid,title,`desc`,image,click_virtual,click_actual,create_time");
|
||||
queryWrapper.isNull("delete_time");
|
||||
queryWrapper.eq("is_show", 1);
|
||||
|
||||
|
|
@ -102,7 +102,8 @@ public class ArticleServiceImpl implements IArticleService {
|
|||
if (StringUtils.isNotNull(searchValidate.getSort())) {
|
||||
switch (searchValidate.getSort()) {
|
||||
case "hot": // 最热
|
||||
queryWrapper.orderByDesc(Arrays.asList("visit", "id"));
|
||||
//queryWrapper.orderByDesc(Arrays.asList("click_actual + click_virtual", "id"));
|
||||
queryWrapper.orderByDesc("click_actual + click_virtual").orderByDesc("id");
|
||||
break;
|
||||
case "new": // 最新
|
||||
queryWrapper.orderByDesc("id");
|
||||
|
|
@ -122,6 +123,7 @@ public class ArticleServiceImpl implements IArticleService {
|
|||
vo.setCollect(false);
|
||||
vo.setImage(UrlUtils.toAbsoluteUrl(article.getImage()));
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(article.getCreateTime()));
|
||||
vo.setClick(article.getClickActual() + article.getClickVirtual());
|
||||
list.add(vo);
|
||||
|
||||
ids.add(article.getId());
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.mdd.common.plugin.notice.NoticeCheck;
|
|||
import com.mdd.common.plugin.wechat.WxMnpDriver;
|
||||
import com.mdd.common.util.*;
|
||||
import com.mdd.front.cache.ScanLoginCache;
|
||||
import com.mdd.front.cache.TokenLoginCache;
|
||||
import com.mdd.front.service.ILoginService;
|
||||
import com.mdd.front.vo.login.LoginTokenVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -55,11 +56,11 @@ public class LoginServiceImpl implements ILoginService {
|
|||
* @param terminal 总端
|
||||
*/
|
||||
@Override
|
||||
public void register(String username, String password, Integer terminal) {
|
||||
public void register(String account, String password, Integer terminal) {
|
||||
User model = userMapper.selectOne(new QueryWrapper<User>()
|
||||
.select("id,sn,username")
|
||||
.eq("username", username)
|
||||
.eq("is_delete", 0)
|
||||
.select("id,sn,account")
|
||||
.eq("account", account)
|
||||
.isNull("delete_time")
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.isNull(model, "账号已存在,换一个吧!");
|
||||
|
|
@ -71,7 +72,7 @@ public class LoginServiceImpl implements ILoginService {
|
|||
User user = new User();
|
||||
user.setSn(sn);
|
||||
user.setNickname("用户"+sn);
|
||||
user.setAccount(username);
|
||||
user.setAccount(account);
|
||||
user.setPassword(pwd);
|
||||
user.setAvatar("/api/static/default_avatar.png");
|
||||
user.setChannel(terminal);
|
||||
|
|
@ -85,16 +86,15 @@ public class LoginServiceImpl implements ILoginService {
|
|||
* 账号登录
|
||||
*
|
||||
* @author fzr
|
||||
* @param username 账号
|
||||
* @param account 账号
|
||||
* @param password 密码
|
||||
* @return LoginTokenVo
|
||||
*/
|
||||
@Override
|
||||
public LoginTokenVo accountLogin(String username, String password, Integer terminal) {
|
||||
public LoginTokenVo accountLogin(String account, String password, Integer terminal) {
|
||||
User user = userMapper.selectOne(new QueryWrapper<User>()
|
||||
.select("id,username,password,salt,mobile,is_disable,is_new")
|
||||
.eq("username", username)
|
||||
.eq("is_delete", 0)
|
||||
.eq("account", account)
|
||||
.isNull("delete_time")
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(user, "账号不存在!");
|
||||
|
|
@ -301,6 +301,11 @@ public class LoginServiceImpl implements ILoginService {
|
|||
return this.__wxLoginHandle(openId, unionId, avatar, nickname, terminal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logout() {
|
||||
TokenLoginCache.del();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理微信登录
|
||||
*
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.mdd.common.entity.user.User;
|
|||
import com.mdd.common.entity.user.UserAuth;
|
||||
import com.mdd.common.enums.ClientEnum;
|
||||
import com.mdd.common.enums.NoticeEnum;
|
||||
import com.mdd.common.enums.UserEnum;
|
||||
import com.mdd.common.exception.OperateException;
|
||||
import com.mdd.common.mapper.user.UserAuthMapper;
|
||||
import com.mdd.common.mapper.user.UserMapper;
|
||||
|
|
@ -54,8 +55,8 @@ public class UserServiceImpl implements IUserService {
|
|||
@Override
|
||||
public UserCenterVo center(Integer userId, Integer terminal) {
|
||||
User user = userMapper.selectOne(new QueryWrapper<User>()
|
||||
.select("id,sn,avatar,real_name,nickname,account,mobile,user_money,is_new_user,password")
|
||||
.eq("id", userId)
|
||||
.select("id,sn,sex,account,nickname,real_name,avatar,mobile,create_time,is_new_user,user_money,password")
|
||||
.eq("id", userId).isNull("delete_time")
|
||||
.last("limit 1"));
|
||||
|
||||
UserCenterVo vo = new UserCenterVo();
|
||||
|
|
@ -67,19 +68,20 @@ public class UserServiceImpl implements IUserService {
|
|||
vo.setAvatar(UrlUtils.toAbsoluteUrl(user.getAvatar()));
|
||||
}
|
||||
|
||||
vo.setIsBindWechat(false);
|
||||
vo.setIsAuth(false);
|
||||
if (terminal.equals(ClientEnum.OA.getCode()) || terminal.equals(ClientEnum.MNP.getCode())) {
|
||||
UserAuth userAuth = userAuthMapper.selectOne(new QueryWrapper<UserAuth>()
|
||||
.select("id,openid,terminal")
|
||||
.eq("user_id", userId)
|
||||
.eq("terminal", terminal)
|
||||
.last("limit 1"));
|
||||
vo.setIsBindWechat(userAuth != null);
|
||||
vo.setIsAuth(userAuth != null);
|
||||
}
|
||||
|
||||
// 是否有设置登录密码
|
||||
vo.setHasPwd(StringUtils.isNotBlank(user.getPassword()));
|
||||
|
||||
vo.setHasPassword(StringUtils.isNotBlank(user.getPassword()));
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(user.getCreateTime()));
|
||||
vo.setSex(UserEnum.getSexDesc(user.getSex()));
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
|
@ -93,7 +95,7 @@ public class UserServiceImpl implements IUserService {
|
|||
@Override
|
||||
public UserInfoVo info(Integer userId) {
|
||||
User user = userMapper.selectOne(new QueryWrapper<User>()
|
||||
.select("id,sn,avatar,real_name,nickname,account,mobile,password,sex,create_time")
|
||||
.select("id,sn,sex,account,password,nickname,real_name,avatar,mobile,create_time,user_money")
|
||||
.eq("id", userId)
|
||||
.last("limit 1"));
|
||||
|
||||
|
|
@ -104,10 +106,10 @@ public class UserServiceImpl implements IUserService {
|
|||
|
||||
UserInfoVo vo = new UserInfoVo();
|
||||
BeanUtils.copyProperties(user, vo);
|
||||
vo.setIsPassword(!user.getPassword().equals(""));
|
||||
vo.setIsBindMnp(userAuth != null);
|
||||
vo.setHasPassword(!user.getPassword().equals(""));
|
||||
vo.setHasAuth(userAuth != null);
|
||||
vo.setVersion(GlobalConfig.version);
|
||||
vo.setSex(user.getSex());
|
||||
vo.setSex(UserEnum.getSexDesc(user.getSex()));
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(user.getCreateTime()));
|
||||
|
||||
if (!user.getAvatar().equals("")) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class ArticleSearchValidate implements Serializable {
|
|||
@ApiModelProperty(value = "关键词")
|
||||
private String keyword;
|
||||
|
||||
@StringContains(values = {"hot", "new"})
|
||||
@StringContains(values = {"hot", "new", "default"})
|
||||
@ApiModelProperty(value = "排序号")
|
||||
private String sort;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public class LoginPwdValidate {
|
|||
@NotNull(message = "username参数缺失")
|
||||
@NotEmpty(message = "账号不能为空")
|
||||
@ApiModelProperty(value = "登录账号", required = true)
|
||||
private String username;
|
||||
private String account;
|
||||
|
||||
@NotNull(message = "password参数缺失")
|
||||
@NotEmpty(message = "密码不能为空")
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ public class RegisterValidate implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "username参数缺失")
|
||||
@NotNull(message = "账号缺失")
|
||||
@NotEmpty(message = "账号不能为空")
|
||||
@Length(min = 3, max = 12, message = "账号必须在3~12个字符内")
|
||||
@Pattern(message = "账号应该为3-12位数字、字母组合", regexp="^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{3,12}$")
|
||||
@ApiModelProperty(value = "登录账号", required = true)
|
||||
private String username;
|
||||
private String account;
|
||||
|
||||
@NotNull(message = "password参数缺失")
|
||||
@NotEmpty(message = "密码不能为空")
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ public class ArticleListedVo implements Serializable {
|
|||
@ApiModelProperty(value = "文章ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "分类ID")
|
||||
private Integer cid;
|
||||
|
||||
@ApiModelProperty(value = "文章标题")
|
||||
private String title;
|
||||
|
||||
|
|
@ -22,10 +25,10 @@ public class ArticleListedVo implements Serializable {
|
|||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "文章简介")
|
||||
private String intro;
|
||||
private String desc;
|
||||
|
||||
@ApiModelProperty(value = "浏览数量")
|
||||
private Integer visit;
|
||||
private Integer click;
|
||||
|
||||
@ApiModelProperty(value = "是否收藏")
|
||||
private Boolean collect;
|
||||
|
|
|
|||
|
|
@ -18,32 +18,38 @@ public class UserCenterVo implements Serializable {
|
|||
|
||||
@ApiModelProperty(value = "用户编号")
|
||||
private Integer sn;
|
||||
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
@ApiModelProperty("用户头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
@ApiModelProperty("真实姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
@ApiModelProperty("用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "用户账号")
|
||||
private String username;
|
||||
@ApiModelProperty("用户账号")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "手机号码")
|
||||
@ApiModelProperty("用户电话")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "钱包余额")
|
||||
private BigDecimal money;
|
||||
@ApiModelProperty("创建时间")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty(value = "是否新用户")
|
||||
private Integer isNew;
|
||||
@ApiModelProperty("是否为新用户: [0=否, 1=是]")
|
||||
private Integer isNewUser;
|
||||
|
||||
@ApiModelProperty(value = "是否绑定微信")
|
||||
private Boolean isBindWechat;
|
||||
@ApiModelProperty("有密码")
|
||||
private Boolean hasPassword;
|
||||
|
||||
@ApiModelProperty("用户性别: [1=男, 2=女]")
|
||||
private String sex;
|
||||
|
||||
@ApiModelProperty("用户钱包")
|
||||
private BigDecimal userMoney;
|
||||
|
||||
@ApiModelProperty("是否绑定微信")
|
||||
private Boolean isAuth;
|
||||
|
||||
@ApiModelProperty(value = "是否有设置登录密码")
|
||||
private Boolean hasPwd;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "个人信息Vo")
|
||||
|
|
@ -17,49 +18,40 @@ public class UserInfoVo implements Serializable {
|
|||
|
||||
@ApiModelProperty(value = "用户编号")
|
||||
private Integer sn;
|
||||
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
@ApiModelProperty("用户头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
@ApiModelProperty("真实姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
@ApiModelProperty("用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "用户账号")
|
||||
private String username;
|
||||
@ApiModelProperty("用户账号")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "手机号码")
|
||||
@ApiModelProperty("用户电话")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "用户性别")
|
||||
private String sex;
|
||||
|
||||
@ApiModelProperty(value = "是否设置密码")
|
||||
private Boolean isPassword;
|
||||
|
||||
@ApiModelProperty(value = "是否绑定微信")
|
||||
private Boolean isBindMnp;
|
||||
|
||||
@ApiModelProperty(value = "版本信息")
|
||||
private String version;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@ApiModelProperty("创建时间")
|
||||
private String createTime;
|
||||
|
||||
public void setSex(Integer sex) {
|
||||
switch (sex) {
|
||||
case 0:
|
||||
this.sex = "未知";
|
||||
break;
|
||||
case 1:
|
||||
this.sex = "男";
|
||||
break;
|
||||
case 2:
|
||||
this.sex = "女";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ApiModelProperty("是否为新用户: [0=否, 1=是]")
|
||||
private Integer isNewUser;
|
||||
|
||||
@ApiModelProperty("有密码")
|
||||
private Boolean hasPassword;
|
||||
|
||||
@ApiModelProperty("用户性别: [1=男, 2=女]")
|
||||
private String sex;
|
||||
|
||||
@ApiModelProperty("用户钱包")
|
||||
private BigDecimal userMoney;
|
||||
|
||||
@ApiModelProperty("是否绑定微信")
|
||||
private Boolean hasAuth;
|
||||
|
||||
@ApiModelProperty("版本")
|
||||
private String version;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ mybatis-plus:
|
|||
|
||||
# Sa-token配置
|
||||
sa-token:
|
||||
token-name: like-token # token的名称
|
||||
token-name: token # token的名称
|
||||
timeout: 2592000 # token有效期单位s(默认30天,-1代表永不过期)
|
||||
activity-timeout: -1 # token临时有效期(指定时间无操作掉线)
|
||||
is-concurrent: true # 是否允许同一账号并发登录
|
||||
|
|
|
|||
Loading…
Reference in New Issue