|
@@ -1,6 +1,7 @@
|
|
package cn.com.ctop.okr.controller;
|
|
package cn.com.ctop.okr.controller;
|
|
|
|
|
|
import cn.com.ctop.okr.entity.QYWxUserInfo;
|
|
import cn.com.ctop.okr.entity.QYWxUserInfo;
|
|
|
|
+import cn.com.ctop.okr.qywx.constant.QYWxConstant;
|
|
import cn.com.ctop.okr.service.CorpUserInfoService;
|
|
import cn.com.ctop.okr.service.CorpUserInfoService;
|
|
import cn.com.ctop.okr.service.QYWxService;
|
|
import cn.com.ctop.okr.service.QYWxService;
|
|
import cn.com.ctop.okr.utils.JwtUtil;
|
|
import cn.com.ctop.okr.utils.JwtUtil;
|
|
@@ -102,23 +103,23 @@ public class LoginController {
|
|
public Result<JSONObject> wxlogin(@RequestParam(name = "code") String code) throws Exception {
|
|
public Result<JSONObject> wxlogin(@RequestParam(name = "code") String code) throws Exception {
|
|
Result<JSONObject> result = new Result<>();
|
|
Result<JSONObject> result = new Result<>();
|
|
val configStorage = new WxCpDefaultConfigImpl();
|
|
val configStorage = new WxCpDefaultConfigImpl();
|
|
- //configStorage.setCorpId(QYWxConstant.QYWX_CORP_ID);
|
|
|
|
- //configStorage.setAgentId(QYWxConstant.QYWX_AGENT_ID);
|
|
|
|
- //configStorage.setCorpSecret(QYWxConstant.QYWX_CORP_SECRET);
|
|
|
|
- //configStorage.setToken("hcst2019");
|
|
|
|
- //configStorage.setAesKey("hcst2019");
|
|
|
|
-
|
|
|
|
- configStorage.setCorpId("ww24b8a47826f5875f");
|
|
|
|
- configStorage.setAgentId(1000002);
|
|
|
|
- configStorage.setCorpSecret("MJIlySADGPlgvADnkFQPUpfZD4yV-4WN6066OgNnb0s");
|
|
|
|
|
|
+ configStorage.setCorpId(QYWxConstant.QYWX_CORP_ID);
|
|
|
|
+ configStorage.setAgentId(QYWxConstant.QYWX_AGENT_ID);
|
|
|
|
+ configStorage.setCorpSecret(QYWxConstant.QYWX_CORP_SECRET);
|
|
configStorage.setToken("hcst2019");
|
|
configStorage.setToken("hcst2019");
|
|
configStorage.setAesKey("hcst2019");
|
|
configStorage.setAesKey("hcst2019");
|
|
|
|
+
|
|
|
|
+ //configStorage.setCorpId("ww24b8a47826f5875f");
|
|
|
|
+ //configStorage.setAgentId(1000002);
|
|
|
|
+ //configStorage.setCorpSecret("MJIlySADGPlgvADnkFQPUpfZD4yV-4WN6066OgNnb0s");
|
|
|
|
+ //configStorage.setToken("hcst2019");
|
|
|
|
+ //configStorage.setAesKey("hcst2019");
|
|
val service = new WxCpServiceImpl();
|
|
val service = new WxCpServiceImpl();
|
|
|
|
|
|
service.setWxCpConfigStorage(configStorage);
|
|
service.setWxCpConfigStorage(configStorage);
|
|
WxCpOAuth2Service wxCpOAuth2Service = service.getOauth2Service();
|
|
WxCpOAuth2Service wxCpOAuth2Service = service.getOauth2Service();
|
|
try {
|
|
try {
|
|
- WxCpOauth2UserInfo userInfo = wxCpOAuth2Service.getUserInfo(1000002, code);
|
|
|
|
|
|
+ WxCpOauth2UserInfo userInfo = wxCpOAuth2Service.getUserInfo(QYWxConstant.QYWX_AGENT_ID, code);
|
|
if (userInfo != null && userInfo.getUserId() != null) {
|
|
if (userInfo != null && userInfo.getUserId() != null) {
|
|
//WxCpUserService wxCpUserService = new WxCpUserServiceImpl(service);
|
|
//WxCpUserService wxCpUserService = new WxCpUserServiceImpl(service);
|
|
//WxCpUser user = wxCpUserService.getById(userInfo.getUserId());
|
|
//WxCpUser user = wxCpUserService.getById(userInfo.getUserId());
|