MerchantTypeSetService.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System;
  2. using System.Collections.Generic;
  3. using Library;
  4. using LitJson;
  5. using System.Linq;
  6. using MySystem.SpModels;
  7. namespace MySystem
  8. {
  9. public class MerchantTypeSetService
  10. {
  11. public readonly static MerchantTypeSetService Instance = new MerchantTypeSetService();
  12. private MerchantTypeSetService()
  13. { }
  14. public void Start(JobMqMsg jobInfo)
  15. {
  16. string content = "";
  17. try
  18. {
  19. dosomething();
  20. // string Msg = "success";
  21. // jobInfo.Status = Msg == "success" ? 1 : 0;
  22. // jobInfo.Msg = Msg == "success" ? "执行完成" : Msg;
  23. // RabbitMQClient.Instance.SendMsg(Newtonsoft.Json.JsonConvert.SerializeObject(jobInfo), "PublicBack");
  24. }
  25. catch (Exception ex)
  26. {
  27. if (!string.IsNullOrEmpty(content))
  28. {
  29. Dictionary<string, string> data = new Dictionary<string, string>();
  30. data.Add("ErrTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  31. data.Add("ErrMsg", ex.ToString());
  32. LogHelper.Instance.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(data), "public_err");
  33. }
  34. else
  35. {
  36. LogHelper.Instance.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "public_service");
  37. }
  38. }
  39. }
  40. public void dosomething()
  41. {
  42. // TODO: 每天扫描非商户型创客的持有机具数量
  43. // WebCMSEntities spdb = new WebCMSEntities();
  44. // PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
  45. // DateTime yesterday = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + " 00:00:00");
  46. // DateTime today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
  47. // List<BindRecord> binds = spdb.BindRecord.Where(m => m.CreateTime >= yesterday && m.CreateTime < today).ToList();
  48. // foreach (BindRecord bind in binds)
  49. // {
  50. // string Mobile = bind.MerNewSnNo;
  51. // string MerNo = bind.MerNo;
  52. // string BeforeNum = "";
  53. // string AfterNum = "";
  54. // if (Mobile.Contains("****") && Mobile.Length == 11)
  55. // {
  56. // BeforeNum = Mobile.Substring(0, 3);
  57. // AfterNum = Mobile.Substring(7);
  58. // }
  59. // string Name = bind.MerName;
  60. // PxcModels.Users user = db.Users.FirstOrDefault(m => m.Mobile.StartsWith(BeforeNum) && m.Mobile.EndsWith(AfterNum) && m.RealName == Name && m.AuthFlag == 1 && m.MerchantType == 0);
  61. // if (user != null)
  62. // {
  63. // user.MerchantType = 1;
  64. // PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.KqMerNo == MerNo) ?? new PxcModels.PosMerchantInfo();
  65. // merchant.MerUserType = 1;
  66. // PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.BindMerchantId == merchant.Id);
  67. // if (pos != null)
  68. // {
  69. // pos.SeoTitle = user.Id.ToString(); // 记录商户型创客的Id
  70. // }
  71. // db.SaveChanges();
  72. // }
  73. // }
  74. // spdb.Dispose();
  75. // db.Dispose();
  76. }
  77. }
  78. }