From c3dbe91be2ebfa4ba71568c4c988d958572bfd27 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 17 Sep 2019 13:34:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=A4=B1=E8=B4=A5=E6=97=A5=E5=BF=97=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/admin/Bootstrap.DataAccess/Helper/SMSHelper.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/admin/Bootstrap.DataAccess/Helper/SMSHelper.cs b/src/admin/Bootstrap.DataAccess/Helper/SMSHelper.cs index d1e67d59..3805513e 100644 --- a/src/admin/Bootstrap.DataAccess/Helper/SMSHelper.cs +++ b/src/admin/Bootstrap.DataAccess/Helper/SMSHelper.cs @@ -3,6 +3,7 @@ using Newtonsoft.Json; using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Collections.Specialized; using System.Net.Http; using System.Security.Cryptography; using System.Text; @@ -36,13 +37,23 @@ namespace Bootstrap.DataAccess var url = QueryHelpers.AddQueryString("http://open.bluegoon.com/api/sms/sendcode", requestParameters); var req = await client.GetAsync(url); - var result = JsonConvert.DeserializeObject(await req.Content.ReadAsStringAsync()); + var content = await req.Content.ReadAsStringAsync(); + var result = JsonConvert.DeserializeObject(content); var ret = false; if (result.Code == "1") { _pool.AddOrUpdate(option.Phone, key => new AutoExpireValidateCode(option.Phone, result.Data, option.Expires), (key, v) => v.Reset(result.Data)); ret = true; } + else + { + new Exception("SMS Send Fail").Log(new NameValueCollection() + { + ["UserId"] = option.Phone, + ["url"] = url, + ["content"] = content + }); + } return ret; }