コード例 #1
0
        public void ProcessRequest(HttpContext context)
        {
            var    website = bllWebsite.GetWebsiteInfoModelFromDataBase();
            int    num     = 30;
            string url     = string.Empty;

            if (HttpContext.Current.Request.Url.Host.ToString().Contains("localhost"))
            {
                num = 1;
                url = "https://open-api-sandbox.shop.ele.me/token";
            }
            else
            {
                url = "https://open-api.shop.ele.me/token";
            }
            if (!string.IsNullOrWhiteSpace(website.ElemeAccessToken) && website.ElemeTokenLastUpdateDate.Value.AddDays(num) > DateTime.Now)
            {
                apiResp.result = website.ElemeAccessToken;
            }
            else
            {
                Authorize         model      = new Authorize(website.ElemeAppKey, website.ElemeAppSecret);
                AuthorizeResponse toKenModel = model.GetToken(url);
                website.ElemeAccessToken         = toKenModel.access_token;
                website.ElemeTokenLastUpdateDate = DateTime.Now;
                bllWebsite.Update(website);
                apiResp.result = website.ElemeAccessToken;
            }
            apiResp.status = true;
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }
コード例 #2
0
ファイル: Update.ashx.cs プロジェクト: uvbs/mmp
        /// <summary>
        /// 设置短信余额提醒
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            string smsRemindValue     = context.Request["sms_remind_value"];
            string smsRemindPhones    = context.Request["sms_remind_phones"];
            string smsRemindFrequency = context.Request["sms_remind_frequency"];

            var website = bllWebsite.GetWebsiteInfoModelFromDataBase();

            website.SmsAccountRemindValue     = Convert.ToInt32(smsRemindValue);
            website.SmsAccountRemindPhones    = smsRemindPhones;
            website.SmsAccountRemindFrequency = Convert.ToInt32(smsRemindFrequency);

            if (bllWebsite.Update(website))
            {
                apiResp.msg    = "设置成功";
                apiResp.status = true;
            }
            else
            {
                apiResp.msg  = "设置出错";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
            }
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }