Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                _User = Request["USER"];
                _Pass = Request["PASS"];
                // 判断参数合法性
                if (string.IsNullOrWhiteSpace(_User))
                {
                    _Result = _ERR_USERISEMPTY;
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(_Pass))
                    {
                        _Result = _ERR_PASSISEMPTY;
                    }
                    else
                    {
                        // 判断用户名和密码是否正确

                        // 查询余额
                        try
                        {
                            SMS.Model.RPCResult <SMS.Model.UserBalance> r = InterfaceProxy.GetSendService().GetBalanceByPlainPass(_User, _Pass);
                            if (r.Success)
                            {
                                _Result     = _ERR_SUCCESS;
                                _SmsBalance = r.Value.SmsBalance;
                                _MmsBalance = r.Value.MmsBalance;
                            }
                            else
                            {
                                _Result = r.Message;
                            }
                        }
                        catch (Exception ex)
                        {
                            _Result = _ERR_SERVICE;
                        }
                    }
                }

                // 返回结果
                WriteResponse(_Result, _SmsBalance, _MmsBalance);
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                _User = Request["User"];
                _Pass = Request["Pass"];
                // 判断参数合法性
                if (string.IsNullOrWhiteSpace(_User))
                {
                    _Result = _ERR_USERISEMPTY;
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(_Pass))
                    {
                        _Result = _ERR_PASSISEMPTY;
                    }
                    else
                    {
                        // 判断用户名和密码是否正确

                        try
                        {
                            // 密码加密
                            //SMS.Model.RPCResult<string> enpass = InterfaceProxy.GetSendService().EncryptByAccount(_User,_Pass);

                            SMS.Model.RPCResult <List <SMS.Model.MOSMS> > mos = InterfaceProxy.GetSendService().GetSMS(_User, _Pass);

                            if (mos.Success)
                            {
                                _Result = _ERR_SUCCESS;
                                List <SMS.Model.MOSMS> msgs = mos.Value;

                                _GetNum = msgs.Count;

                                _MO = new List <MO>();
                                for (int k = 0; k < msgs.Count; k++)
                                {
                                    MO mo = new MO();
                                    mo.Src     = msgs[k].UserNumber;
                                    mo.Content = msgs[k].Message;
                                    mo.MOTime  = msgs[k].ReceiveTime.ToString("yyyy-MM-dd HH:mm:ss");
                                    _MO.Add(mo);
                                }
                            }
                            else
                            {
                                _Result = mos.Message;
                            }
                        }
                        catch (Exception ex)
                        {
                            _Result = _ERR_SERVICE;
                        }
                    }
                }

                // 返回结果
                WriteResponse(_Result, _MONum, _GetNum, _MO);
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string[] dest;

                _User     = Request["User"];
                _Pass     = Request["Pass"];
                _Dests    = Request["Destinations"];
                _Content  = Request["Content"];
                _SendTime = Request["SendTime"];

                // 判断参数合法性
                if (string.IsNullOrWhiteSpace(_User))
                {
                    _Result = _ERR_USERISEMPTY;
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(_Pass))
                    {
                        _Result = _ERR_PASSISEMPTY;
                    }
                    else
                    {
                        // 判断用户名和密码是否正确

                        if (string.IsNullOrWhiteSpace(_Dests))
                        {
                            _Result = _ERR_DESTISEMPTY;
                        }
                        else
                        {
                            dest = Regex.Split(_Dests, ",");
                            if (dest.Count() > 1000) // 接收短信的终端数量大于1000个
                            {
                                _Result = _ERR_DESTTOLONG;
                            }
                            else // 发送短信
                            {
                                // 接收短信的号码
                                List <string> num = new List <string>();
                                foreach (string destnum in dest)
                                {
                                    num.Add(destnum);
                                }

                                // 发送短信
                                try
                                {
                                    // 密码加密
                                    //SMS.Model.RPCResult<string> enpass = InterfaceProxy.GetSendService().EncryptByAccount(_User,_Pass);

                                    // SMS.Model.RPCResult<Guid> r = InterfaceProxy.GetSendService().SendSMS(_User, _Pass, _Content, num);
                                    var r = InterfaceProxy.GetSendService().SendSMS(_User, _Pass, _Content, num, "http");
                                    if (r.Success)
                                    {
                                        _Result = _ERR_SUCCESS;
                                        _MsgID  = r.Value.SMSNumbers[0].ID.ToString();
                                        if (r.Value.Message.AuditType == SMS.Model.AuditType.Manual)
                                        {
                                            APPCode.Util.SendToDoToSMSAuditor(r.Value.Message);
                                        }
                                    }
                                    else
                                    {
                                        _Result = r.Message;
                                    }
                                }
                                catch (Exception ex)
                                {
                                    _Result = _ERR_SERVICE;
                                }
                            }
                        }
                    }
                }

                // 返回结果
                WriteResponse(_Result, _MsgID);
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                _User  = Request["User"];
                _Pass  = Request["Pass"];
                _MsgID = Request["MsgID"];
                // 判断参数合法性
                if (string.IsNullOrWhiteSpace(_User))
                {
                    _Result = _ERR_USERISEMPTY;
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(_Pass))
                    {
                        _Result = _ERR_PASSISEMPTY;
                    }
                    else
                    {
                        // 判断用户名和密码是否正确

                        if (string.IsNullOrWhiteSpace(_MsgID)) // 根据账号查询
                        {
                            try
                            {
                                // 密码加密
                                //SMS.Model.RPCResult<string> enpass = InterfaceProxy.GetSendService().EncryptByAccount(_User,_Pass);

                                SMS.Model.RPCResult <List <SMS.Model.StatusReport> > r = InterfaceProxy.GetSendService().GetReport(_User, _Pass);
                                if (r.Success)
                                {
                                    _Result = _ERR_SUCCESS;
                                    List <SMS.Model.StatusReport> rts = r.Value;

                                    _Reports = new List <Report>();
                                    for (int k = 0; k < rts.Count; k++)
                                    {
                                        Report rt = new Report();
                                        rt.MsgID       = rts[k].SMSID.ToString();
                                        rt.Destination = rts[k].Number;
                                        rt.Stat        = rts[k].StatusCode.ToString();
                                        _Reports.Add(rt);
                                    }
                                }
                                else
                                {
                                    _Result = r.Message;
                                }
                            }
                            catch (Exception ex)
                            {
                                _Result = _ERR_SERVICE;
                            }
                        }
                        else  // 根据短信标识查询
                        {
                            try
                            {
                                // 密码加密
                                //SMS.Model.RPCResult<string> enpass = InterfaceProxy.GetSendService().EncryptByAccount(_User,_Pass);

                                SMS.Model.RPCResult <List <SMS.Model.StatusReport> > r = InterfaceProxy.GetSendService().GetReport(_User, _Pass, _MsgID);
                                if (r.Success)
                                {
                                    _Result = _ERR_SUCCESS;
                                    List <SMS.Model.StatusReport> rts = r.Value;

                                    _Reports = new List <Report>();
                                    for (int k = 0; k < rts.Count; k++)
                                    {
                                        Report rt = new Report();
                                        rt.MsgID       = rts[k].SMSID.ToString();
                                        rt.Destination = rts[k].Number;
                                        rt.Stat        = rts[k].StatusCode.ToString();
                                        _Reports.Add(rt);
                                    }
                                }
                                else
                                {
                                    _Result = r.Message;
                                }
                            }
                            catch (Exception ex)
                            {
                                _Result = _ERR_SERVICE;
                            }
                        }
                    }
                }

                // 返回结果
                WriteResponse(_Result, _Reports);
            }
        }