mirror of
https://gitee.com/likeadmin/likeadmin_java.git
synced 2026-09-07 07:07:57 +08:00
增加公众号登录
This commit is contained in:
@@ -55,6 +55,9 @@ public class LoginController {
|
||||
case "account":
|
||||
map = iLoginService.accountLogin(params);
|
||||
break;
|
||||
case "office":
|
||||
map = iLoginService.officeLogin();
|
||||
break;
|
||||
}
|
||||
return AjaxResult.success(map);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,14 @@ public interface ILoginService {
|
||||
*/
|
||||
Map<String, Object> accountLogin(Map<String, String> params);
|
||||
|
||||
/**
|
||||
* 公众号登录
|
||||
*
|
||||
* @author fzr
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> officeLogin();
|
||||
|
||||
/**
|
||||
* 忘记密码
|
||||
*
|
||||
|
||||
@@ -17,7 +17,10 @@ import com.mdd.common.utils.*;
|
||||
import com.mdd.front.config.FrontConfig;
|
||||
import com.mdd.front.service.ILoginService;
|
||||
import com.mdd.front.validate.RegParam;
|
||||
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -256,6 +259,25 @@ public class LoginServiceImpl implements ILoginService {
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 公众号登录
|
||||
*
|
||||
* @author fzr
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> officeLogin() {
|
||||
WxMpService wxMpService = WeChatUtil.official();
|
||||
try {
|
||||
WxOAuth2AccessToken wxOAuth2AccessToken = wxMpService.getOAuth2Service().getAccessToken("aaa");
|
||||
WxMpUser wxMpUser = wxMpService.getUserService().userInfo(wxOAuth2AccessToken.getAccessToken());
|
||||
System.out.println(wxMpUser);
|
||||
} catch (WxErrorException e) {
|
||||
System.out.println(e.getError());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 忘记密码
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user