fix(#I12XVH): 手机登录支持 System.Text.Json
#Issue link #I12XVH
This commit is contained in:
parent
b362a0b683
commit
f3e5403818
|
@ -44,15 +44,12 @@ namespace Bootstrap.DataAccess
|
||||||
var req = await client.GetAsync(url);
|
var req = await client.GetAsync(url);
|
||||||
var content = await req.Content.ReadAsStringAsync();
|
var content = await req.Content.ReadAsStringAsync();
|
||||||
#if NETCOREAPP3_0
|
#if NETCOREAPP3_0
|
||||||
var result = JsonSerializer.Deserialize<SMSResult>(content, new JsonSerializerOptions()
|
var result = JsonSerializer.Deserialize<SMSResult>(content);
|
||||||
{
|
|
||||||
PropertyNameCaseInsensitive = true
|
|
||||||
});
|
|
||||||
#else
|
#else
|
||||||
var result = JsonConvert.DeserializeObject<SMSResult>(content, new JsonSerializerSettings() { ContractResolver = new DefaultContractResolver() });
|
var result = JsonConvert.DeserializeObject<SMSResult>(content, new JsonSerializerSettings() { ContractResolver = new DefaultContractResolver() });
|
||||||
#endif
|
#endif
|
||||||
var ret = false;
|
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));
|
_pool.AddOrUpdate(option.Phone, key => new AutoExpireValidateCode(option.Phone, result.Data, option.Expires), (key, v) => v.Reset(result.Data));
|
||||||
ret = true;
|
ret = true;
|
||||||
|
@ -95,7 +92,7 @@ namespace Bootstrap.DataAccess
|
||||||
|
|
||||||
private class SMSResult
|
private class SMSResult
|
||||||
{
|
{
|
||||||
public string Code { get; set; }
|
public int Code { get; set; }
|
||||||
|
|
||||||
public string Data { get; set; }
|
public string Data { get; set; }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue