GetSpTimer.cs 913 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections.Generic;
  2. using System.Threading;
  3. using MySystem;
  4. public class GetSpTimer
  5. {
  6. public readonly static GetSpTimer Instance = new GetSpTimer();
  7. private GetSpTimer()
  8. { }
  9. public void Start()
  10. {
  11. List<JobMqMsg> list = RedisDbconn.Instance.GetList<JobMqMsg>("GetSpData", 1, 1000);
  12. foreach(JobMqMsg sub in list)
  13. {
  14. Thread th = new Thread(DoWorks);
  15. th.IsBackground = true;
  16. th.Start(sub);
  17. }
  18. }
  19. //核对执行结果,并保存数据
  20. public void DoWorks(object sender)
  21. {
  22. // string content = sender.ToString();
  23. // if (!string.IsNullOrEmpty(content))
  24. // {
  25. // JobMqMsg job = Newtonsoft.Json.JsonConvert.DeserializeObject<JobMqMsg>(content);
  26. JobMqMsg job = (JobMqMsg)sender;
  27. PublicImportDataService.Instance.Start(job);
  28. // }
  29. }
  30. }