fix 餐补job

This commit is contained in:
2024-03-23 21:33:17 +08:00
parent bb80953da2
commit 49ba03c5d2

View File

@@ -71,9 +71,14 @@ public class JinkoJIPService : IJinkoJIPService
_logger.LogInformation("餐补状态同步响应:{json}", responseJson);
var jobj = JObject.Parse(responseJson);
jobj.ContainsKey("exp").ThrowIfTrue(jobj.GetValue("exp").Value<string>());
jobj.ContainsKey("message").ThrowIfTrue(jobj.GetValue("message").Value<string>());
if (jobj.TryGetValue("exp", out var exp))
{
true.ThrowIfTrue(exp.Value<string>());
}
if (jobj.TryGetValue("message", out var message) && !jobj.ContainsKey("code"))
{
true.ThrowIfTrue(message.Value<string>());
}
(jobj.GetValue("code").Value<int>() != 200).ThrowIfTrue(jobj.GetValue("message").Value<string>());