ComplianceServer/oldcode/CoreService/PkgSms/DataDrive/CrmMsg.cs

93 lines
2.6 KiB
C#

using CRM.Core.BLL.Sms;
using CRM.Core.Model.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
namespace CRM.Core.CoreService.PkgSms.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();
SMS_MESSAGE_BL msg = new 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,
subtypecode = oo.SUBTYPECODE
});
}
}
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, SMS_SENDLOG logInfo)
{
try
{
SMS_MESSAGE_BL msg = new SMS_MESSAGE_BL();
msg.ExecLog(messageid, logInfo);
}
catch (Exception ex)
{
WX.CRM.Common.LogHelper.Error("CrmMsg.ExecLog():" + ex.Message + ex.StackTrace);
}
}
}
}