增加公众号登录
This commit is contained in:
parent
30e6033b02
commit
0817050b1b
|
|
@ -55,6 +55,9 @@ public class LoginController {
|
||||||
case "account":
|
case "account":
|
||||||
map = iLoginService.accountLogin(params);
|
map = iLoginService.accountLogin(params);
|
||||||
break;
|
break;
|
||||||
|
case "office":
|
||||||
|
map = iLoginService.officeLogin();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return AjaxResult.success(map);
|
return AjaxResult.success(map);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,14 @@ public interface ILoginService {
|
||||||
*/
|
*/
|
||||||
Map<String, Object> accountLogin(Map<String, String> params);
|
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.config.FrontConfig;
|
||||||
import com.mdd.front.service.ILoginService;
|
import com.mdd.front.service.ILoginService;
|
||||||
import com.mdd.front.validate.RegParam;
|
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.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.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
|
@ -256,6 +259,25 @@ public class LoginServiceImpl implements ILoginService {
|
||||||
return response;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 忘记密码
|
* 忘记密码
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue