public async Task GetHistory(string historyId) { var history = LiteDb.SingleById <HistoryGroup>(historyId); // 获取成功的数量 history.successCount = LiteDb.Fetch <SendItem>(s => s.historyId == history._id && s.isSent).Count; // 获取状态 await ResponseSuccessAsync(history); }
public async Task GetHistoryResult(string id) { HistoryGroup historyGroup = LiteDb.SingleById <HistoryGroup>(id); // 获取成功的数量 int successCount = LiteDb.Fetch <SendItem>(s => s.historyId == id && s.isSent).Count; JObject result; if (successCount == historyGroup.receiverIds.Count) { string msg = $"发送成功!共发送:{successCount}/{historyGroup.receiverIds.Count}"; result = new JObject(new JProperty("message", msg), new JProperty("ok", true)); } else { string msg = $"未完全发送,共发送:{successCount}/{historyGroup.receiverIds.Count}。请在发件历史中查询重发"; result = new JObject(new JProperty("message", msg), new JProperty("ok", false)); } await ResponseSuccessAsync(result); }