90 lines
2.6 KiB
C#
90 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace WX.CRM.CRMServices.SMS.DataDrive
|
|
{
|
|
internal class CrmMsg
|
|
{
|
|
static List<CrmMsgSendModel> sendList = new List<CrmMsgSendModel>();
|
|
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();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取一批待发短信
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 处理日志
|
|
/// </summary>
|
|
/// <param name="detaisIds"></param>
|
|
/// <param name="logInfo"></param>
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|