public IActionResult PutUserNote(int id, UserNoteDTO userNote, string token) { var userid = _utils.VerifyRequest(token); if (userid is null) { return(StatusCode(403)); } var note = _context.UserNote.Single(u => u.id == id); //调用百度API进行自然语言处理 var client = _utils.GetBaiduClient(); //情感分析 var sentiment_result = client.SentimentClassify(userNote.content); //关键词提取 var keywords = _services.ExtractKeywords(userNote.content); //更新 note.userid = int.Parse(userid); note.content = userNote.content; note.wordcount = userNote.wordcount; note.dateTime = userNote.dateTime; note.sentiment = sentiment_result["items"][0].Value <int>("sentiment"); note.tags = keywords; _context.Update <UserNote>(note); _context.SaveChanges(); return(StatusCode(200)); }