Commit 624f004e authored by shiyu's avatar shiyu

获取openid

parent c15a08d6
......@@ -54,9 +54,9 @@ public class WxLoginManager {
try {
WxMaJscode2SessionResult result = this.wxMaService.getUserService().getSessionInfo(loginCode);
openId = result.getOpenid();
logger.info("获取openId成功 openId :{}", openId);
logger.info("loginCode:{},获取openId成功 openId :{}", loginCode, openId);
} catch (Exception e) {
logger.error("获取微信登录用户的openId失败", e);
logger.error("loginCode:{}, 获取微信登录用户的openId失败:{}", loginCode, e);
}
return openId;
}
......
package com.wwdz.ch.wx.manager;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.*;
@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
public class WxLoginManagerTest {
@Autowired
WxLoginManager wxLoginManager;
@Test
public void getWxOpenId() {
String code = "0c3ngB000UtjQQ1LBJ000kE8X02ngB0L";
wxLoginManager.getWxOpenId(code);
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment