完整管理员登陆接口的开发
This commit is contained in:
@@ -6,6 +6,7 @@ import cn.iocoder.mall.userweb.controller.passport.dto.UserPassportLoginBySmsDTO
|
||||
import cn.iocoder.mall.userweb.controller.passport.dto.UserPassportSendSmsCodeDTO;
|
||||
import cn.iocoder.mall.userweb.controller.passport.vo.UserPassportVO;
|
||||
import cn.iocoder.mall.userweb.manager.passport.UserPassportManager;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -16,6 +17,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@Api(tags = "用户 Passport API")
|
||||
@RestController
|
||||
@RequestMapping("/passport")
|
||||
public class UserPassportController {
|
||||
|
||||
@@ -5,8 +5,10 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel("用户短信验证码登陆 DTO")
|
||||
@@ -14,11 +16,15 @@ import java.io.Serializable;
|
||||
@Accessors(chain = true)
|
||||
public class UserPassportLoginBySmsDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "手机号", example = "15601691234")
|
||||
@ApiModelProperty(value = "手机号", required = true, example = "15601691300")
|
||||
@NotEmpty(message = "手机号不能为空")
|
||||
@Mobile
|
||||
private String mobile;
|
||||
@ApiModelProperty(value = "验证码", example = "1234")
|
||||
@NotNull(message = "验证码不能为空")
|
||||
|
||||
@ApiModelProperty(value = "手机验证码", required = true, example = "1024")
|
||||
@NotEmpty(message = "手机验证码不能为空")
|
||||
@Length(min = 4, max = 6, message = "手机验证码长度为 4-6 位")
|
||||
@Pattern(regexp = "^[0-9]+$", message = "手机验证码必须都是数字")
|
||||
private String code;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,57 +1,41 @@
|
||||
package cn.iocoder.mall.userweb.controller.passport.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户通信证信息
|
||||
*/
|
||||
@ApiModel("用户通信证信息 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserPassportVO {
|
||||
|
||||
/**
|
||||
* 认证信息
|
||||
*/
|
||||
@ApiModel("认证信息")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Authentication {
|
||||
|
||||
/**
|
||||
* 访问令牌
|
||||
*/
|
||||
@ApiModelProperty(value = "访问令牌", required = true, example = "001e8f49b20e47f7b3a2de774497cd50")
|
||||
private String accessToken;
|
||||
/**
|
||||
* 刷新令牌
|
||||
*/
|
||||
@ApiModelProperty(value = "刷新令牌", required = true, example = "001e8f49b20e47f7b3a2de774497cd50")
|
||||
private String refreshToken;
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
@ApiModelProperty(value = "过期时间", required = true)
|
||||
private Date expiresTime;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
@ApiModel("用户信息")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class User {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@ApiModelProperty(value = "用户昵称", required = true, example = "小王")
|
||||
private String nickname;
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@ApiModelProperty(value = "用户头像", required = true, example = "http://www.iocoder.cn/image")
|
||||
private String avatar;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
package cn.iocoder.mall.userweb.controller.user;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
@Api(tags = "用户信息 API")
|
||||
public class UserController {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user