TrendChartController.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Net.Http;
  6. using System.Web.Http;
  7. using Lottomat.Application.Busines.InformationManage;
  8. using Lottomat.Application.Busines.SystemManage;
  9. using Lottomat.Application.Cache;
  10. using Lottomat.Application.Code;
  11. using Lottomat.Application.Entity.PublicInfoManage;
  12. using Lottomat.Application.Entity.SystemManage;
  13. using Lottomat.Application.Entity.ViewModel.ConsultationMangerModel;
  14. using Lottomat.Application.Entity.ViewModel.TrendChartModel;
  15. using Lottomat.SOA.API.Controllers.Base;
  16. using Lottomat.Util.Extension;
  17. using Lottomat.Util.WebControl;
  18. using Lottomat.Application.Entity.CommonEntity;
  19. using Lottomat.Application.Entity.InformationManage;
  20. using Lottomat.Application.Entity.SystemManage.ViewModel;
  21. using Lottomat.Application.Entity.LotteryNumberManage.Parameter;
  22. using TrendChartMain;
  23. using Lottomat.Application.Entity.LotteryNumberManage.ViewModel;
  24. using Lottery.Entity.TrendChart;
  25. using Lottery.Entity;
  26. using System.Data;
  27. using Lottomat.Utils.Date;
  28. using Lottomat.Utils;
  29. using System.Text;
  30. using Lottomat.Util;
  31. using Lottomat.Application.Busines.CommonManage;
  32. namespace Lottomat.SOA.API.Controllers.V1
  33. {
  34. public class TrendChartController : BaseApiController
  35. {
  36. private static readonly TrendChartBLL TrendChartBll = new TrendChartBLL();
  37. /// <summary>
  38. /// 公共BLL
  39. /// </summary>
  40. private static readonly CommonBLL commonBll = new CommonBLL();
  41. //private static readonly string[] types = { "QGC", "DFC", "GPC11X5", "GPCK3", "GPCKL12", "GPCKLSF" , "GPCQTC" };
  42. private static readonly DataItemCache dataItemCache = new DataItemCache();
  43. #region 查询走势图链接
  44. /// <summary>
  45. /// 查询走势图链接
  46. /// </summary>
  47. /// <returns></returns>
  48. [HttpPost]
  49. public HttpResponseMessage GetTrendChartNewsList(TrendChart arg)
  50. {
  51. BaseJson<List<TrendChart_Preview>> resultMsg = new BaseJson<List<TrendChart_Preview>> { Status = (int)JsonObjectStatus.Error, Message = "服务器未知错误。", Data = null };
  52. Logger(typeof(TrendChartController), arg.TryToJson(), "查询走势图链接-GetTrendChartNewsList", () =>
  53. {
  54. if (!string.IsNullOrEmpty(arg.Category))
  55. {
  56. List<TrendChart_Preview> res = Cache.Factory.CacheFactory.Cache().GetCache<List<TrendChart_Preview>>("__" + arg.Category + "__");
  57. if (res == null)
  58. {
  59. res = new List<TrendChart_Preview>();
  60. //如果传入为 GPC 的话,就默认返回高频彩11选5相关数据
  61. List<DataItemModel> data = dataItemCache.GetDataItemList(arg.Category.Equals("GPC") ? "GPC11X5" : arg.Category).OrderBy(n => n.SortCode).ToList();
  62. string[] ids = data.Select(d => d.ItemDetailId).ToArray();
  63. //获取该分类下符合要求的数据
  64. List<TrendChartEntity> trendChartEntities = GetCacheTrendChartList().Where(n=>ids.Contains(n.CategoryId)).OrderBy(n => n.SortCode).ToList();
  65. if (trendChartEntities.Count > 0)
  66. {
  67. //组装父级相关属性
  68. TrendChart_Preview previewItem = new TrendChart_Preview
  69. {
  70. TrendChartType = arg.Category,
  71. ItemName = dataItemCache.GetDataItemEntityByCode(arg.Category).ItemName
  72. };
  73. //根据分类ID进行分组
  74. IEnumerable<IGrouping<string, TrendChartEntity>> group = trendChartEntities.GroupBy(t => t.CategoryId);
  75. List<TempTrendChartPreviewItem> temp = new List<TempTrendChartPreviewItem>();
  76. foreach (IGrouping<string, TrendChartEntity> chartEntities in group)
  77. {
  78. //分类ID
  79. string key = chartEntities.Key;
  80. //获取分类信息
  81. DataItemDetailEntity dataItemEntity = dataItemCache.GetDataItemEntityById(key);
  82. List<TrendChartPreviewItem> trendChartPreviewItems = new List<TrendChartPreviewItem>();
  83. //组装项目相关属性
  84. TempTrendChartPreviewItem item = new TempTrendChartPreviewItem
  85. {
  86. TrendChartChildType = dataItemEntity.ItemValue,
  87. TrendChartChildName = dataItemEntity.ItemName
  88. };
  89. //组装具体信息
  90. foreach (TrendChartEntity entity in chartEntities)
  91. {
  92. TrendChartPreviewItem p = new TrendChartPreviewItem
  93. {
  94. Title = entity.Title,
  95. TrendChartUrl = entity.TrendChartUrl
  96. };
  97. trendChartPreviewItems.Add(p);
  98. }
  99. item.TrendChartPreviewItem = trendChartPreviewItems;
  100. temp.Add(item);
  101. }
  102. previewItem.TrendChartPreviewItems = temp;
  103. res.Add(previewItem);
  104. }
  105. Cache.Factory.CacheFactory.Cache().WriteCache<List<TrendChart_Preview>>(res, "__" + arg.Category + "__");
  106. }
  107. resultMsg = new BaseJson<List<TrendChart_Preview>>
  108. {
  109. Status = (int)JsonObjectStatus.Success,
  110. Data = res,
  111. Message = JsonObjectStatus.Success.GetEnumText(),
  112. BackUrl = null
  113. };
  114. }
  115. else
  116. {
  117. resultMsg = new BaseJson<List<TrendChart_Preview>>
  118. {
  119. Status = (int)JsonObjectStatus.Fail,
  120. Data = null,
  121. Message = JsonObjectStatus.Fail.GetEnumText() + ",请求参数Category为空。",
  122. BackUrl = null
  123. };
  124. }
  125. }, e =>
  126. {
  127. resultMsg = new BaseJson<List<TrendChart_Preview>>
  128. {
  129. Status = (int)JsonObjectStatus.Exception,
  130. Data = null,
  131. Message = JsonObjectStatus.Exception.GetEnumText() + ",异常信息:" + e.Message,
  132. BackUrl = null
  133. };
  134. });
  135. return resultMsg.TryToJson().ToHttpResponseMessage();
  136. }
  137. /// <summary>
  138. /// 缓存ToolsList
  139. /// </summary>
  140. /// <returns></returns>
  141. public List<TrendChartEntity> GetCacheTrendChartList()
  142. {
  143. string key = $"Cache-TrendChartList";
  144. List<TrendChartEntity> list = webCache.GetObject<List<TrendChartEntity>>(key);
  145. if (list == null)
  146. {
  147. list = TrendChartBll.GetPageList(n => n.IsDelete == false && n.IsStick == true).ToList();
  148. if(list!=null)
  149. webCache.AddObject(key, list, (int)CacheTime.Data);
  150. }
  151. return list;
  152. }
  153. #endregion
  154. // 引用的走势图相关的sdk
  155. private static readonly TrendChartSDK _main = new TrendChartSDK();
  156. /// <summary>
  157. /// 获取所有的彩种
  158. /// </summary>
  159. /// <param name="arg"></param>
  160. /// <returns></returns>
  161. [HttpPost]
  162. public HttpResponseMessage GetAllTrendList(BaseParameterEntity arg)
  163. {
  164. BaseJson<List<LotteryInfo>> resultMsg = new BaseJson<List<LotteryInfo>> { Status = (int)JsonObjectStatus.Error, Message = "服务器未知错误。", Data = null };
  165. Logger(typeof(TrendChartController), arg.TryToJson(), "获取所有的彩种-GetAllTrendList", () =>
  166. {
  167. if (arg.t.CheckTimeStamp())
  168. {
  169. //var Lottery = Cache.Factory.CacheFactory.Cache().GetCache<List<LotteryInfo>>("__LotteryList");
  170. //if (Lottery == null)
  171. //{
  172. //查询所有拥有走势图的彩种list
  173. var Lottery = _main.GetLotteryList(out string msg).Select(o => new LotteryInfo { Name = o.Name, Cid = o.Cid, Id = o.Id }).ToList();
  174. // Cache.Factory.CacheFactory.Cache().WriteCache<List<LotteryInfo>>(Lottery, "__LotteryList", DateTime.Now.AddHours(1));
  175. //}
  176. resultMsg = new BaseJson<List<LotteryInfo>>
  177. {
  178. Status = (int)JsonObjectStatus.Success,
  179. Data = Lottery,
  180. Message = JsonObjectStatus.Success.GetEnumText(),
  181. BackUrl = null
  182. };
  183. }
  184. else
  185. {
  186. resultMsg = new BaseJson<List<LotteryInfo>>
  187. {
  188. Status = (int)JsonObjectStatus.Fail,
  189. Data = null,
  190. Message = JsonObjectStatus.Fail.GetEnumText(),
  191. BackUrl = null
  192. };
  193. }
  194. }, e =>
  195. {
  196. resultMsg = new BaseJson<List<LotteryInfo>>
  197. {
  198. Status = (int)JsonObjectStatus.Exception,
  199. Data = null,
  200. Message = JsonObjectStatus.Exception.GetEnumText() + ",异常信息:" + e.Message,
  201. BackUrl = null
  202. };
  203. });
  204. return resultMsg.TryToJson().ToHttpResponseMessage();
  205. }
  206. /// <summary>
  207. /// 获取类型码-枚举码字典
  208. /// </summary>
  209. /// <param name="model">系统字典集合</param>
  210. /// <param name="TypeCode"></param>
  211. /// <returns></returns>
  212. private Dictionary<string, SCCLottery> GetTypeCodeAndEnumCodeDict(List<DataItemModel> model, bool IsRecommend = false, bool IsShowHomePage = false, bool IsHot = false, string TypeCode = "")
  213. {
  214. string key = IsRecommend ? "__IsRecommend___" : IsShowHomePage ? "__IsShowHomePage__" : IsHot ? "__IsHot__" : "__Public__";
  215. if (!string.IsNullOrEmpty(TypeCode))
  216. key += TypeCode + "__";
  217. //类型码-枚举
  218. Dictionary<string, SCCLottery> dictionary = Cache.Factory.CacheFactory.Cache().GetCache<Dictionary<string, SCCLottery>>(CacheKeyEnum.TypeCodeAndEnumCodeDict.ToString() + key);
  219. if (dictionary == null || dictionary.Count == 0)
  220. {
  221. dictionary = new Dictionary<string, SCCLottery>();
  222. //枚举码
  223. List<string> enumCode = new List<string>();
  224. //类型码
  225. List<string> typeCode = new List<string>();
  226. //筛选推荐
  227. if (IsRecommend)
  228. {
  229. enumCode = model.Where(d => d.IsRecommend).Select(d => d.SimpleSpelling).ToList();
  230. typeCode = model.Where(d => d.IsRecommend).Select(d => d.ItemValue).ToList();
  231. }
  232. //筛选二级首页显示彩种
  233. if (IsShowHomePage)
  234. {
  235. enumCode = model.Where(d => d.IsShowHomePage).Select(d => d.SimpleSpelling).ToList();
  236. typeCode = model.Where(d => d.IsShowHomePage).Select(d => d.ItemValue).ToList();
  237. }
  238. //筛选热门
  239. if (IsHot)
  240. {
  241. enumCode = model.Where(d => d.IsHot).Select(d => d.SimpleSpelling).ToList();
  242. typeCode = model.Where(d => d.IsHot).Select(d => d.ItemValue).ToList();
  243. }
  244. //枚举列表
  245. List<SCCLottery> lotteryType = enumCode.Select(s => (SCCLottery)Enum.Parse(typeof(SCCLottery), s, true)).ToList();
  246. for (int i = 0; i < typeCode.Count; i++)
  247. {
  248. if (!dictionary.ContainsKey(typeCode[i]))
  249. {
  250. dictionary.Add(typeCode[i], lotteryType[i]);
  251. }
  252. }
  253. Cache.Factory.CacheFactory.Cache().WriteCache(dictionary, CacheKeyEnum.TypeCodeAndEnumCodeDict.ToString() + key, DateTimeHelper.Now.AddDays(30));
  254. }
  255. return dictionary;
  256. }
  257. private string GetTerm(SCCLottery type)
  258. {
  259. string tableName = type.GetSCCLotteryTableName();
  260. string sql = $"SELECT TOP 1 [ID],[Term],[OpenTime],[Spare] FROM [dbo].[{tableName}] ORDER BY Term DESC ";
  261. //查询结果
  262. DataTable rec = commonBll.ExcuteSqlDataTable(sql, DatabaseLinksEnum.LotteryNumber, null);
  263. return rec.Rows.Count > 0 ? rec.Rows[0].ItemArray[1].ToString() : "";
  264. }
  265. /// <summary>
  266. /// 获取所有的彩种及拥有的走势图/图表/遗漏/工具
  267. /// </summary>
  268. /// <param name="arg"></param>
  269. /// <returns></returns>
  270. [HttpPost]
  271. public HttpResponseMessage GetAllTrendChartList(BaseParameterEntity arg)
  272. {
  273. BaseJson<List<TrendChartViewEntity>> resultMsg = new BaseJson<List<TrendChartViewEntity>> { Status = (int)JsonObjectStatus.Error, Message = "服务器未知错误。", Data = null };
  274. Logger(typeof(TrendChartController), arg.TryToJson(), "获取所有的彩种及拥有的走势图/图表/遗漏/工具-GetAllTrendChartList", () =>
  275. {
  276. if (arg.t.CheckTimeStamp())
  277. {
  278. //var Lottery = Cache.Factory.CacheFactory.Cache().GetCache<List<TrendChartViewEntity>>("__LotteryTrendList");
  279. //if (Lottery == null)
  280. //{
  281. var Lottery = new List<TrendChartViewEntity>();
  282. //获取所有彩种
  283. List<SCCConfig> configList = LotteryConfig.ToList().OrderByDescending(o => o.Name).ToList();
  284. foreach (var item in configList)
  285. {
  286. TrendChartViewEntity lottery = new TrendChartViewEntity();
  287. Enum.TryParse<SCCLottery>(item.EnumCode, true, out SCCLottery type);
  288. lottery.EmCode = item.Name.Substring(0, 3);
  289. lottery.EnumCode = item.Name;
  290. lottery.Cid =type.GetCid();
  291. lottery.Term = GetTerm(type);
  292. lottery.Name = type.GetEnumDescription().ToString();
  293. //查出对应的彩种的走势图
  294. lottery.TrendChartInfos = _main.GetTrendChartList(out string msg2, lottery.Cid).Select(o => new TrendChartInfo { Id = o.Id, Name = o.Name, Cid = o.Cid, Tid = o.Tid }).ToList();
  295. //图表
  296. lottery.TrendPictuerInfos = _main.GetTrendChartList(out string msg3, lottery.Cid, 2004).Select(o => new TrendChartInfo { Id = o.Id, Name = o.Name, Cid = o.Cid, Tid = o.Tid }).ToList();
  297. //工具
  298. lottery.TrendToolsInfos = _main.GetTrendChartList(out string msg4, lottery.Cid, 2002).Select(o => new TrendChartInfo { Id = o.Id, Name = o.Name, Cid = o.Cid, Tid = o.Tid }).ToList();
  299. //遗漏
  300. lottery.TrendMissInfos = _main.GetTrendChartList(out string msg5, lottery.Cid, 2003).Select(o => new TrendChartInfo { Id = o.Id, Name = o.Name, Cid = o.Cid, Tid = o.Tid }).ToList();
  301. //if (lottery.TrendChartInfos.Count!=0)
  302. //{
  303. Lottery.Add(lottery);
  304. //}
  305. }
  306. // Cache.Factory.CacheFactory.Cache().WriteCache<List<TrendChartViewEntity>>(Lottery, "__LotteryTrendList", DateTime.Now.AddHours(1));
  307. //}
  308. resultMsg = new BaseJson<List<TrendChartViewEntity>>
  309. {
  310. Status = (int)JsonObjectStatus.Success,
  311. Data = Lottery,
  312. Message = JsonObjectStatus.Success.GetEnumText(),
  313. BackUrl = null
  314. };
  315. }
  316. else
  317. {
  318. resultMsg = new BaseJson<List<TrendChartViewEntity>>
  319. {
  320. Status = (int)JsonObjectStatus.Fail,
  321. Data = null,
  322. Message = JsonObjectStatus.Fail.GetEnumText(),
  323. BackUrl = null
  324. };
  325. }
  326. }, e =>
  327. {
  328. resultMsg = new BaseJson<List<TrendChartViewEntity>>
  329. {
  330. Status = (int)JsonObjectStatus.Exception,
  331. Data = null,
  332. Message = JsonObjectStatus.Exception.GetEnumText() + ",异常信息:" + e.Message,
  333. BackUrl = null
  334. };
  335. //Cache.Factory.CacheFactory.Cache().RemoveCache("__LotteryTrendList");
  336. });
  337. return resultMsg.TryToJson().ToHttpResponseMessage();
  338. }
  339. /// <summary>
  340. /// 获取指定彩种拥有的走势图/图表/遗漏/工具
  341. /// </summary>
  342. /// <param name="arg"></param>
  343. /// <param name="tid">类别编码:2001-走势;2002-工具;2003-遗漏;2004-图表,默认2001</param>
  344. /// <param name="direction">方向(横屏/竖屏): 0-横屏(普通电脑);1-竖屏(电视)</param>
  345. /// <remarks>备注:拥有 遗漏 的彩种【福彩3D、体彩排三、双色球】;拥有 图表 的彩种【福彩3D、体彩排三】;拥有 工具 的彩种【福彩3D、体彩排三、体彩排五、双色球、七乐彩、22选5、大乐透、七星彩】</remarks>
  346. /// <returns></returns>
  347. [HttpPost]
  348. public HttpResponseMessage GetTrendChartList(LotteryTrendChartArgEntity arg)
  349. {
  350. BaseJson<TrendChartViewEntity> resultMsg = new BaseJson<TrendChartViewEntity> { Status = (int)JsonObjectStatus.Error, Message = "服务器未知错误。", Data = null };
  351. Logger(typeof(TrendChartController), arg.TryToJson(), "获取指定彩种拥有的走势图/图表/遗漏/工具-GetTrendChartList", () =>
  352. {
  353. if (arg.t.CheckTimeStamp())
  354. {
  355. if (arg.Tid != 2001 && arg.Tid != 2002 && arg.Tid != 2003 && arg.Tid != 2004 && arg.Direction != 0 && arg.Direction != 1)
  356. {
  357. resultMsg = new BaseJson<TrendChartViewEntity>
  358. {
  359. Status = (int)JsonObjectStatus.Fail,
  360. Data = null,
  361. Message = JsonObjectStatus.Fail.GetEnumText() + "(类别编码/方向编码)有误",
  362. BackUrl = null
  363. };
  364. }
  365. else
  366. {
  367. TrendChartViewEntity lottery = new TrendChartViewEntity();
  368. lottery.Cid = arg.Cid;
  369. //查出对应的彩种的走势图
  370. lottery.TrendChartInfos = _main.GetTrendChartList(out string msg2, lottery.Cid).Select(o => new TrendChartInfo { Id = o.Id, Name = o.Name, Cid = o.Cid, Tid = o.Tid }).ToList();
  371. //图表
  372. lottery.TrendPictuerInfos = _main.GetTrendChartList(out string msg3, lottery.Cid, 2004).Select(o => new TrendChartInfo { Id = o.Id, Name = o.Name, Cid = o.Cid, Tid = o.Tid }).ToList();
  373. //工具
  374. lottery.TrendToolsInfos = _main.GetTrendChartList(out string msg4, lottery.Cid, 2002).Select(o => new TrendChartInfo { Id = o.Id, Name = o.Name, Cid = o.Cid, Tid = o.Tid }).ToList();
  375. //遗漏
  376. lottery.TrendMissInfos = _main.GetTrendChartList(out string msg5, lottery.Cid, 2003).Select(o => new TrendChartInfo { Id = o.Id, Name = o.Name, Cid = o.Cid, Tid = o.Tid }).ToList();
  377. resultMsg = new BaseJson<TrendChartViewEntity>
  378. {
  379. Status = (int)JsonObjectStatus.Success,
  380. Data = lottery,
  381. Message = JsonObjectStatus.Success.GetEnumText(),
  382. BackUrl = null
  383. };
  384. }
  385. }
  386. else
  387. {
  388. resultMsg = new BaseJson<TrendChartViewEntity>
  389. {
  390. Status = (int)JsonObjectStatus.Fail,
  391. Data = null,
  392. Message = JsonObjectStatus.Fail.GetEnumText(),
  393. BackUrl = null
  394. };
  395. }
  396. }, e =>
  397. {
  398. resultMsg = new BaseJson<TrendChartViewEntity>
  399. {
  400. Status = (int)JsonObjectStatus.Exception,
  401. Data = null,
  402. Message = JsonObjectStatus.Exception.GetEnumText() + ",异常信息:" + e.Message,
  403. BackUrl = null
  404. };
  405. });
  406. return resultMsg.TryToJson().ToHttpResponseMessage();
  407. }
  408. /// <summary>
  409. /// 获取走势图详情
  410. /// </summary>
  411. /// <param name="arg"></param>
  412. /// <returns></returns>
  413. [HttpPost]
  414. public HttpResponseMessage GetTrendChart(LotteryTrendChartArgEntity arg)
  415. {
  416. BaseJson<TrendChartMain.TrendChartViewModel> resultMsg = new BaseJson<TrendChartMain.TrendChartViewModel> { Status = (int)JsonObjectStatus.Error, Message = "服务器未知错误。", Data = null };
  417. Logger(typeof(TrendChartController), arg.TryToJson(), "获取走势图详情-GetTrendChart", () =>
  418. {
  419. if (arg.t.CheckTimeStamp())
  420. {
  421. QueryTrendChartArg para = new QueryTrendChartArg
  422. {
  423. ChatrId = arg.ChartId,
  424. TotalRecord = arg.TotalRecord,
  425. Year = arg.Year,
  426. StartTerm = arg.StartTerm,
  427. EndTerm = arg.EndTerm,
  428. SearchTime = arg.SearchTime,
  429. ChartType = arg.ChartType
  430. };
  431. var Lottery = _main.GetTrendChartHtml(out string msg, para);
  432. resultMsg = new BaseJson<TrendChartMain.TrendChartViewModel>
  433. {
  434. Status = (int)JsonObjectStatus.Success,
  435. Data = Lottery,
  436. Message = JsonObjectStatus.Success.GetEnumText(),
  437. BackUrl = null
  438. };
  439. }
  440. else
  441. {
  442. resultMsg = new BaseJson<TrendChartMain.TrendChartViewModel>
  443. {
  444. Status = (int)JsonObjectStatus.Fail,
  445. Data = null,
  446. Message = JsonObjectStatus.Fail.GetEnumText(),
  447. BackUrl = null
  448. };
  449. }
  450. }, e =>
  451. {
  452. resultMsg = new BaseJson<TrendChartMain.TrendChartViewModel>
  453. {
  454. Status = (int)JsonObjectStatus.Exception,
  455. Data = null,
  456. Message = JsonObjectStatus.Exception.GetEnumText() + ",异常信息:" + e.Message,
  457. BackUrl = null
  458. };
  459. });
  460. return resultMsg.TryToJson().ToHttpResponseMessage();
  461. }
  462. /// <summary>
  463. /// 获取遗漏详情
  464. /// </summary>
  465. /// <param name="arg"></param>
  466. /// <returns></returns>
  467. [HttpPost]
  468. public HttpResponseMessage GetMissDataChart(LotteryMissDataArgEntity arg)
  469. {
  470. BaseJson<TrendChartMain.TrendChartViewModel> resultMsg = new BaseJson<TrendChartMain.TrendChartViewModel> { Status = (int)JsonObjectStatus.Error, Message = "服务器未知错误。", Data = null };
  471. Logger(typeof(TrendChartController), arg.TryToJson(), "获取遗漏详情-GetMissDataChart", () =>
  472. {
  473. if (arg.t.CheckTimeStamp())
  474. {
  475. var MisssData = _main.GetMissDataHtml(out string msg, arg.MissId, arg.EndTerm);
  476. resultMsg = new BaseJson<TrendChartMain.TrendChartViewModel>
  477. {
  478. Status = (int)JsonObjectStatus.Success,
  479. Data = MisssData,
  480. Message = JsonObjectStatus.Success.GetEnumText(),
  481. BackUrl = null
  482. };
  483. }
  484. else
  485. {
  486. resultMsg = new BaseJson<TrendChartMain.TrendChartViewModel>
  487. {
  488. Status = (int)JsonObjectStatus.Fail,
  489. Data = null,
  490. Message = JsonObjectStatus.Fail.GetEnumText(),
  491. BackUrl = null
  492. };
  493. }
  494. }, e =>
  495. {
  496. resultMsg = new BaseJson<TrendChartMain.TrendChartViewModel>
  497. {
  498. Status = (int)JsonObjectStatus.Exception,
  499. Data = null,
  500. Message = JsonObjectStatus.Exception.GetEnumText() + ",异常信息:" + e.Message,
  501. BackUrl = null
  502. };
  503. });
  504. return resultMsg.TryToJson().ToHttpResponseMessage();
  505. }
  506. /// <summary>
  507. /// 获取图表详情
  508. /// </summary>
  509. /// <param name="arg"></param>
  510. /// <returns></returns>
  511. [HttpPost]
  512. public HttpResponseMessage GetPicChart(LotteryPicArgEntity arg)
  513. {
  514. BaseJson<TrendChartMain.TrendChartViewModel> resultMsg = new BaseJson<TrendChartMain.TrendChartViewModel> { Status = (int)JsonObjectStatus.Error, Message = "服务器未知错误。", Data = null };
  515. Logger(typeof(TrendChartController), arg.TryToJson(), "获取图表详情-GetPicChart", () =>
  516. {
  517. if (arg.t.CheckTimeStamp())
  518. {
  519. var MisssData = _main.GetChartHtml(out string msg, arg.ChartId);
  520. resultMsg = new BaseJson<TrendChartMain.TrendChartViewModel>
  521. {
  522. Status = (int)JsonObjectStatus.Success,
  523. Data = MisssData,
  524. Message = JsonObjectStatus.Success.GetEnumText(),
  525. BackUrl = null
  526. };
  527. }
  528. else
  529. {
  530. resultMsg = new BaseJson<TrendChartMain.TrendChartViewModel>
  531. {
  532. Status = (int)JsonObjectStatus.Fail,
  533. Data = null,
  534. Message = JsonObjectStatus.Fail.GetEnumText(),
  535. BackUrl = null
  536. };
  537. }
  538. }, e =>
  539. {
  540. resultMsg = new BaseJson<TrendChartMain.TrendChartViewModel>
  541. {
  542. Status = (int)JsonObjectStatus.Exception,
  543. Data = null,
  544. Message = JsonObjectStatus.Exception.GetEnumText() + ",异常信息:" + e.Message,
  545. BackUrl = null
  546. };
  547. });
  548. return resultMsg.TryToJson().ToHttpResponseMessage();
  549. }
  550. }
  551. }