💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
获取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; } } } `