TkLogCore.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. using Microsoft.AspNetCore.Http;
  2. using Microsoft.AspNetCore.Mvc.Controllers;
  3. using Microsoft.AspNetCore.Mvc.Filters;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using dodohold.core;
  9. using static dodohold.core.ZTOExpress.CreateOrderArgs;
  10. using System.Net;
  11. using System.Security.Cryptography;
  12. using Spire.Pdf.Exporting.XPS.Schema;
  13. using System.Xml.Linq;
  14. using static QRCoder.PayloadGenerator;
  15. namespace molilian.core
  16. {
  17. public class TkLogCore
  18. {
  19. static string queue_tb_key = "queue:logs:tb";
  20. static string queue_jd_key = "queue:logs:jd";
  21. static string queue_parse_tb_key = "queue:parse_logs:tb";
  22. static string queue_parse_jd_key = "queue:parse_logs:jd";
  23. static string queue_parse_dy_key = "queue:parse_logs:dy";
  24. static string queue_parse_tool_key = "queue:parse_logs:tool";
  25. static string queue_coupon_key = "queue:coupon_logs";
  26. public static void BatchInsertLogDB()
  27. {
  28. using var connection = DBContext.GetOpenConnection();
  29. connection.Open();
  30. using var transaction = connection.BeginTransaction();
  31. try
  32. {
  33. for (int i = 0; i < 100; i++)
  34. {
  35. var data = RedisHelper.LPop<TkDataDTO>(queue_tb_key);
  36. if (data == null) break;
  37. data.id = new DBContext.Table(connection, "tk_logs")
  38. .Add("channel", (int)data.channel)
  39. .Add("accountId", data.accountId)
  40. .Add("accountName", data.accountName)
  41. .Add("rawContent", data.rawContent)
  42. .Add("rawContent2", data.rawContent2)
  43. .Add("success", data.success)
  44. .Add("message", data.message)
  45. .Add("reason", data.reason)
  46. .Add("content", data.content)
  47. .Add("couponAmount", data.couponAmount)
  48. .Add("itemId", data.itemId)
  49. .Add("itemName", data.itemName)
  50. .Add("pic", data.pic)
  51. .Add("promotionPrice", data.promotionPrice)
  52. .Add("taoToken", data.taoToken)
  53. .Add("shortLinkurl", data.shortLinkurl)
  54. .Add("deeplink_url", data.deeplink_url)
  55. .Add("num_iid", data.num_iid)
  56. .Add("elapsedTime", data.elapsedTime)
  57. .Add("ip", data.ip)
  58. .Add("oaid", data.oaid)
  59. .Add("create_time", data.create_time)
  60. .Create(DBContext.InsertType.NORMAL, transaction);
  61. if (!string.IsNullOrEmpty(data.itemId)) TkOrderTrackingCore.SaveLinkSummary(data);
  62. }
  63. for (int i = 0; i < 100; i++)
  64. {
  65. var data = RedisHelper.LPop<JdDataDTO>(queue_jd_key);
  66. if (data == null) break;
  67. new DBContext.Table(connection, "tk_logs")
  68. .Add("channel", (int)data.channel)
  69. .Add("accountId", data.accountId)
  70. .Add("accountName", data.accountName)
  71. .Add("rawContent", data.rawContent)
  72. .Add("rawContent2", data.rawContent2)
  73. .Add("success", data.success)
  74. .Add("message", data.message)
  75. .Add("reason", data.reason)
  76. .Add("shortLinkurl", data.shortLinkurl)
  77. .Add("deeplink_url", data.deeplink_url)
  78. .Add("elapsedTime", data.elapsedTime)
  79. .Add("ip", data.ip)
  80. .Add("oaid", data.oaid)
  81. .Add("create_time", data.create_time)
  82. .Create(DBContext.InsertType.NORMAL, transaction);
  83. }
  84. for (int i = 0; i < 100; i++)
  85. {
  86. var data = RedisHelper.LPop<TkDataDTO>(queue_parse_tb_key);
  87. if (data == null) break;
  88. data.id = new DBContext.Table(connection, "tk_parse_logs")
  89. .Add("channel", (int)data.channel)
  90. .Add("accountId", data.accountId)
  91. .Add("accountName", data.accountName)
  92. .Add("rawContent", data.rawContent)
  93. .Add("success", data.success)
  94. .Add("message", data.message)
  95. .Add("reason", data.reason)
  96. .Add("content", data.content)
  97. .Add("itemId", data.itemId)
  98. .Add("itemName", data.itemName)
  99. .Add("pic", data.pic)
  100. .Add("couponAmount", data.couponAmount)
  101. .Add("promotionPrice", data.promotionPrice)
  102. .Add("taoToken", data.taoToken)
  103. .Add("shortLinkurl", data.shortLinkurl)
  104. .Add("deeplink_url", data.deeplink_url)
  105. .Add("num_iid", data.num_iid)
  106. .Add("elapsedTime", data.elapsedTime)
  107. .Add("ip", data.ip)
  108. .Add("oaid", data.oaid)
  109. .Add("create_time", data.create_time)
  110. .Create(DBContext.InsertType.NORMAL, transaction);
  111. if (!string.IsNullOrEmpty(data.itemId)) TkOrderTrackingCore.SaveLinkSummary(data);
  112. }
  113. for (int i = 0; i < 100; i++)
  114. {
  115. var data = RedisHelper.LPop<JdDataDTO>(queue_parse_jd_key);
  116. if (data == null) break;
  117. new DBContext.Table(connection, "tk_parse_logs")
  118. .Add("channel", (int)data.channel)
  119. .Add("accountId", data.accountId)
  120. .Add("accountName", data.accountName)
  121. .Add("rawContent", data.rawContent)
  122. .Add("success", data.success)
  123. .Add("message", data.message)
  124. .Add("reason", data.reason)
  125. .Add("content", data.content)
  126. .Add("itemId", data.itemId)
  127. .Add("itemName", data.itemName)
  128. .Add("pic", data.pic)
  129. .Add("couponAmount", data.couponAmount)
  130. .Add("promotionPrice", data.promotionPrice)
  131. .Add("taoToken", data.taoToken)
  132. .Add("shortLinkurl", data.shortLinkurl)
  133. .Add("deeplink_url", data.deeplink_url)
  134. .Add("elapsedTime", data.elapsedTime)
  135. .Add("ip", data.ip)
  136. .Add("oaid", data.oaid)
  137. .Add("create_time", data.create_time)
  138. .Create(DBContext.InsertType.NORMAL, transaction);
  139. }
  140. for (int i = 0; i < 100; i++)
  141. {
  142. var data = RedisHelper.LPop<DyDataDTO>(queue_parse_dy_key);
  143. if (data == null) break;
  144. new DBContext.Table(connection, "tk_parse_logs")
  145. .Add("channel", (int)data.channel)
  146. .Add("accountId", data.accountId)
  147. .Add("accountName", data.accountName)
  148. .Add("rawContent", data.rawContent)
  149. .Add("success", data.success)
  150. .Add("message", data.message)
  151. .Add("reason", data.reason)
  152. .Add("content", data.content)
  153. .Add("itemId", data.itemId)
  154. .Add("itemName", data.itemName)
  155. .Add("pic", data.pic)
  156. .Add("couponAmount", data.couponAmount)
  157. .Add("promotionPrice", data.promotionPrice)
  158. .Add("taoToken", data.taoToken)
  159. .Add("shortLinkurl", data.shortLinkurl)
  160. .Add("deeplink_url", data.deeplink_url)
  161. .Add("elapsedTime", data.elapsedTime)
  162. .Add("ip", data.ip)
  163. .Add("oaid", data.oaid)
  164. .Add("create_time", data.create_time)
  165. .Create(DBContext.InsertType.NORMAL, transaction);
  166. }
  167. for (int i = 0; i < 100; i++)
  168. {
  169. var data = RedisHelper.LPop<ToolParseDataDTO>(queue_parse_tool_key);
  170. if (data == null) break;
  171. new DBContext.Table(connection, "tool_parse_logs")
  172. .Add("channel", (int)data.channel)
  173. .Add("rawContent", data.rawContent)
  174. .Add("success", data.success)
  175. .Add("message", data.message)
  176. .Add("reason", data.reason)
  177. .Add("content", data.content)
  178. .Add("taoToken", data.taoToken)
  179. .Add("shortLinkurl", data.shortLinkurl)
  180. .Add("deeplink_url", data.deeplink_url)
  181. .Add("elapsedTime", data.elapsedTime)
  182. .Add("ip", data.ip)
  183. .Add("oaid", data.oaid)
  184. .Add("create_time", data.create_time)
  185. .Create(DBContext.InsertType.NORMAL, transaction);
  186. }
  187. for (int i = 0; i < 100; i++)
  188. {
  189. var data = RedisHelper.LPop<UnionCouponDTO>(queue_coupon_key);
  190. if (data == null) break;
  191. connection.Insert(data);
  192. }
  193. transaction.Commit();
  194. }
  195. catch (Exception ex)
  196. {
  197. transaction.Rollback();
  198. new LoggerLibrary("database_error", "parse_log")
  199. .Info(ex.Message, ex.StackTrace)
  200. .Save();
  201. NotifyCore.Notify(new NifyMessage
  202. {
  203. message = $"【写入日志异常】\n{ex.Message}\n{ex.StackTrace}",
  204. priority = NifyMessagePriority.high,
  205. tags = ["red_circle"]
  206. });
  207. }
  208. finally
  209. {
  210. connection.Close();
  211. }
  212. }
  213. public static async Task LogAsync(JdDataDTO response)
  214. {
  215. try
  216. {
  217. var ts = DateTime.Now - response.create_time;
  218. response.elapsedTime = (int)ts.TotalMilliseconds;
  219. RedisHelper.RPush(queue_jd_key, response);
  220. saveCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
  221. }
  222. catch (Exception ex) { }
  223. }
  224. public static async Task LogAsync(TkDataDTO response, AlimamaPlus? alimamaPlus = null)
  225. {
  226. try
  227. {
  228. var ts = DateTime.Now - response.create_time;
  229. response.elapsedTime = (int)ts.TotalMilliseconds;
  230. RedisHelper.RPush(queue_tb_key, response);
  231. saveCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
  232. if (!response.success && "nologin".Equals(response.message))
  233. {
  234. switch (response.channel)
  235. {
  236. case TkChannelEnum.tb:
  237. await Task.Run(() =>
  238. {
  239. if (alimamaPlus != null)
  240. {
  241. (bool success, string message) = alimamaPlus.RenewCookie();
  242. if (success) return;
  243. }
  244. TkPoolCore.Disabled(response.accountName, $"{response.rawContent}\n{response.rawContent2}");
  245. });
  246. break;
  247. }
  248. }
  249. if ("没有匹配账号".Equals(response.reason))
  250. {
  251. TkPoolCore.AccountExhausted();
  252. }
  253. }
  254. catch (Exception ex)
  255. {
  256. new LoggerLibrary("unionParse", "database_error")
  257. .Info(response.rawContent, response.rawContent2)
  258. .Info(response.Convert2Json())
  259. .Info(ex.Message, ex.StackTrace)
  260. .Save();
  261. }
  262. }
  263. public static async Task ParseLogAsync(TkDataDTO response, AlimamaPlus? alimamaPlus = null)
  264. {
  265. try
  266. {
  267. var ts = DateTime.Now - response.create_time;
  268. response.elapsedTime = (int)ts.TotalMilliseconds;
  269. RedisHelper.RPush(queue_parse_tb_key, response);
  270. saveParseCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
  271. if (!string.IsNullOrEmpty(response.itemId)) TkOrderTrackingCore.SaveLinkSummary(response);
  272. if (!response.success && "nologin".Equals(response.message))
  273. {
  274. switch (response.channel)
  275. {
  276. case TkChannelEnum.tb:
  277. await Task.Run(() =>
  278. {
  279. if (alimamaPlus != null)
  280. {
  281. (bool success, string message) = alimamaPlus.RenewCookie();
  282. if (success) return;
  283. }
  284. TkPoolCore.Disabled(response.accountName, $"{response.rawContent}");
  285. }); break;
  286. }
  287. }
  288. }
  289. catch (Exception ex)
  290. {
  291. new LoggerLibrary("unionParse", "database_error")
  292. .Info(response.rawContent)
  293. .Info(response.Convert2Json())
  294. .Info(ex.Message, ex.StackTrace)
  295. .Save();
  296. }
  297. }
  298. public static async Task CouponLogAsync(UnionCouponDTO response, AlimamaPlus? alimamaPlus = null)
  299. {
  300. try
  301. {
  302. var ts = DateTime.Now - response.create_time;
  303. response.elapsedTime = (int)ts.TotalMilliseconds;
  304. RedisHelper.RPush(queue_coupon_key, response);
  305. saveCouponCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
  306. if (!response.success && "nologin".Equals(response.message))
  307. {
  308. switch (response.channel)
  309. {
  310. case TkChannelEnum.tb:
  311. await Task.Run(() =>
  312. {
  313. if (alimamaPlus != null)
  314. {
  315. (bool success, string message) = alimamaPlus.RenewCookie();
  316. if (success) return;
  317. }
  318. TkPoolCore.Disabled(response.accountName, $"{response.rawContent}");
  319. }); break;
  320. }
  321. }
  322. }
  323. catch (Exception ex)
  324. {
  325. new LoggerLibrary("unionCoupon", "database_error")
  326. .Info(response.rawContent)
  327. .Info(response.Convert2Json())
  328. .Info(ex.Message, ex.StackTrace)
  329. .Save();
  330. }
  331. }
  332. public static async Task ParseLogAsync(JdDataDTO response)
  333. {
  334. try
  335. {
  336. var ts = DateTime.Now - response.create_time;
  337. response.elapsedTime = (int)ts.TotalMilliseconds;
  338. RedisHelper.RPush(queue_parse_jd_key, response);
  339. saveParseCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
  340. }
  341. catch (Exception ex) { }
  342. }
  343. public static async Task ParseLogAsync(DyDataDTO response)
  344. {
  345. try
  346. {
  347. var ts = DateTime.Now - response.create_time;
  348. response.elapsedTime = (int)ts.TotalMilliseconds;
  349. RedisHelper.RPush(queue_parse_dy_key, response);
  350. saveParseCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
  351. }
  352. catch (Exception ex) { }
  353. }
  354. public static async Task ParseLogAsync(ToolParseDataDTO response)
  355. {
  356. try
  357. {
  358. var ts = DateTime.Now - response.create_time;
  359. response.elapsedTime = (int)ts.TotalMilliseconds;
  360. RedisHelper.RPush(queue_parse_tool_key, response);
  361. saveParseCache(response.channel.ToString(), 0, "tool", response.success, response.message, response.reason);
  362. }
  363. catch (Exception ex) { }
  364. }
  365. private static void saveCache(string channel, int accountId, string accountName, bool success, string message, string reason)
  366. {
  367. saveAccountCache("all", success, message, reason);
  368. saveAccountCache($"{channel}", success, message, reason);
  369. saveAccountCache($"{accountName}", success, message, reason);
  370. if (accountId != 0)
  371. {
  372. //todo 放着跑两天,要将读取的地方改成读取accountid
  373. saveAccountCache($"{channel}_{accountId}", success, message, reason);
  374. }
  375. }
  376. private static void saveAccountCache(string accountName, bool success, string message, string reason)
  377. {
  378. RedisHelper.IncrBy($":total:{accountName}:{DateTime.Now:yyyyMM}");
  379. RedisHelper.IncrBy($":total:{accountName}:{DateTime.Now:yyyyMMdd}");
  380. RedisHelper.IncrBy($":total:{accountName}:{DateTime.Now:yyyyMMddHH}");
  381. string result = success ? "success" : "fail";
  382. RedisHelper.IncrBy($":total:{accountName}:{result}:{DateTime.Now:yyyyMM}");
  383. RedisHelper.IncrBy($":total:{accountName}:{result}:{DateTime.Now:yyyyMMdd}");
  384. RedisHelper.IncrBy($":total:{accountName}:{result}:{DateTime.Now:yyyyMMddHH}");
  385. if (!string.IsNullOrEmpty(message))
  386. {
  387. RedisHelper.SAdd($":total:{accountName}:message:{DateTime.Now:yyyyMM}", message);
  388. RedisHelper.SAdd($":total:{accountName}:message:{DateTime.Now:yyyyMMdd}", message);
  389. RedisHelper.SAdd($":total:{accountName}:message:{DateTime.Now:yyyyMMddHH}", message);
  390. RedisHelper.IncrBy($":total:{accountName}:{message}:{DateTime.Now:yyyyMM}");
  391. RedisHelper.IncrBy($":total:{accountName}:{message}:{DateTime.Now:yyyyMMdd}");
  392. RedisHelper.IncrBy($":total:{accountName}:{message}:{DateTime.Now:yyyyMMddHH}");
  393. }
  394. if (!string.IsNullOrEmpty(reason))
  395. {
  396. RedisHelper.SAdd($":total:{accountName}:reason:{DateTime.Now:yyyyMM}", reason);
  397. RedisHelper.SAdd($":total:{accountName}:reason:{DateTime.Now:yyyyMMdd}", reason);
  398. RedisHelper.SAdd($":total:{accountName}:reason:{DateTime.Now:yyyyMMddHH}", reason);
  399. RedisHelper.IncrBy($":total:{accountName}:{reason}:{DateTime.Now:yyyyMM}");
  400. RedisHelper.IncrBy($":total:{accountName}:{reason}:{DateTime.Now:yyyyMMdd}");
  401. RedisHelper.IncrBy($":total:{accountName}:{reason}:{DateTime.Now:yyyyMMddHH}");
  402. }
  403. }
  404. private static void saveParseCache(string channel, int accountId, string accountName, bool success, string message, string reason)
  405. {
  406. saveParseAccountCache("all", success, message, reason);
  407. saveParseAccountCache($"{channel}", success, message, reason);
  408. saveParseAccountCache($"{accountName}", success, message, reason);
  409. if (accountId != 0)
  410. {
  411. //todo 放着跑两天,要将读取的地方改成读取accountid
  412. saveParseAccountCache($"{channel}_{accountId}", success, message, reason);
  413. }
  414. }
  415. private static void saveParseAccountCache(string accountName, bool success, string message, string reason)
  416. {
  417. RedisHelper.IncrBy($":parse_total:{accountName}:{DateTime.Now:yyyyMM}");
  418. RedisHelper.IncrBy($":parse_total:{accountName}:{DateTime.Now:yyyyMMdd}");
  419. RedisHelper.IncrBy($":parse_total:{accountName}:{DateTime.Now:yyyyMMddHH}");
  420. string result = success ? "success" : "fail";
  421. RedisHelper.IncrBy($":parse_total:{accountName}:{result}:{DateTime.Now:yyyyMM}");
  422. RedisHelper.IncrBy($":parse_total:{accountName}:{result}:{DateTime.Now:yyyyMMdd}");
  423. RedisHelper.IncrBy($":parse_total:{accountName}:{result}:{DateTime.Now:yyyyMMddHH}");
  424. if (!string.IsNullOrEmpty(message))
  425. {
  426. RedisHelper.SAdd($":parse_total:{accountName}:message:{DateTime.Now:yyyyMM}", message);
  427. RedisHelper.SAdd($":parse_total:{accountName}:message:{DateTime.Now:yyyyMMdd}", message);
  428. RedisHelper.SAdd($":parse_total:{accountName}:message:{DateTime.Now:yyyyMMddHH}", message);
  429. RedisHelper.IncrBy($":parse_total:{accountName}:{message}:{DateTime.Now:yyyyMM}");
  430. RedisHelper.IncrBy($":parse_total:{accountName}:{message}:{DateTime.Now:yyyyMMdd}");
  431. RedisHelper.IncrBy($":parse_total:{accountName}:{message}:{DateTime.Now:yyyyMMddHH}");
  432. }
  433. if (!string.IsNullOrEmpty(reason))
  434. {
  435. RedisHelper.SAdd($":parse_total:{accountName}:reason:{DateTime.Now:yyyyMM}", reason);
  436. RedisHelper.SAdd($":parse_total:{accountName}:reason:{DateTime.Now:yyyyMMdd}", reason);
  437. RedisHelper.SAdd($":parse_total:{accountName}:reason:{DateTime.Now:yyyyMMddHH}", reason);
  438. RedisHelper.IncrBy($":parse_total:{accountName}:{reason}:{DateTime.Now:yyyyMM}");
  439. RedisHelper.IncrBy($":parse_total:{accountName}:{reason}:{DateTime.Now:yyyyMMdd}");
  440. RedisHelper.IncrBy($":parse_total:{accountName}:{reason}:{DateTime.Now:yyyyMMddHH}");
  441. }
  442. }
  443. private static void saveCouponCache(string channel, int accountId, string accountName, bool success, string message, string reason)
  444. {
  445. saveAccountCouponCache("all", success, message, reason);
  446. saveAccountCouponCache($"{channel}", success, message, reason);
  447. if (accountId != 0)
  448. {
  449. //todo 放着跑两天,要将读取的地方改成读取accountid
  450. saveAccountCouponCache($"{channel}_{accountId}", success, message, reason);
  451. }
  452. }
  453. private static void saveAccountCouponCache(string accountName, bool success, string message, string reason)
  454. {
  455. RedisHelper.IncrBy($":coupon_total:{accountName}:{DateTime.Now:yyyyMM}");
  456. RedisHelper.IncrBy($":coupon_total:{accountName}:{DateTime.Now:yyyyMMdd}");
  457. RedisHelper.IncrBy($":coupon_total:{accountName}:{DateTime.Now:yyyyMMddHH}");
  458. string result = success ? "success" : "fail";
  459. RedisHelper.IncrBy($":coupon_total:{accountName}:{result}:{DateTime.Now:yyyyMM}");
  460. RedisHelper.IncrBy($":coupon_total:{accountName}:{result}:{DateTime.Now:yyyyMMdd}");
  461. RedisHelper.IncrBy($":coupon_total:{accountName}:{result}:{DateTime.Now:yyyyMMddHH}");
  462. if (!string.IsNullOrEmpty(message))
  463. {
  464. RedisHelper.SAdd($":coupon_total:{accountName}:message:{DateTime.Now:yyyyMM}", message);
  465. RedisHelper.SAdd($":coupon_total:{accountName}:message:{DateTime.Now:yyyyMMdd}", message);
  466. RedisHelper.SAdd($":coupon_total:{accountName}:message:{DateTime.Now:yyyyMMddHH}", message);
  467. RedisHelper.IncrBy($":coupon_total:{accountName}:{message}:{DateTime.Now:yyyyMM}");
  468. RedisHelper.IncrBy($":coupon_total:{accountName}:{message}:{DateTime.Now:yyyyMMdd}");
  469. RedisHelper.IncrBy($":coupon_total:{accountName}:{message}:{DateTime.Now:yyyyMMddHH}");
  470. }
  471. if (!string.IsNullOrEmpty(reason))
  472. {
  473. RedisHelper.SAdd($":coupon_total:{accountName}:reason:{DateTime.Now:yyyyMM}", reason);
  474. RedisHelper.SAdd($":coupon_total:{accountName}:reason:{DateTime.Now:yyyyMMdd}", reason);
  475. RedisHelper.SAdd($":coupon_total:{accountName}:reason:{DateTime.Now:yyyyMMddHH}", reason);
  476. RedisHelper.IncrBy($":coupon_total:{accountName}:{reason}:{DateTime.Now:yyyyMM}");
  477. RedisHelper.IncrBy($":coupon_total:{accountName}:{reason}:{DateTime.Now:yyyyMMdd}");
  478. RedisHelper.IncrBy($":coupon_total:{accountName}:{reason}:{DateTime.Now:yyyyMMddHH}");
  479. }
  480. }
  481. }
  482. }