private static void LoadData(bool force = false) { if (apps == null || apps.Count <= 0 || force) { Tauth_AppCollection daAppCollection = new Tauth_AppCollection(); daAppCollection.ListAll(); apps.Clear(); foreach (Tauth_App daApp in daAppCollection) { OAuthApp app = new OAuthApp { App_Code = daApp.App_Code, Access_Token = daApp.Access_Token, App_Host = daApp.App_Host, App_Id = daApp.App_Id, App_Name = daApp.App_Name, Create_Time = daApp.Create_Time, Is_Internal = daApp.Is_Internal, Logo_Url = daApp.Logo_Url, Remarks = daApp.Remarks, Secret_Key = daApp.Secret_Key, Status = daApp.Status, UID_Encrypt_Key = daApp.Uid_Encrypt_Key }; apps.Add(app); } } }
/// <summary> /// 获取授权登录app信息 /// </summary> /// <param name="appid"></param> /// <returns></returns> public static OAuthApp GetOAuthApp(int appid) { LoadData(); OAuthApp app = apps.Find(it => appid == it.App_Id); if (app == null) { LoadData(true); app = apps.Find(it => it.App_Id == appid); } return(app); }
/// <summary> /// 获取授权登录app信息 /// </summary> /// <param name="appCode"></param> /// <returns></returns> public static OAuthApp GetOAuthApp(string appCode) { LoadData(); OAuthApp app = apps.Find(it => string.Equals(appCode, it.App_Code, StringComparison.OrdinalIgnoreCase)); if (app == null) { LoadData(true); app = apps.Find(it => string.Equals(appCode, it.App_Code, StringComparison.OrdinalIgnoreCase)); } return(app); }