小程序code换取openId
This commit is contained in:
@@ -16,6 +16,7 @@ import com.czg.sa.MyStpLogic;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.account.util.AlipayUtil;
|
||||
import com.czg.service.account.util.WechatAuthUtil;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -32,6 +33,17 @@ public class UserAuthorizationServiceImpl implements UserAuthorizationService {
|
||||
@Resource
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
@Override
|
||||
public String getOpenId(String code, String source) {
|
||||
String openId;
|
||||
if (UserAuthSourceEnum.WECHAT.getValue().equals(code)) {
|
||||
openId = wechatAuthUtil.getSessionKeyOrOpenId(code);
|
||||
}else {
|
||||
openId = alipayUtil.getOpenId(code);
|
||||
}
|
||||
return openId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginTokenDTO login(UserAuthorizationLoginDTO userAuthorizationLoginDTO) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user