SycnSpService.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using MySystem.Models;
  5. using Library;
  6. using LitJson;
  7. namespace MySystem
  8. {
  9. public class SycnSpService
  10. {
  11. public readonly static SycnSpService Instance = new SycnSpService();
  12. private SycnSpService()
  13. { }
  14. public void Start(JobMqMsg jobInfo)
  15. {
  16. try
  17. {
  18. function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(jobInfo), "SycnSpServer监控");
  19. string OrderString = jobInfo.OrderString;
  20. function.WriteLog(OrderString, "SycnSpServer监控");
  21. if (OrderString.StartsWith("Sp:") && OrderString.EndsWith(":SpServer"))
  22. {
  23. function.WriteLog("ok", "SycnSpServer监控");
  24. string Kind = OrderString.Split(':')[1];
  25. function.WriteLog("Kind:" + Kind, "SycnSpServer监控");
  26. dosomething(Kind);
  27. function.WriteLog("finish:" + Kind, "SycnSpServer监控");
  28. function.WriteLog("\r\n\r\n\r\n", "SycnSpServer监控");
  29. jobInfo.Status = 1;
  30. jobInfo.Msg = "执行完成";
  31. RabbitMQClient.Instance.SendMsg(Newtonsoft.Json.JsonConvert.SerializeObject(jobInfo), "SycnSpServerBack");
  32. }
  33. }
  34. catch (Exception ex)
  35. {
  36. function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "sycn_sp_server_err");
  37. }
  38. }
  39. public void dosomething(string Kind)
  40. {
  41. if (Kind == "bind")
  42. {
  43. SycnSpBindService.Instance.Start();
  44. }
  45. else if (Kind == "active")
  46. {
  47. SycnSpActiveService.Instance.Start();
  48. }
  49. else if (Kind == "trade")
  50. {
  51. SycnSpTradeService.Instance.Start();
  52. }
  53. else if (Kind == "merchant")
  54. {
  55. SycnSpMerchantService.Instance.Start();
  56. }
  57. }
  58. }
  59. }