/// <summary> /// 获取与彩种无相关的TDK /// </summary> /// <param name="arg"></param> /// <returns></returns> private List <SystemTdkViewEntity> GetNotHasLotterySystemTdk(SystemTdkArgEntity arg) { if (!string.IsNullOrEmpty(arg.AreaCode)) { string[] codeArr = arg.AreaCode.Split("|".ToCharArray()); //StringBuilder builder = new StringBuilder(); string[] lotterycodeArr = new string[codeArr.Length]; for (int i = 0; i < codeArr.Length; i++) { lotterycodeArr[i] = codeArr[i]; } //string str = builder.ToString().Substring(0, builder.ToString().Length - 1); //string sql = $"select [Name],[Title],[Desc],[Keyword],[LotteryCode] from dbo.Base_SiteTDK where LotteryCode in({str})"; //DataTable data = commonBll.ExcuteSqlDataTable(sql, DatabaseLinksEnum.Base); //List<SystemTdkViewEntity> res = data.DataTableToList<SystemTdkViewEntity>(); //return res; List <SystemTdkViewEntity> data = GetTDKData(); data = data.Where(d => lotterycodeArr.Contains(d.LotteryCode)).ToList(); return(data); } return(null); }
public HttpResponseMessage GetSystemTdks(SystemTdkArgEntity arg) { BaseJson <List <SystemTdkViewEntity> > resultMsg = new BaseJson <List <SystemTdkViewEntity> > { Status = (int)JsonObjectStatus.Error, Message = "服务器未知错误。", Data = null }; Logger(typeof(CommonController), arg.TryToJson(), "获取系统TDK-GetSystemTdks", () => { if (!string.IsNullOrEmpty(arg.t)) { if (arg.t.CheckTimeStamp()) { //{ "MainPageTDK", "LotteryTDK", "SpecialTDK", "OpeningNumberTDK", "TestNumberTDK", "PlayTDK", "CommonTDK" }; List <SystemTdkViewEntity> res = new List <SystemTdkViewEntity>(); switch (arg.AreaCode) { case "MainPageTDK": res = GetNotHasLotterySystemTdk(arg); break; case "SpecialTDK": res = GetNotHasLotterySystemTdk(arg); break; case "CommonTDK": res = GetNotHasLotterySystemTdk(arg); break; case "LotteryTDK": res = GetHasLotterySystemTdk(arg); break; case "OpeningNumberTDK": res = GetHasLotterySystemTdk(arg); break; case "TestNumberTDK": res = GetHasLotterySystemTdk(arg); break; case "PlayTDK": res = GetHasLotterySystemTdk(arg); break; default: arg.AreaCode = "CommonTDK"; arg.EnumCode = ""; res = GetNotHasLotterySystemTdk(arg); break; } resultMsg = new BaseJson <List <SystemTdkViewEntity> > { Status = (int)JsonObjectStatus.Success, Data = res, Message = JsonObjectStatus.Success.GetEnumText(), BackUrl = null }; } else { resultMsg = new BaseJson <List <SystemTdkViewEntity> > { Status = (int)JsonObjectStatus.Fail, Data = null, Message = JsonObjectStatus.Fail.GetEnumText() + ",无效参数。", BackUrl = null }; } } else { resultMsg = new BaseJson <List <SystemTdkViewEntity> > { Status = (int)JsonObjectStatus.Fail, Data = null, Message = JsonObjectStatus.Fail.GetEnumText() + ",请求参数为空。", BackUrl = null }; } }, e => { resultMsg = new BaseJson <List <SystemTdkViewEntity> > { Status = (int)JsonObjectStatus.Exception, Data = null, Message = JsonObjectStatus.Exception.GetEnumText() + ",异常信息:" + e.Message, BackUrl = null }; }); return(resultMsg.TryToJson().ToHttpResponseMessage()); }