|
@@ -65,8 +65,11 @@ class WeixinController extends Controller {
|
|
|
assert(code, 'code不能为空');
|
|
|
assert(state, 'state不能为空');
|
|
|
console.log('code-->' + code);
|
|
|
-
|
|
|
const { weixin } = this.ctx.service;
|
|
|
+ const key = `visit:auth:state:${state}`;
|
|
|
+ const val = await this.app.redis.get(key);
|
|
|
+ console.log(key);
|
|
|
+ console.log(val);
|
|
|
let openid;
|
|
|
try {
|
|
|
({ openid } = await weixin.fetch(code));
|
|
@@ -77,8 +80,7 @@ class WeixinController extends Controller {
|
|
|
console.log('function in');
|
|
|
console.log('openid--->' + openid);
|
|
|
if (openid) {
|
|
|
- const key = `visit:auth:state:${state}`;
|
|
|
- const val = await this.app.redis.get(key);
|
|
|
+
|
|
|
const { redirect_uri, type, uid, qrcode, msgid, objid } = JSON.parse(val);
|
|
|
console.log('redirect_uri-->' + redirect_uri);
|
|
|
const user = await this.ctx.service.user.findByOpenid(openid);
|