using System; using System.Collections.Generic; using System.Linq; namespace WX.CRM.CRMServices.SMS.DataDrive { internal class CrmMsg { static List sendList = new List(); public static CrmMsgSendModel GetInfo() { if (sendList.Count == 0) { LoadList(); } if (sendList.Count == 0) { return null; } else { var oo = sendList.First(); sendList.Remove(oo); return oo; } } public static int waitCount { get { return sendList.Count; } } public static void ClearWait() { sendList.Clear(); } /// /// 获取一批待发短信 /// /// static void LoadList(int topNum = 50) { try { sendList.Clear(); WX.CRM.IBLL.Sms.ISMS_MESSAGE_Q msg = new WX.CRM.BLL.Sms.SMS_MESSAGE_BL(); var lis = msg.GetList(topNum); if (lis == null || lis.Count == 0) return; foreach (var oo in lis) { sendList.Add(new CrmMsgSendModel() { messageid = oo.MESSAGEID, clientCode = oo.CLIENTCODE, interfaceCode = oo.interfaceCode, interfaceAccount = oo.interfaceAccount, interfacePwd = oo.interfacePwd, mobile = oo.mobile, msgContent = oo.MESSAGE }); } } catch (Exception ex) { sendList.Clear(); WX.CRM.Common.LogHelper.Error("CrmMsg.LoadList():" + ex.Message + ex.StackTrace); } } /// /// 处理日志 /// /// /// public static void ExecLog(decimal messageid, WX.CRM.Model.Entity.SMS_SENDLOG logInfo) { try { WX.CRM.IBLL.Sms.ISMS_MESSAGE_Q msg = new WX.CRM.BLL.Sms.SMS_MESSAGE_BL(); msg.ExecLog(messageid, logInfo); } catch (Exception ex) { WX.CRM.Common.LogHelper.Error("CrmMsg.ExecLog():" + ex.Message + ex.StackTrace); } } } }