/// <summary>传递信息</summary> /// <param name="target">目标对象</param> /// <param name="content"></param> /// <returns></returns> public void DeliverMessage(String target, String content) { if (String.IsNullOrEmpty(target) || String.IsNullOrEmpty(content)) { return; } if (!target.StartsWith("86")) { target = "86" + target; } var cmd = new SGIPDeliver(); cmd.UserNumber = target; cmd.SPNumber = SPNumber + SystemID.Substring(4) + "4888"; cmd.TP_pid = 0; cmd.TP_udhi = 0; cmd.MessageCoding = SGIPMessageCodings.Gbk; cmd.MessageLength = (UInt32)content.Length; cmd.MessageContent = content; WriteLog("正在向" + target + "分发信息……"); //Deliver_Resp resp = Send(cmd) as Deliver_Resp; Send(cmd); }
/// <summary>发信息</summary> /// <param name="target">目标对象</param> /// <param name="content"></param> public void SendMessage(String target, String content) { if (String.IsNullOrEmpty(target) || String.IsNullOrEmpty(content)) { return; } if (!target.StartsWith("86")) { target = "86" + target; } var cmd = new SGIPSubmit(); String id = SystemID; if (id.Length > 4) { id = SystemID.Substring(4); } cmd.SPNumber = SPNumber + id + "4888"; cmd.ChargeNumber = new String('0', 21); cmd.UserCount = 1; cmd.UserNumber = target; cmd.CorpId = CorpID; cmd.ServiceType = ServiceType; cmd.FeeType = FeeTypes.FreeSend; cmd.FeeValue = "0"; cmd.GivenValue = "0"; cmd.AgentFlag = SubmitAgentFlags.SouldIncome; cmd.MorelatetoMTFlag = SubmitMorelatetoMTFlags.NormalFirst; cmd.Priority = 0; cmd.ExpireTime = ""; cmd.ScheduleTime = ""; cmd.ReportFlag = SubmitReportFlags.Always; cmd.TP_pid = 0; cmd.TP_udhi = 0; cmd.MessageCoding = SGIPMessageCodings.Gbk; //cmd.MessageCoding = MessageCodings.Ascii; cmd.MessageType = 0; //cmd.MessageLength = (UInt32)content.Length; cmd.MessageContent = content; WriteLog("正在向" + target + "发信息……"); //Submit_Resp resp = Send(cmd) as Submit_Resp; Send(cmd); }