private List <SlidingWindow> GetSend(SMS sms) { List <SlidingWindow> submits = new List <SlidingWindow>(); //拆分长消息 int pkSize; int pkNum = SMSSplit.GetSplitNumber(sms.Content, sms.Signature, out pkSize); if (pkNum > 1) { for (int j = 0; j < sms.Number.Count; j++) { string content = sms.Content; //发送号码 for (int i = 0; i < pkNum; i++) { SGIP_SUBMIT submit = new SGIP_SUBMIT(Sequence.Instance.CreateID()); submit.Pk_total = (byte)pkNum; submit.Pk_number = (byte)(i + 1); //SPID submit.SPNumber = _setting.SrcID + sms.SPNumber; //被计费用户号码 submit.ChargeNumber = Setting.ChargeNumber; submit.UserCount = 1; submit.CorpId = Setting.CorpId; submit.ServiceType = Setting.ServiceType; submit.FeeType = Setting.FeeType; submit.FeeValue = Setting.FeeValue; //赠送用户的话费 submit.GivenValue = "0"; //代收费标志 submit.AgentFlag = (uint)SubmitAgentFlag.RealIncome; submit.MorelatetoMTFlag = 2; //优先级 submit.Priority = 0; //sms.Level; submit.ExpireTime = ""; // Setting.ExpireTime; submit.ScheduleTime = ""; // sms.SendTime.ToString(); //状态报告 submit.ReportFlag = (byte)1; //sms.StatusReport == StatusReportType.Disable ? (byte)2 : (byte)1; submit.TP_pid = 0; submit.TP_udhi = 1; submit.MessageCoding = 8; submit.MessageType = 0; submit.LinkID = ""; submit.WapURL = sms.WapURL; submit.MessageContent = SMSSplit.GetSubString(content, pkSize); content = content.Substring(submit.MessageContent.Length); if (submit.Pk_number == pkNum) { submit.MessageContent = submit.MessageContent + sms.Signature; } submit.SetHeader(); submit.UserNumber = sms.Number[j]; if (submit.UserNumber.Length == 11) { submit.UserNumber = "86" + submit.UserNumber; } SlidingWindow _send = new SlidingWindow(); string serial = submit.Header.SrcNodeSequence.ToString() + submit.Header.DateSequence.ToString() + submit.Header.Sequence_Id.ToString(); SMS tsms = new SMS(); tsms.Account = sms.Account; tsms.Audit = sms.Audit; tsms.Channel = sms.Channel; tsms.Content = submit.MessageContent; tsms.Filter = sms.Filter; tsms.Level = sms.Level; tsms.Number = sms.Number; tsms.SendTime = sms.SendTime; tsms.SerialNumber = sms.SerialNumber; tsms.StatusReport = sms.StatusReport; tsms.Signature = sms.Signature; tsms.SPNumber = sms.SPNumber; tsms.WapURL = sms.WapURL; _send.Report = new SendEventArgs(tsms, serial, false, ((ushort)PlatformCode.SGIP + (ushort)SystemCode.SendReady), "", (ushort)submit.Pk_total, (ushort)submit.Pk_number); _send.MSG = submit; _send.SendCount = 0; _send.SendTime = DateTime.Now; _send.Status = WindowStatus.Fill; submits.Add(_send); } } } else { for (int j = 0; j < sms.Number.Count; j++) { //发送号码 SGIP_SUBMIT submit = new SGIP_SUBMIT(Sequence.Instance.CreateID()); submit.Pk_total = 1; submit.Pk_number = 1; //SPID submit.SPNumber = _setting.SrcID + sms.SPNumber; //被计费用户号码 submit.ChargeNumber = Setting.ChargeNumber; submit.UserCount = 1; submit.CorpId = Setting.CorpId; submit.ServiceType = Setting.ServiceType; submit.FeeType = Setting.FeeType; submit.FeeValue = Setting.FeeValue; //赠送用户的话费 submit.GivenValue = "0"; //代收费标志 submit.AgentFlag = (uint)SubmitAgentFlag.RealIncome; submit.MorelatetoMTFlag = 2; //优先级 submit.Priority = 0; //sms.Level; submit.ExpireTime = ""; //Setting.ExpireTime; submit.ScheduleTime = ""; //sms.SendTime.ToString(); //状态报告 submit.ReportFlag = sms.StatusReport == StatusReportType.Disable ? (byte)2 : (byte)1; submit.TP_pid = 0; submit.TP_udhi = 0; submit.MessageCoding = 15; submit.MessageType = 0; submit.LinkID = ""; submit.WapURL = sms.WapURL; submit.MessageContent = sms.Content + sms.Signature; submit.SetHeader(); submit.UserNumber = sms.Number[j]; if (submit.UserNumber.Length == 11) { submit.UserNumber = "86" + submit.UserNumber; } SlidingWindow _send = new SlidingWindow(); string serial = submit.Header.SrcNodeSequence.ToString() + submit.Header.DateSequence.ToString() + submit.Header.Sequence_Id.ToString(); SMS tsms = new SMS(); tsms.Account = sms.Account; tsms.Audit = sms.Audit; tsms.Channel = sms.Channel; tsms.Content = submit.MessageContent; tsms.Filter = sms.Filter; tsms.Level = sms.Level; tsms.Number = sms.Number; tsms.SendTime = sms.SendTime; tsms.SerialNumber = sms.SerialNumber; tsms.StatusReport = sms.StatusReport; tsms.Signature = sms.Signature; tsms.SPNumber = sms.SPNumber; tsms.WapURL = sms.WapURL; _send.Report = new SendEventArgs(tsms, serial, false, ((ushort)PlatformCode.SGIP + (ushort)SystemCode.SendReady), "", (ushort)submit.Pk_total, (ushort)submit.Pk_number); _send.MSG = submit; _send.SendCount = 0; _send.SendTime = DateTime.Now; _send.Status = WindowStatus.Fill; submits.Add(_send); } } return(submits); }
public void SendSubmit(SMS sms) { SGIPSUBMIT sb = sms.Extend as SGIPSUBMIT; if (sb == null) { return; } //发送号码 SGIP_SUBMIT submit = new SGIP_SUBMIT(Sequence.Instance.CreateID()); submit.Pk_total = sb.Pk_total; submit.Pk_number = sb.Pk_number; //SPID submit.SPNumber = sb.SPNumber; //被计费用户号码 submit.ChargeNumber = sb.ChargeNumber; submit.UserCount = sb.UserCount; submit.CorpId = sb.CorpId; submit.ServiceType = sb.ServiceType; submit.FeeType = sb.FeeType; submit.FeeValue = sb.FeeValue; //赠送用户的话费 submit.GivenValue = sb.GivenValue; //代收费标志 submit.AgentFlag = sb.AgentFlag; submit.MorelatetoMTFlag = sb.MorelatetoMTFlag; //优先级 submit.Priority = sb.Priority; submit.ExpireTime = sb.ExpireTime; submit.ScheduleTime = sb.ScheduleTime; //状态报告 submit.ReportFlag = sb.ReportFlag; submit.TP_pid = sb.TP_pid; submit.TP_udhi = sb.TP_udhi; submit.MessageCoding = sb.MessageCoding; submit.MessageType = sb.MessageType; submit.LinkID = sb.LinkID; submit.WapURL = sb.WapURL; submit.MessageContent = sb.MessageContent; submit.UserNumber = sb.UserNumber; SlidingWindow _send = new SlidingWindow(); string serial = submit.Header.SrcNodeSequence.ToString() + submit.Header.DateSequence.ToString() + submit.Header.Sequence_Id.ToString(); SMS tsms = new SMS(); tsms.Account = sms.Account; tsms.Audit = sms.Audit; tsms.Channel = sms.Channel; tsms.Content = submit.MessageContent; tsms.Filter = sms.Filter; tsms.Level = sms.Level; tsms.Number = sms.Number; tsms.SendTime = sms.SendTime; tsms.SerialNumber = sms.SerialNumber; tsms.StatusReport = sms.StatusReport; tsms.Signature = sms.Signature; tsms.SPNumber = sms.SPNumber; tsms.WapURL = sms.WapURL; _send.Report = new SendEventArgs(tsms, serial, false, ((ushort)PlatformCode.SGIP + (ushort)SystemCode.SendReady), "", (ushort)submit.Pk_total, (ushort)submit.Pk_number); _send.MSG = submit; _send.SendCount = 0; _send.SendTime = DateTime.Now; _send.Status = WindowStatus.Fill; while (true) { if (Ready == 0) { Thread.Sleep(10); continue; } SWSet(_send); ClientSend(_send.MSG); DebugLog.Instance.Write <SGIP_SUBMIT>("Client SendSubmit -> SGIP_SUBMIT", (SGIP_SUBMIT)_send.MSG); break; } }