com.nxyfan.framework.auth.controller.AuthClientController Maven / Gradle / Ivy
package com.nxyfan.framework.auth.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nxyfan.framework.auth.core.annotation.SaClientCheckLogin;
import com.nxyfan.framework.core.enums.SaClientTypeEnum;
import com.nxyfan.framework.core.param.AuthAccountPasswordLoginParam;
import com.nxyfan.framework.core.param.AuthGetPhoneValidCodeParam;
import com.nxyfan.framework.core.param.AuthPhoneValidCodeLoginParam;
import com.nxyfan.framework.core.result.AuthPicValidCodeResult;
import com.nxyfan.framework.core.service.AuthService;
import com.nxyfan.framework.common.pojo.CommonResult;
import com.nxyfan.framework.core.pojo.SaBaseClientLoginUser;
import com.nxyfan.framework.core.util.StpClientUtil;
import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
/**
* C端登录控制器
*
* @author xuyuxiang
* @date 2021/12/23 21:50
*/
@Api(tags = "C端登录控制器")
@ApiSupport(author = "Nxyfan Caoyang", order = 2)
@RestController
@Validated
public class AuthClientController {
@Resource
private AuthService authService;
/**
* C端获取图片验证码
*
* @author xuyuxiang
* @date 2022/7/8 9:26
**/
@ApiOperationSupport(order = 1)
@ApiOperation("C端获取图片验证码")
@GetMapping("/auth/c/getPicCaptcha")
public CommonResult getPicCaptcha() {
return CommonResult.data(authService.getPicCaptcha(SaClientTypeEnum.C.getValue()));
}
/**
* C端获取手机验证码
*
* @author xuyuxiang
* @date 2022/7/8 9:26
**/
@ApiOperationSupport(order = 2)
@ApiOperation("C端获取手机验证码")
@GetMapping("/auth/c/getPhoneValidCode")
public CommonResult getPhoneValidCode(@Valid AuthGetPhoneValidCodeParam authGetPhoneValidCodeParam) {
return CommonResult.data(authService.getPhoneValidCode(authGetPhoneValidCodeParam, SaClientTypeEnum.C.getValue()));
}
/**
* C端账号密码登录
*
* @author xuyuxiang
* @date 2021/10/15 13:12
**/
@ApiOperationSupport(order = 3)
@ApiOperation("C端账号密码登录")
@PostMapping("/auth/c/doLogin")
public CommonResult