Exemple #1
0
        private void getsmssendstatusanalysis(HttpContext context)
        {
            DateTime StartTime      = WebUtil.GetDateValue(context, "StartTime");
            DateTime EndTime        = WebUtil.GetDateValue(context, "EndTime");
            long     startRowIndex  = WebUtil.GetDataGridStartRowIndex();
            int      pageSize       = WebUtil.GetDataGridPageSize();
            string   errormsg       = string.Empty;
            var      list           = new Utility.ResponseDataGrid();
            int      BillNumber     = 0;
            int      RequestNumber  = 0;
            int      SuccessNumber  = 0;
            int      TotalSmsCount  = 0;
            decimal  TotalSmsAmount = 0;
            int      RestNumber     = 0;
            bool     status         = Encript.EncriptHelper.GetMySmsPullStatusList(StartTime, EndTime, startRowIndex, pageSize, out errormsg, ref list, ref BillNumber, ref RequestNumber, ref SuccessNumber, ref TotalSmsCount, ref TotalSmsAmount);

            RestNumber = TotalSmsCount - BillNumber;
            if (!status)
            {
                WebUtil.WriteJson(context, new DataGrid());
                return;
            }
            var result = new Dictionary <string, object>();

            result["rows"]      = list.rows;
            result["page"]      = list.page;
            result["total"]     = list.total;
            result["countitem"] = new { BillNumber = BillNumber, RequestNumber = RequestNumber, SuccessNumber = SuccessNumber, TotalSmsCount = TotalSmsCount, TotalSmsAmount = TotalSmsAmount, RestNumber = RestNumber };
            WebUtil.WriteJson(context, result);
        }
Exemple #2
0
        /// <summary>
        /// 获取短信发送记录
        /// </summary>
        public static bool GetMySmsPullStatusList(DateTime StartTime, DateTime EndTime, long startRowIndex, int pageSize, out string errormsg, ref Utility.ResponseDataGrid list, ref int BillNumber, ref int RequestNumber, ref int SuccessNumber, ref int TotalSmsCount, ref decimal TotalSmsAmount)
        {
            errormsg = string.Empty;
            string          BaseURL  = Utility.Tools.GetContextPath();
            ResponseSmsPull response = null;
            int             i        = 0;

            do
            {
                try
                {
                    i++;
                    string key    = BaseURL;
                    string result = HttpRequest.Get(new Dictionary <string, string>()
                    {
                        { "visit", "getsmspulllist" }, { "key", key }, { "signature", SysConfig.GetSignature() }, { "token", SysConfig.GetToken() }, { "StartTime", StartTime.ToString("yyyy-MM-dd") }, { "EndTime", EndTime.ToString("yyyy-MM-dd") }, { "startRowIndex", startRowIndex.ToString() }, { "pageSize", pageSize.ToString() }
                    });
                    response = JsonConvert.DeserializeObject <ResponseSmsPull>(result);
                }
                catch (Exception ex)
                {
                    Utility.LogHelper.WriteError("EncryptHelper", "GetMySmsPullStatusList", ex);
                }
            } while (response == null && i <= 3);
            if (response != null)
            {
                list           = response.list;
                BillNumber     = response.BillNumber;
                RequestNumber  = response.RequestNumber;
                SuccessNumber  = response.SuccessNumber;
                TotalSmsCount  = response.TotalSmsCount;
                TotalSmsAmount = response.TotalSmsAmount;
                errormsg       = response.errormsg;
                return(response.status);
            }
            errormsg = "操作超时,请稍候重试";
            return(false);
        }