示例#1
0
        public string GetBalance(string User, string Pass)
        {
            string Result     = "";
            int    SmsBalance = 0;
            int    MmsBalance = 0;

            // 判断参数合法性
            if (User == "")
            {
                Result = _ERR_USERISEMPTY;
            }
            else
            {
                if (Pass == "")
                {
                    Result = _ERR_PASSISEMPTY;
                }
                else
                {
                    // 查询余额
                    try
                    {
                        // 密码加密
                        //SMS.Model.RPCResult<string> enpass = InterfaceProxy.GetSendService().Encrypt(Pass);

                        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;
                    }
                }
            }

            GetBalanceResult ret = new GetBalanceResult();

            ret.Result     = Result;
            ret.SmsBalance = SmsBalance.ToString();
            ret.MmsBalance = MmsBalance.ToString();
            string data = JsonSerialize.Serialize <GetBalanceResult>(ret);

            return(data);
        }
示例#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 <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);
            }
        }
示例#3
0
        public ActionResult GetMO(string User, string Pass)
        {
            GetSMSResult ret = new GetSMSResult();

            if (string.IsNullOrWhiteSpace(User))
            {
                ret.Result = _ERR_USERISEMPTY;
            }

            if (string.IsNullOrWhiteSpace(Pass))
            {
                ret.Result = _ERR_PASSISEMPTY;
            }
            try
            {
                SMS.Model.RPCResult <List <SMS.Model.MOSMS> > mos = InterfaceProxy.GetSendService().GetSMS(User, Pass);

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

                    ret.MONum = msgs.Count.ToString();

                    ret.Msgs = (from mo in msgs
                                select new MO()
                    {
                        Mobile = mo.UserNumber,
                        Content = mo.Message,
                        MOTime = mo.ReceiveTime.ToString()
                    }).ToList();
                }
                else
                {
                    ret.Result = mos.Message;
                }
            }
            catch (Exception ex)
            {
                ret.Result = _ERR_SERVICE;
            }
            string data = JsonSerialize.Serialize <GetSMSResult>(ret);

            return(Content(data));
        }
示例#4
0
        public ActionResult GetBalance(string User, string Pass)
        {
            string _Result     = "";
            int    _SmsBalance = 0;

            if (string.IsNullOrWhiteSpace(User))
            {
                _Result = _ERR_USERISEMPTY;
            }

            else if (string.IsNullOrWhiteSpace(Pass))
            {
                _Result = _ERR_PASSISEMPTY;
            }
            // 查询余额
            try
            {
                SMS.Model.RPCResult <SMS.Model.UserBalance> r = InterfaceProxy.GetSendService().GetBalanceByPlainPass(User, Pass);
                if (r.Success)
                {
                    _Result     = _ERR_SUCCESS;
                    _SmsBalance = r.Value.SmsBalance;
                }
                else
                {
                    _Result = r.Message;
                }
            }
            catch (Exception ex)
            {
                _Result = _ERR_SERVICE;
            }
            GetBalanceResult ret = new GetBalanceResult();

            ret.Result     = _Result;
            ret.SmsBalance = _SmsBalance.ToString();
            string data = JsonSerialize.Serialize <GetBalanceResult>(ret);

            return(Content(data));
        }
示例#5
0
 public ActionResult GetActionResult(SMS.Model.RPCResult result)
 {
     ISMPModel.RPC_Result r = new ISMPModel.RPC_Result(result.Success, result.Message);
     return(GetActionResult(r));
 }
示例#6
0
        public ActionResult GetActionResult <T>(SMS.Model.RPCResult <T> result)
        {
            RPC_Result <T> r = new RPC_Result <T>(result.Success, result.Value, result.Message);

            return(GetActionResult(r));
        }
示例#7
0
        public string GetReport(string User, string Pass, string MsgID)
        {
            string        result  = "";
            List <Report> Reports = new List <Report>();

            // 判断参数合法性
            if (User == "")
            {
                result = _ERR_USERISEMPTY;
            }
            else
            {
                if (Pass == "")
                {
                    result = _ERR_PASSISEMPTY;
                }
                else
                {
                    if (MsgID == "") // 根据账号查询
                    {
                        try
                        {
                            // 密码加密
                            //SMS.Model.RPCResult<string> enpass = InterfaceProxy.GetSendService().Encrypt(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;

                                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().Encrypt(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;

                                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;
                        }
                    }
                }
            }

            GetReportResult ret = new GetReportResult();

            ret.Result  = result;
            ret.Reports = Reports;
            string data = JsonSerialize.Serialize <GetReportResult>(ret);

            return(data);
        }
示例#8
0
        public string GetSMS(string User, string Pass)
        {
            string    result = "";
            int       MONum  = 0;
            int       GetNum = 0;
            List <MO> MO     = new List <MO>();

            if (User == "")
            {
                result = _ERR_USERISEMPTY;
            }
            else
            {
                if (Pass == "")
                {
                    result = _ERR_PASSISEMPTY;
                }
                else
                {
                    try
                    {
                        // 密码加密
                        //SMS.Model.RPCResult<string> enpass = InterfaceProxy.GetSendService().Encrypt(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;

                            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;
                    }
                }
            }

            GetSMSResult ret = new GetSMSResult();

            ret.Result = result;
            ret.MONum  = MONum.ToString();
            ret.GetNum = GetNum.ToString();
            ret.Msgs   = MO;
            string data = JsonSerialize.Serialize <GetSMSResult>(ret);

            return(data);
        }
示例#9
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);
            }
        }
示例#10
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);
            }
        }