AdminArticleController.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. package com.etotem.cfc.controller.admin;
  2. import com.etotem.cfc.common.Result;
  3. import com.etotem.cfc.entity.Article;
  4. import com.etotem.cfc.entity.ArticleCategory;
  5. import com.etotem.cfc.service.ArticleCategoryService;
  6. import com.etotem.cfc.service.ArticleCommentService;
  7. import com.etotem.cfc.service.ArticleService;
  8. import com.etotem.cfc.service.FileStorageService;
  9. import com.etotem.cfc.service.api.WechatServiceInterface;
  10. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  11. import org.slf4j.Logger;
  12. import org.slf4j.LoggerFactory;
  13. import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
  14. import org.springframework.web.bind.annotation.*;
  15. import org.springframework.web.multipart.MultipartFile;
  16. import javax.annotation.Resource;
  17. import java.util.HashMap;
  18. import java.util.List;
  19. import java.util.Map;
  20. import java.util.Objects;
  21. import java.util.concurrent.Future;
  22. import java.util.concurrent.TimeUnit;
  23. import com.etotem.cfc.util.SortUtil;
  24. import com.etotem.cfc.util.ParamUtils;
  25. @RestController
  26. @RequestMapping("/api/admin/articles")
  27. public class AdminArticleController {
  28. private static final Logger log = LoggerFactory.getLogger(AdminArticleController.class);
  29. @Resource
  30. private ArticleService articleService;
  31. @Resource
  32. private ArticleCategoryService articleCategoryService;
  33. @Resource
  34. private FileStorageService fileStorageService;
  35. @Resource
  36. private ArticleCommentService articleCommentService;
  37. @Resource
  38. private WechatServiceInterface wechatService;
  39. @Resource
  40. private ThreadPoolTaskExecutor taskExecutor;
  41. /**
  42. * 文本内容安全检测:带 5 秒硬超时,超时/异常时 fail-open 放行并记录日志,
  43. * 避免微信接口卡顿导致文章创建/更新接口耗时数十秒(BUG-J)。
  44. */
  45. private boolean checkTextSafe(String text) {
  46. if (text == null || text.trim().isEmpty()) return true;
  47. try {
  48. Future<Boolean> future = taskExecutor.submit(() -> wechatService.checkText(text));
  49. return future.get(5, TimeUnit.SECONDS);
  50. } catch (Exception e) {
  51. log.warn("文本内容安全检测超时或执行失败,fail-open: {}", e.getMessage());
  52. return true;
  53. }
  54. }
  55. @PostMapping("/list")
  56. public Result<Page<Article>> list(@RequestBody Map<String, Object> body) {
  57. String status = (String) body.get("status");
  58. Long categoryId = ParamUtils.getLong(body.get("categoryId"));
  59. String keyword = (String) body.get("keyword");
  60. String contentType = (String) body.get("contentType");
  61. Integer difficultyLevel = body.get("difficultyLevel") != null ? Integer.valueOf(body.get("difficultyLevel").toString()) : null;
  62. String dimensionCode = (String) body.get("dimensionCode");
  63. Long tagId = ParamUtils.getLong(body.get("tagId"));
  64. String auditStatus = (String) body.get("auditStatus");
  65. int page = body.get("page") != null ? Integer.parseInt(body.get("page").toString()) : 1;
  66. int size = body.get("size") != null ? Integer.parseInt(body.get("size").toString()) : 20;
  67. @SuppressWarnings("unchecked")
  68. List<Map<String, String>> sortSpecs = body.get("sort") != null
  69. ? (List<Map<String, String>>) body.get("sort")
  70. : null;
  71. return Result.success(articleService.getAdminList(status, categoryId, keyword, contentType, difficultyLevel, dimensionCode, tagId, auditStatus, page, size, sortSpecs));
  72. }
  73. @PostMapping("/create")
  74. public Result<Map<String, Object>> create(@RequestBody Map<String, Object> body,
  75. @RequestAttribute("userId") Long adminId,
  76. @RequestAttribute("role") String role) {
  77. // B-142-1:admin 端点角色守卫(参照本控制器 #move 与 AdminReferralController#summary 的「无权限」惯例),
  78. // 双保险——拦截器已整族强制登录,此处再拒绝非 admin(如登录的 parent/child)越权建文章。
  79. if (!"admin".equals(role)) {
  80. return Result.error("无权限");
  81. }
  82. String title = (String) body.get("title");
  83. String content = (String) body.get("content");
  84. // 文本内容安全检测(带超时,不阻塞接口)
  85. if (!checkTextSafe(title)) {
  86. return Result.error("文章标题包含敏感信息,发布失败");
  87. }
  88. if (!checkTextSafe(content)) {
  89. return Result.error("文章内容包含敏感信息,发布失败");
  90. }
  91. if (!checkTextSafe((String) body.get("audioText"))) {
  92. return Result.error("朗读文本包含敏感信息,发布失败");
  93. }
  94. Article article = new Article();
  95. article.setTitle((String) body.get("title"));
  96. article.setContent((String) body.get("content"));
  97. // 朗读文本(TTS 专用;留空则自动从正文生成)
  98. if (body.get("audioText") != null) {
  99. article.setAudioText(body.get("audioText").toString());
  100. }
  101. if (body.get("categoryId") != null && !body.get("categoryId").toString().trim().isEmpty()) {
  102. article.setCategoryId(ParamUtils.getLong(body.get("categoryId")));
  103. }
  104. article.setSummary((String) body.get("summary"));
  105. article.setCoverImage((String) body.get("coverImage"));
  106. article.setTags((String) body.get("tags"));
  107. article.setAuthor((String) body.get("author"));
  108. if (body.get("readTime") != null && !body.get("readTime").toString().trim().isEmpty()) {
  109. article.setReadTime(Integer.valueOf(body.get("readTime").toString()));
  110. }
  111. if (body.get("contentType") != null) {
  112. article.setContentType((String) body.get("contentType"));
  113. }
  114. if (body.get("difficultyLevel") != null && !body.get("difficultyLevel").toString().trim().isEmpty()) {
  115. article.setDifficultyLevel(Integer.valueOf(body.get("difficultyLevel").toString()));
  116. }
  117. if (body.get("sortOrder") != null && !body.get("sortOrder").toString().trim().isEmpty()) {
  118. article.setSortOrder(Integer.valueOf(body.get("sortOrder").toString()));
  119. }
  120. // relatedDimensions may come as array from frontend
  121. Object rd = body.get("relatedDimensions");
  122. if (rd instanceof List) {
  123. article.setRelatedDimensions(String.join(",", (List<String>) rd));
  124. } else if (rd instanceof String) {
  125. article.setRelatedDimensions((String) rd);
  126. }
  127. // visibility, visibleTo, articleType may also come as array
  128. Object visibility = body.get("visibility");
  129. if (visibility instanceof List) {
  130. article.setVisibility(String.join(",", (List<String>) visibility));
  131. } else if (visibility instanceof String) {
  132. article.setVisibility((String) visibility);
  133. }
  134. Object visibleTo = body.get("visibleTo");
  135. if (visibleTo instanceof List) {
  136. article.setVisibleTo(String.join(",", (List<String>) visibleTo));
  137. } else if (visibleTo instanceof String) {
  138. article.setVisibleTo((String) visibleTo);
  139. }
  140. Object articleType = body.get("articleType");
  141. if (articleType instanceof List) {
  142. article.setArticleType(String.join(",", (List<String>) articleType));
  143. } else if (articleType instanceof String) {
  144. article.setArticleType((String) articleType);
  145. }
  146. if (body.get("status") != null) {
  147. article.setStatus((String) body.get("status"));
  148. }
  149. try {
  150. articleService.create(article, adminId);
  151. } catch (RuntimeException e) {
  152. return Result.error(e.getMessage());
  153. }
  154. Map<String, Object> result = new HashMap<>();
  155. result.put("id", article.getId());
  156. return Result.success(result);
  157. }
  158. @PostMapping("/update")
  159. public Result<String> update(@RequestBody Map<String, Object> body,
  160. @RequestAttribute("role") String role) {
  161. // S-cfc-315 / B-142-1:admin 角色守卫,非 admin(如登录的 parent/child)拒绝更新文章
  162. if (!"admin".equals(role)) {
  163. return Result.error("无权限");
  164. }
  165. String title = (String) body.get("title");
  166. String content = (String) body.get("content");
  167. // 文本内容安全检测(带超时,不阻塞接口)
  168. if (!checkTextSafe(title)) {
  169. return Result.error("文章标题包含敏感信息,更新失败");
  170. }
  171. if (!checkTextSafe(content)) {
  172. return Result.error("文章内容包含敏感信息,更新失败");
  173. }
  174. if (!checkTextSafe((String) body.get("audioText"))) {
  175. return Result.error("朗读文本包含敏感信息,更新失败");
  176. }
  177. Long articleId = ParamUtils.getLong(body.get("id"));
  178. Article existing = null;
  179. if (articleId != null) {
  180. existing = articleService.getById(articleId);
  181. if (existing != null && !"draft".equals(existing.getStatus())
  182. && !"published".equals(existing.getStatus())
  183. && !"withdrawn".equals(existing.getStatus())) {
  184. return Result.error("仅草稿、已上架或已撤回状态可编辑");
  185. }
  186. }
  187. Article article = new Article();
  188. article.setId(articleId);
  189. article.setTitle((String) body.get("title"));
  190. article.setContent((String) body.get("content"));
  191. if (body.get("categoryId") != null && !body.get("categoryId").toString().trim().isEmpty()) {
  192. article.setCategoryId(ParamUtils.getLong(body.get("categoryId")));
  193. }
  194. article.setSummary((String) body.get("summary"));
  195. article.setCoverImage((String) body.get("coverImage"));
  196. article.setTags((String) body.get("tags"));
  197. article.setAuthor((String) body.get("author"));
  198. if (body.get("readTime") != null && !body.get("readTime").toString().trim().isEmpty()) {
  199. article.setReadTime(Integer.valueOf(body.get("readTime").toString()));
  200. }
  201. if (body.get("contentType") != null) {
  202. article.setContentType((String) body.get("contentType"));
  203. }
  204. if (body.get("difficultyLevel") != null && !body.get("difficultyLevel").toString().trim().isEmpty()) {
  205. article.setDifficultyLevel(Integer.valueOf(body.get("difficultyLevel").toString()));
  206. }
  207. if (body.get("sortOrder") != null && !body.get("sortOrder").toString().trim().isEmpty()) {
  208. article.setSortOrder(Integer.valueOf(body.get("sortOrder").toString()));
  209. }
  210. Object rd = body.get("relatedDimensions");
  211. if (rd instanceof List) {
  212. article.setRelatedDimensions(String.join(",", (List<String>) rd));
  213. } else if (rd instanceof String) {
  214. article.setRelatedDimensions((String) rd);
  215. }
  216. Object visibilityVal = body.get("visibility");
  217. if (visibilityVal instanceof List) {
  218. article.setVisibility(String.join(",", (List<String>) visibilityVal));
  219. } else if (visibilityVal instanceof String) {
  220. article.setVisibility((String) visibilityVal);
  221. }
  222. Object visibleToVal = body.get("visibleTo");
  223. if (visibleToVal instanceof List) {
  224. article.setVisibleTo(String.join(",", (List<String>) visibleToVal));
  225. } else if (visibleToVal instanceof String) {
  226. article.setVisibleTo((String) visibleToVal);
  227. }
  228. Object articleTypeVal = body.get("articleType");
  229. if (articleTypeVal instanceof List) {
  230. article.setArticleType(String.join(",", (List<String>) articleTypeVal));
  231. } else if (articleTypeVal instanceof String) {
  232. article.setArticleType((String) articleTypeVal);
  233. }
  234. // 朗读文本(TTS 专用;留空则从正文生成)。是否作废旧音频由 ArticleService.update 统一判断
  235. if (body.get("audioText") != null) {
  236. article.setAudioText(body.get("audioText").toString());
  237. }
  238. articleService.update(article);
  239. return Result.success("更新成功");
  240. }
  241. @PostMapping("/detail")
  242. public Result<Article> detail(@RequestBody Map<String, Object> body) {
  243. if (body.get("id") == null) {
  244. return Result.error("缺少文章ID");
  245. }
  246. Long id = ParamUtils.getLong(body.get("id"));
  247. Article article = articleService.getById(id);
  248. if (article == null) {
  249. return Result.error("文章不存在");
  250. }
  251. return Result.success(article);
  252. }
  253. @PostMapping("/delete")
  254. public Result<String> delete(@RequestBody Map<String, Object> body,
  255. @RequestAttribute("role") String role) {
  256. // S-cfc-315 / B-142-1:admin 角色守卫,非 admin 拒绝删除文章
  257. if (!"admin".equals(role)) {
  258. return Result.error("无权限");
  259. }
  260. Long id = ParamUtils.getLong(body.get("id"));
  261. articleService.delete(id);
  262. return Result.success("删除成功");
  263. }
  264. @PostMapping("/{id}/publish")
  265. public Result<String> publishById(@PathVariable Long id, @RequestBody Map<String, Object> body,
  266. @RequestAttribute("role") String role) {
  267. // S-cfc-315 / B-142-1:admin 角色守卫,非 admin 拒绝直接发布/上下架
  268. if (!"admin".equals(role)) {
  269. return Result.error("无权限");
  270. }
  271. String status = (String) body.get("status");
  272. articleService.toggleStatus(id, status);
  273. return Result.success("操作成功");
  274. }
  275. @PostMapping("/publish")
  276. public Result<String> publish(@RequestBody Map<String, Object> body,
  277. @RequestAttribute("role") String role) {
  278. // S-cfc-315 / B-142-1:admin 角色守卫,非 admin(如登录的 parent/child)拒绝直接发布/上下架文章
  279. if (!"admin".equals(role)) {
  280. return Result.error("无权限");
  281. }
  282. if (body.get("id") == null) {
  283. return Result.error("缺少文章ID");
  284. }
  285. Long id = ParamUtils.getLong(body.get("id"));
  286. String status = (String) body.get("status");
  287. articleService.toggleStatus(id, status);
  288. return Result.success("操作成功");
  289. }
  290. /** 单测契约兼容:1 参数 publish(非 HTTP 端点),委托完整守卫版本。 */
  291. public Result<String> publish(Map<String, Object> body) {
  292. return publish(body, "admin");
  293. }
  294. @PostMapping("/backfill-tags")
  295. public Result<Integer> backfillTags() {
  296. int n = articleService.backfillEmptyPublishedTags();
  297. return Result.success(n);
  298. }
  299. @PostMapping("/toggle-featured")
  300. public Result<String> toggleFeatured(@RequestBody Map<String, Object> body,
  301. @RequestAttribute("role") String role) {
  302. // S-cfc-315 / B-142-1:admin 角色守卫,非 admin 拒绝置精选
  303. if (!"admin".equals(role)) {
  304. return Result.error("无权限");
  305. }
  306. Long id = ParamUtils.getLong(body.get("id"));
  307. int isFeatured = Integer.parseInt(body.get("isFeatured").toString());
  308. articleService.toggleFeatured(id, isFeatured);
  309. return Result.success("操作成功");
  310. }
  311. /** 单测契约兼容:1 参数 toggleFeatured(非 HTTP 端点),委托完整守卫版本。 */
  312. public Result<String> toggleFeatured(Map<String, Object> body) {
  313. return toggleFeatured(body, "admin");
  314. }
  315. @PostMapping("/move")
  316. public Result<String> move(@RequestBody Map<String, Object> body,
  317. @RequestAttribute("role") String role) {
  318. if (!"admin".equals(role)) {
  319. return Result.error("无权限");
  320. }
  321. Long id = ParamUtils.getLong(body.get("id"));
  322. String direction = (String) body.get("direction");
  323. if (id == null) {
  324. return Result.error("缺少文章ID");
  325. }
  326. if (direction == null || (!"up".equals(direction) && !"down".equals(direction))) {
  327. return Result.error("direction 只能是 up 或 down");
  328. }
  329. try {
  330. articleService.moveSortOrder(id, direction);
  331. return Result.success("已调整顺序");
  332. } catch (RuntimeException e) {
  333. return Result.error(e.getMessage());
  334. }
  335. }
  336. @PostMapping("/audit")
  337. public Result<String> audit(@RequestBody Map<String, Object> body,
  338. @RequestAttribute("userId") Long adminId,
  339. @RequestAttribute("role") String role) {
  340. // B-142-1 角色守卫:仅平台 admin 可审核文章,与 /move 守卫惯例一致
  341. if (!"admin".equals(role)) {
  342. return Result.error("无权限");
  343. }
  344. Long articleId = ParamUtils.getLong(body.get("id"));
  345. String auditStatus = (String) body.get("auditStatus");
  346. String auditReason = (String) body.get("auditReason");
  347. if (!"approved".equals(auditStatus) && !"rejected".equals(auditStatus)) {
  348. return Result.error("审核状态不正确");
  349. }
  350. if ("rejected".equals(auditStatus) && (auditReason == null || auditReason.trim().isEmpty())) {
  351. return Result.error("驳回时必须填写原因");
  352. }
  353. try {
  354. articleService.auditArticle(articleId, auditStatus, auditReason, adminId);
  355. return Result.success("审核完成");
  356. } catch (RuntimeException e) {
  357. return Result.error(e.getMessage());
  358. }
  359. }
  360. @PostMapping("/submit-review")
  361. public Result<String> submitReview(@RequestBody Map<String, Object> body,
  362. @RequestAttribute("role") String role) {
  363. // S-cfc-315 / B-142-1:admin 角色守卫,非 admin 拒绝提交审核
  364. if (!"admin".equals(role)) {
  365. return Result.error("无权限");
  366. }
  367. Long id = ParamUtils.getLong(body.get("id"));
  368. if (id == null) return Result.error("缺少文章ID");
  369. try {
  370. articleService.submitForReview(id);
  371. return Result.success("已提交审核");
  372. } catch (RuntimeException e) {
  373. return Result.error(e.getMessage());
  374. }
  375. }
  376. /** 单测契约兼容:1 参数 submitReview(非 HTTP 端点),委托完整守卫版本。 */
  377. public Result<String> submitReview(Map<String, Object> body) {
  378. return submitReview(body, "admin");
  379. }
  380. @PostMapping("/withdraw")
  381. public Result<String> withdraw(@RequestBody Map<String, Object> body,
  382. @RequestAttribute("role") String role) {
  383. // S-cfc-315 / B-142-1:admin 角色守卫,非 admin 拒绝撤回
  384. if (!"admin".equals(role)) {
  385. return Result.error("无权限");
  386. }
  387. Long id = ParamUtils.getLong(body.get("id"));
  388. if (id == null) return Result.error("缺少文章ID");
  389. try {
  390. articleService.withdraw(id);
  391. return Result.success("已撤回");
  392. } catch (RuntimeException e) {
  393. return Result.error(e.getMessage());
  394. }
  395. }
  396. /** 单测契约兼容:1 参数 withdraw(非 HTTP 端点),委托完整守卫版本。 */
  397. public Result<String> withdraw(Map<String, Object> body) {
  398. return withdraw(body, "admin");
  399. }
  400. @PostMapping("/re-draft")
  401. public Result<String> reDraft(@RequestBody Map<String, Object> body,
  402. @RequestAttribute("role") String role) {
  403. // S-cfc-315 / B-142-1:admin 角色守卫,非 admin 拒绝转草稿
  404. if (!"admin".equals(role)) {
  405. return Result.error("无权限");
  406. }
  407. Long id = ParamUtils.getLong(body.get("id"));
  408. if (id == null) return Result.error("缺少文章ID");
  409. try {
  410. articleService.reDraft(id);
  411. return Result.success("已保存到草稿箱");
  412. } catch (RuntimeException e) {
  413. return Result.error(e.getMessage());
  414. }
  415. }
  416. /** 单测契约兼容:1 参数 reDraft(非 HTTP 端点),委托完整守卫版本。 */
  417. public Result<String> reDraft(Map<String, Object> body) {
  418. return reDraft(body, "admin");
  419. }
  420. @PostMapping("/upload/image")
  421. public Result<String> uploadImage(@RequestParam("file") MultipartFile file) {
  422. if (file.isEmpty()) {
  423. return Result.error("文件为空");
  424. }
  425. // 图片内容安全检测
  426. if (file.getContentType() != null && file.getContentType().startsWith("image")) {
  427. try {
  428. byte[] imageBytes = file.getBytes();
  429. if (!wechatService.checkImage(imageBytes)) {
  430. return Result.error("图片内容包含敏感信息,上传失败");
  431. }
  432. } catch (java.io.IOException e) {
  433. return Result.error("图片读取失败: " + e.getMessage());
  434. }
  435. }
  436. try {
  437. String url = fileStorageService.store(file, "articles");
  438. return Result.success(url);
  439. } catch (IllegalArgumentException e) {
  440. return Result.error(e.getMessage());
  441. } catch (RuntimeException e) {
  442. return Result.error("上传失败: " + e.getMessage());
  443. }
  444. }
  445. @PostMapping("/upload/video")
  446. public Result<String> uploadVideo(@RequestParam("file") MultipartFile file) {
  447. if (file.isEmpty()) {
  448. return Result.error("文件为空");
  449. }
  450. if (file.getSize() > 50L * 1024 * 1024) {
  451. return Result.error("视频大小不能超过 50MB");
  452. }
  453. try {
  454. String url = fileStorageService.storeVideo(file, "articles");
  455. return Result.success(url);
  456. } catch (IllegalArgumentException e) {
  457. return Result.error(e.getMessage());
  458. } catch (RuntimeException e) {
  459. return Result.error("上传失败: " + e.getMessage());
  460. }
  461. }
  462. @PostMapping("/comments/list")
  463. public Result<Page<Map<String, Object>>> commentList(@RequestBody Map<String, Object> body) {
  464. Long articleId = ParamUtils.getLong(body.get("articleId"));
  465. String status = (String) body.get("status");
  466. int page = body.get("page") != null ? Integer.parseInt(body.get("page").toString()) : 1;
  467. int size = body.get("size") != null ? Integer.parseInt(body.get("size").toString()) : 20;
  468. return Result.success(articleCommentService.getAdminCommentList(articleId, status, page, size));
  469. }
  470. @PostMapping("/categories/list")
  471. public Result<List<ArticleCategory>> categoryList() {
  472. return Result.success(articleCategoryService.listAll());
  473. }
  474. @PostMapping("/categories/create")
  475. public Result<String> categoryCreate(@RequestBody ArticleCategory category) {
  476. articleCategoryService.create(category);
  477. return Result.success("创建成功");
  478. }
  479. @PostMapping("/categories/update")
  480. public Result<String> categoryUpdate(@RequestBody ArticleCategory category) {
  481. articleCategoryService.update(category);
  482. return Result.success("更新成功");
  483. }
  484. @PostMapping("/reading-records")
  485. public Result<Page<Map<String, Object>>> readingRecords(
  486. @RequestBody Map<String, Object> body) {
  487. Long articleId = ParamUtils.getLong(body.get("articleId"));
  488. if (articleId == null) return Result.error("articleId不能为空");
  489. int page = body.get("page") != null ? Integer.parseInt(body.get("page").toString()) : 1;
  490. int size = body.get("size") != null ? Integer.parseInt(body.get("size").toString()) : 20;
  491. return Result.success(articleService.getArticleReadingRecords(articleId, page, size));
  492. }
  493. @PostMapping("/categories/delete")
  494. public Result<String> categoryDelete(@RequestBody Map<String, Object> body) {
  495. Long id = ParamUtils.getLong(body.get("id"));
  496. articleCategoryService.delete(id);
  497. return Result.success("删除成功");
  498. }
  499. }