debug
This commit is contained in:
parent
1867438ac6
commit
8d7830b86f
|
|
@ -77,6 +77,25 @@ public class WxMnpDriver {
|
||||||
return wxMpService;
|
return wxMpService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信开放平台
|
||||||
|
*
|
||||||
|
* @author fzr
|
||||||
|
* @return WxMpService
|
||||||
|
*/
|
||||||
|
public static WxMpService openSetting() {
|
||||||
|
Map<String, String> config = ConfigUtils.get("open_platform");
|
||||||
|
|
||||||
|
WxMpDefaultConfigImpl wxMpDefaultConfig = new WxMpDefaultConfigImpl();
|
||||||
|
wxMpDefaultConfig.setAppId(config.getOrDefault("app_id", "").trim());
|
||||||
|
wxMpDefaultConfig.setSecret(config.getOrDefault("app_secret", "").trim());
|
||||||
|
wxMpDefaultConfig.setToken(config.getOrDefault("token", "").trim());
|
||||||
|
wxMpDefaultConfig.setAesKey(config.getOrDefault("encoding_aes_key", "").trim());
|
||||||
|
wxMpService.setWxMpConfigStorage(wxMpDefaultConfig);
|
||||||
|
|
||||||
|
return wxMpService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取授权页ticket
|
* 获取授权页ticket
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -193,15 +193,10 @@ public class LoginServiceImpl implements ILoginService {
|
||||||
@Override
|
@Override
|
||||||
public LoginTokenVo officeLogin(String code, Integer terminal) {
|
public LoginTokenVo officeLogin(String code, Integer terminal) {
|
||||||
try {
|
try {
|
||||||
WxMpService wxMpService = WxMnpDriver.oa();
|
WxMpService wxMpService = WxMnpDriver.openSetting();
|
||||||
WxOAuth2AccessToken wxOAuth2AccessToken = wxMpService.getOAuth2Service().getAccessToken(code);
|
WxOAuth2AccessToken wxOAuth2AccessToken = wxMpService.getOAuth2Service().getAccessToken(code);
|
||||||
String uniId = wxOAuth2AccessToken.getUnionId();
|
String uniId = wxOAuth2AccessToken.getUnionId();
|
||||||
String openId = wxOAuth2AccessToken.getOpenId();
|
String openId = wxOAuth2AccessToken.getOpenId();
|
||||||
|
|
||||||
System.out.println("uniId:" + uniId);
|
|
||||||
System.out.println("openId:" + openId);
|
|
||||||
|
|
||||||
|
|
||||||
String unionId = uniId == null ? "0" : uniId;
|
String unionId = uniId == null ? "0" : uniId;
|
||||||
|
|
||||||
String avatar = "";
|
String avatar = "";
|
||||||
|
|
@ -231,7 +226,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String oaCodeUrl(String url) {
|
public String oaCodeUrl(String url) {
|
||||||
WxMpService wxMpService = WxMnpDriver.oa();
|
WxMpService wxMpService = WxMnpDriver.openSetting();
|
||||||
WxMpOAuth2ServiceImpl wxMpOAuth2Service = new WxMpOAuth2ServiceImpl(wxMpService);
|
WxMpOAuth2ServiceImpl wxMpOAuth2Service = new WxMpOAuth2ServiceImpl(wxMpService);
|
||||||
String state = ToolUtils.makeMd5(ToolUtils.makeToken());
|
String state = ToolUtils.makeMd5(ToolUtils.makeToken());
|
||||||
return wxMpOAuth2Service.buildAuthorizationUrl(url, WxConsts.OAuth2Scope.SNSAPI_USERINFO, state);
|
return wxMpOAuth2Service.buildAuthorizationUrl(url, WxConsts.OAuth2Scope.SNSAPI_USERINFO, state);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue