public async ValueTask <IActionResult> Post() { if (!Main.Options.EnableHttpPost) { return(Ok()); } string rawMsg; using (var reader = new StreamReader(Request.Body, Encoding.UTF8)) { rawMsg = await reader.ReadToEndAsync(); } var json = JObject.Parse(rawMsg); if (!json.ContainsKey("post_type")) { return(Ok()); } var result = await _eventManager.Adapter(json, _api, rawMsg); if (result is BaseQuickOperation reply) { _logger.LogInformation("[HandleQuickOperation]返回快速操作"); return(Ok(JsonConvert.SerializeObject(reply, Formatting.None))); } return(Ok()); }
public async ValueTask <ActionResult> Post() { string rawMsg; using (var reader = new StreamReader(Request.Body, Encoding.UTF8)) { rawMsg = await reader.ReadToEndAsync(); } var json = JObject.Parse(rawMsg); if (!json.ContainsKey("post_type")) { return(Ok()); } var result = await _eventManager.Adapter(json, _api, rawMsg); return(result switch { null => Ok(), BaseEventReturn replay => Ok(replay), _ => Ok() });