多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
获取access_token ` string access_token = ConfigHelper.GetValue("access");` ` //小马哥牛X if (string.IsNullOrEmpty(access_token)) { if (!AccessTokenContainer.CheckRegistered(appId))//检查是否已经注册 { AccessTokenContainer.Register(appId, appSecret);//如果没有注册则进行注册 } access_token = AccessTokenContainer.GetAccessTokenResult(appId).access_token; ConfigHelper.SetAppSetting("access", access_token); //写进ConfigHelper.GetValue("access"); } ` ` if (!string.IsNullOrEmpty(access_token)) { UserInfoJson userInfo = null; try { userInfo = UserApi.Info(access_token, openid); } catch { userInfo = null; } if (userInfo != null) { lv = userInfo.subscribe; } else { if (!AccessTokenContainer.CheckRegistered(appId))//检查是否已经注册 { AccessTokenContainer.Register(appId, appSecret);//如果没有注册则进行注册 } access_token = AccessTokenContainer.GetAccessTokenResult(appId).access_token; ConfigHelper.SetAppSetting("access", access_token); try { userInfo = UserApi.Info(access_token, openid); //获取 } catch { userInfo = null; } if (userInfo != null) { lv = userInfo.subscribe; } else { lv = 0; } } } `