fix(#I12XVH): 手机登录返回 Json 无法反序列化暂时使用 JsonDoc

#Comment
Comment #I12XVH
System.Text.Json 反序列化失败原因待查明

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

View File

@ -44,7 +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);
// UNDONE: 此处反序列化失败原因不明
// var result = JsonSerializer.Deserialize<SMSResult>(content);
var result = new SMSResult();
var doc = JsonDocument.Parse(content);
result.Code = doc.RootElement.GetProperty("code").GetInt32();
result.Data = doc.RootElement.GetProperty("data").GetString();
#else
var result = JsonConvert.DeserializeObject<SMSResult>(content, new JsonSerializerSettings() { ContractResolver = new DefaultContractResolver() });
#endif