fix(#I12XVH): 手机登录支持 System.Text.Json

#Issue
link #I12XVH
This commit is contained in:
Argo Zhang 2019-10-04 00:12:32 +08:00
parent b362a0b683
commit f3e5403818
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
1 changed files with 3 additions and 6 deletions

View File

@ -44,15 +44,12 @@ namespace Bootstrap.DataAccess
var req = await client.GetAsync(url);
var content = await req.Content.ReadAsStringAsync();
#if NETCOREAPP3_0
var result = JsonSerializer.Deserialize<SMSResult>(content, new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true
});
var result = JsonSerializer.Deserialize<SMSResult>(content);
#else
var result = JsonConvert.DeserializeObject<SMSResult>(content, new JsonSerializerSettings() { ContractResolver = new DefaultContractResolver() });
#endif
var ret = false;
if (result.Code == "1")
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;
@ -95,7 +92,7 @@ namespace Bootstrap.DataAccess
private class SMSResult
{
public string Code { get; set; }
public int Code { get; set; }
public string Data { get; set; }
}