mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2024-12-22 20:54:26 +08:00
feat:微信小程序用户登录逻辑
This commit is contained in:
parent
e66a8445e8
commit
cd73d8bb9b
@ -1,10 +1,6 @@
|
||||
package com.youlai.mall.oms.api;
|
||||
|
||||
import com.youlai.common.result.Result;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author haoxr
|
||||
|
@ -53,7 +53,6 @@ public class OAuthController {
|
||||
@ApiIgnore Principal principal,
|
||||
@ApiIgnore @RequestParam Map<String, String> parameters
|
||||
) throws HttpRequestMethodNotSupportedException {
|
||||
JwtTokenPair jwtTokenPair = new JwtTokenPair();
|
||||
|
||||
/**
|
||||
* 获取登录认证的客户端ID
|
||||
@ -64,18 +63,14 @@ public class OAuthController {
|
||||
*/
|
||||
String clientId = JwtUtils.getAuthClientId();
|
||||
OAuthClientEnum client = OAuthClientEnum.getByClientId(clientId);
|
||||
|
||||
switch (client) {
|
||||
case WEAPP: // 微信小程序
|
||||
jwtTokenPair = weAppService.login(parameters);
|
||||
break;
|
||||
return Result.success(weAppService.login(parameters));
|
||||
case TEST: // knife4j接口测试文档使用 client_id/client_secret : client/123456
|
||||
return tokenEndpoint.postAccessToken(principal, parameters).getBody();
|
||||
default:
|
||||
// oAuth2AccessToken = tokenEndpoint.postAccessToken(principal, parameters).getBody();
|
||||
break;
|
||||
return Result.success(tokenEndpoint.postAccessToken(principal, parameters).getBody());
|
||||
}
|
||||
return Result.success(jwtTokenPair);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "注销", notes = "logout")
|
||||
|
@ -53,6 +53,7 @@ public class WeAppService {
|
||||
public JwtTokenPair login(Map<String, String> parameters) {
|
||||
|
||||
String code = parameters.get("code");
|
||||
String userInfo = parameters.get("userInfo");
|
||||
|
||||
if (StrUtil.isBlank(code)) {
|
||||
throw new BizException("code不能为空");
|
||||
|
Loading…
Reference in New Issue
Block a user