fix:小程序的登录接口添加
parent
4a1ae2d75a
commit
eb434732cf
|
@ -19,6 +19,7 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -69,6 +70,22 @@ public class AuthController {
|
|||
return loginVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序登录(示例)
|
||||
*
|
||||
* @param xcxCode 小程序code
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation("小程序登录")
|
||||
@PostMapping("/xcxLogin")
|
||||
public LoginVo xcxLogin(@NotBlank(message = "{xcx.appId.not.blank}") String appId,@NotBlank(message = "{xcx.code.not.blank}") String xcxCode) {
|
||||
LoginVo loginVo = new LoginVo();
|
||||
// 生成令牌
|
||||
String token = loginService.xcxLogin(appId,xcxCode);
|
||||
loginVo.setToken(token);
|
||||
return loginVo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
|
|
|
@ -172,7 +172,7 @@ public class SysLoginService {
|
|||
// 生成token
|
||||
LoginHelper.loginByDevice(loginUser, DeviceType.XCX);
|
||||
|
||||
// recordLoginInfo(loginUser.getTenantId(), user.getNickName(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"));
|
||||
recordLoginInfo(loginUser.getTenantId(), user.getNickName(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"));
|
||||
// recordLoginInfo(user.getId());
|
||||
return StpUtil.getTokenValue();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue