TmpService.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System;
  2. using System.Collections.Generic;
  3. using Library;
  4. using LitJson;
  5. using System.Linq;
  6. using System.Data;
  7. using System.Threading;
  8. using MySystem.PxcModels;
  9. namespace MySystem
  10. {
  11. public class TmpService
  12. {
  13. public readonly static TmpService Instance = new TmpService();
  14. private TmpService()
  15. { }
  16. public void Start()
  17. {
  18. Thread th = new Thread(SetLkbDeposit);
  19. th.IsBackground = true;
  20. th.Start();
  21. }
  22. private void SetLkbDeposit()
  23. {
  24. while (true)
  25. {
  26. try
  27. {
  28. string content = RedisDbconn.Instance.RPop<string>("SetLkbDepositQueue");
  29. if (!string.IsNullOrEmpty(content))
  30. {
  31. string[] data = content.Split('|');
  32. PublicImportDataService.Instance.LkbSetDeposit(data[0], decimal.Parse(data[1]));
  33. }
  34. else
  35. {
  36. Thread.Sleep(2000);
  37. }
  38. }
  39. catch (Exception ex)
  40. {
  41. function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "商城订单余额支付异常");
  42. Thread.Sleep(2000);
  43. }
  44. }
  45. }
  46. public void dosomething()
  47. {
  48. string content = function.ReadInstance("jk299.txt");
  49. string[] SnNos = content.Split('\n');
  50. int count = SnNos.Length;
  51. int index = 0;
  52. foreach(string SnNo in SnNos)
  53. {
  54. index += 1;
  55. PublicImportDataService.Instance.LkbSetDeposit(SnNo, 299);
  56. function.WritePage("/look/", "progress.txt", index + "/" + count);
  57. function.WritePage("/look/", "sn.txt", SnNo);
  58. Thread.Sleep(100);
  59. }
  60. content = function.ReadInstance("jk0.txt");
  61. SnNos = content.Split('\n');
  62. count = SnNos.Length;
  63. index = 0;
  64. foreach(string SnNo in SnNos)
  65. {
  66. index += 1;
  67. PublicImportDataService.Instance.LkbSetDeposit(SnNo, 0);
  68. function.WritePage("/look/", "progress.txt", index + "/" + count);
  69. function.WritePage("/look/", "sn.txt", SnNo);
  70. Thread.Sleep(100);
  71. }
  72. }
  73. }
  74. }