Example #1
0
        /// <summary>
        /// 发送短信
        /// </summary>
        /// <param name="Phone">手机号码</param>
        /// <param name="param">短信参数</param>
        /// <param name="sign">短信模板签名</param>
        /// <param name="template">短信模板</param>
        public void Send(string Phone, Dictionary <string, string> param, string sign, string template)
        {
            Task.Factory.StartNew(() =>
            {
                string url      = ResourceManager.GetSettingEntity("Alidayu_URL").Value;
                string appkey   = ResourceManager.GetSettingEntity("Alidayu_AppKey").Value;
                string secret   = ResourceManager.GetSettingEntity("Alidayu_AppSecret").Value;
                string SignName = ResourceManager.GetSettingEntity("Alidayu_SignName").Value;

                Top.Api.ITopClient client = new Top.Api.DefaultTopClient(url, appkey, secret);
                Top.Api.Request.AlibabaAliqinFcSmsNumSendRequest req = new Top.Api.Request.AlibabaAliqinFcSmsNumSendRequest();
                req.Extend          = "";
                req.SmsType         = "normal";
                req.SmsFreeSignName = SignName;
                req.SmsParam        = JsonConvert.SerializeObject(param);
                req.RecNum          = Phone;
                req.SmsTemplateCode = template;
                Top.Api.Response.AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);
            });
        }
Example #2
0
        public override void QueryRefreshToken()
        {
            var accessTokenUri = "https://oauth.taobao.com/token";

            Top.Api.DefaultTopClient topClient = new Top.Api.DefaultTopClient(accessTokenUri, _appkey, _appSecret);

            var createRequest = new TopAuthTokenRefreshRequest()
            {
                RefreshToken = _authModel.RefreshToken
            };
            var response = topClient.Execute(createRequest);

            if (!response.IsError)
            {
                JObject res = JObject.Parse(response.Body);
                _authModel.AccessToken  = res["access_token"].ToString();
                _authModel.RefreshToken = res["refresh_token"].ToString();
            }
            else
            {
                FrameworkLog.LogModel.LogHelper.WriteErrorLog($"刷新令牌失败:{response.ErrCode}{response.ErrMsg}");
            }
        }