using System; using System.Collections.Generic; using Library; using LitJson; using System.Linq; using MySystem.SpModels; namespace MySystem { public class MerchantTypeSetService { public readonly static MerchantTypeSetService Instance = new MerchantTypeSetService(); private MerchantTypeSetService() { } public void Start(JobMqMsg jobInfo) { string content = ""; try { dosomething(); // string Msg = "success"; // jobInfo.Status = Msg == "success" ? 1 : 0; // jobInfo.Msg = Msg == "success" ? "执行完成" : Msg; // RabbitMQClient.Instance.SendMsg(Newtonsoft.Json.JsonConvert.SerializeObject(jobInfo), "PublicBack"); } catch (Exception ex) { if (!string.IsNullOrEmpty(content)) { Dictionary data = new Dictionary(); data.Add("ErrTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); data.Add("ErrMsg", ex.ToString()); LogHelper.Instance.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(data), "public_err"); } else { LogHelper.Instance.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "public_service"); } } } public void dosomething() { // TODO: 每天扫描非商户型创客的持有机具数量 // WebCMSEntities spdb = new WebCMSEntities(); // PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities(); // DateTime yesterday = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + " 00:00:00"); // DateTime today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00"); // List binds = spdb.BindRecord.Where(m => m.CreateTime >= yesterday && m.CreateTime < today).ToList(); // foreach (BindRecord bind in binds) // { // string Mobile = bind.MerNewSnNo; // string MerNo = bind.MerNo; // string BeforeNum = ""; // string AfterNum = ""; // if (Mobile.Contains("****") && Mobile.Length == 11) // { // BeforeNum = Mobile.Substring(0, 3); // AfterNum = Mobile.Substring(7); // } // string Name = bind.MerName; // PxcModels.Users user = db.Users.FirstOrDefault(m => m.Mobile.StartsWith(BeforeNum) && m.Mobile.EndsWith(AfterNum) && m.RealName == Name && m.AuthFlag == 1 && m.MerchantType == 0); // if (user != null) // { // user.MerchantType = 1; // PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.KqMerNo == MerNo) ?? new PxcModels.PosMerchantInfo(); // merchant.MerUserType = 1; // PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.BindMerchantId == merchant.Id); // if (pos != null) // { // pos.SeoTitle = user.Id.ToString(); // 记录商户型创客的Id // } // db.SaveChanges(); // } // } // spdb.Dispose(); // db.Dispose(); } } }