TmpService.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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(poscheck);
  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. Utils.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. public void poscheck()
  74. {
  75. string[] poslist = function.ReadInstance("pos.txt").Split('\n');
  76. List<string> pos25 = function.ReadInstance("pos25.txt").Split('\n').ToList();
  77. foreach(string possn in poslist)
  78. {
  79. if(!pos25.Contains(possn))
  80. {
  81. string result = PublicImportDataService.Instance.LkbSetFee(possn, 0.7M, 300);
  82. function.WriteLog(possn + "\n" + result + "\n\n", "25年前的金控机具费率");
  83. Thread.Sleep(500);
  84. }
  85. }
  86. }
  87. }
  88. }