Files
rxthinkcmf-wiki/RXThinkCMF_ThinkPhp6_EleVue/.vitepress/dist/assets/zh_standards_code-review.md.DjZ5o7Ff.lean.js
T
2026-10-25 18:52:36 +08:00

2 lines
5.0 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{_ as l,o as i,c as a,a2 as o}from"./chunks/framework.B-QBKwc1.js";const m=JSON.parse('{"title":"代码审查清单","description":"代码审查(Code Review)是保证代码质量的重要环节。","frontmatter":{},"headers":[],"relativePath":"zh/standards/code-review.md","filePath":"zh/standards/code-review.md"}'),d={name:"zh/standards/code-review.md"};function c(t,e,r,s,n,h){return i(),a("div",null,[...e[0]||(e[0]=[o('<h1 id="_12-5-代码审查清单" tabindex="-1">12.5 代码审查清单 <a class="header-anchor" href="#_12-5-代码审查清单" aria-label="Permalink to &quot;12.5 代码审查清单&quot;">​</a></h1><div class="tip custom-block"><p class="custom-block-title">概述</p><p>代码审查(Code Review)是保证代码质量的重要环节。以下清单涵盖后端和前端的审查要点。</p></div><h2 id="后端审查清单" tabindex="-1">后端审查清单 <a class="header-anchor" href="#后端审查清单" aria-label="Permalink to &quot;后端审查清单&quot;">​</a></h2><h3 id="Model-层" tabindex="-1">Model 层 <a class="header-anchor" href="#Model-层" aria-label="Permalink to &quot;Model 层&quot;">​</a></h3><ul><li>[ ] 继承 <code>BaseModel</code></li><li>[ ] 表名 <code>$name</code> 配置正确</li><li>[ ] 关联关系定义正确(如有)</li><li>[ ] 无硬编码的数据库前缀</li></ul><h3 id="Logic-层" tabindex="-1">Logic 层 <a class="header-anchor" href="#Logic-层" aria-label="Permalink to &quot;Logic 层&quot;">​</a></h3><ul><li>[ ] 继承正确的基类(<code>BaseLogic</code> 或 <code>BaseTenantLogic</code>)</li><li>[ ] <code>$modelClass</code> 配置正确</li><li>[ ] 查询条件配置合理(<code>pageLikeFields</code> / <code>pageEqFields</code>)</li><li>[ ] 排序配置合理(<code>pageOrderBy</code>)</li><li>[ ] 唯一性校验配置(<code>uniqueFields</code>)</li><li>[ ] 枚举映射配置(<code>serializeMaps</code>)</li><li>[ ] 文件字段配置(<code>fileFields</code> / <code>fileSaveDir</code>)</li><li>[ ] 钩子方法中无 SQL 注入风险</li><li>[ ] 事务使用正确(<code>startTrans</code> / <code>commit</code> / <code>rollback</code>)</li></ul><h3 id="Controller-层" tabindex="-1">Controller 层 <a class="header-anchor" href="#Controller-层" aria-label="Permalink to &quot;Controller 层&quot;">​</a></h3><ul><li>[ ] 继承 <code>BaseController</code></li><li>[ ] <code>initialize()</code> 中实例化 Logic</li><li>[ ] 所有接口标注 <code>#[Permission]</code> 注解</li><li>[ ] 所有写操作标注 <code>#[Log]</code> 注解</li><li>[ ] 权限码格式正确(<code>sys:模块名:操作</code>)</li><li>[ ] 异常处理完善(try-catch)</li><li>[ ] 参数校验充分</li></ul><h3 id="安全" tabindex="-1">安全 <a class="header-anchor" href="#安全" aria-label="Permalink to &quot;安全&quot;">​</a></h3><ul><li>[ ] 无 SQL 注入风险(使用 ORM 参数绑定)</li><li>[ ] 无 XSS 风险(输出转义)</li><li>[ ] 敏感数据不暴露(password、salt)</li><li>[ ] 文件上传有类型和大小限制</li><li>[ ] 权限校验覆盖所有接口</li></ul><h2 id="前端审查清单" tabindex="-1">前端审查清单 <a class="header-anchor" href="#前端审查清单" aria-label="Permalink to &quot;前端审查清单&quot;">​</a></h2><h3 id="API-模块" tabindex="-1">API 模块 <a class="header-anchor" href="#API-模块" aria-label="Permalink to &quot;API 模块&quot;">​</a></h3><ul><li>[ ] 函数命名规范(<code>getXxxPage</code> / <code>xxxAdd</code> / <code>xxxUpdate</code> / <code>xxxDelete</code>)</li><li>[ ] HTTP 方法正确(GET/POST/PUT/DELETE)</li><li>[ ] 参数传递方式正确(params / data)</li><li>[ ] 错误处理完善</li></ul><h3 id="页面组件" tabindex="-1">页面组件 <a class="header-anchor" href="#页面组件" aria-label="Permalink to &quot;页面组件&quot;">​</a></h3><ul><li>[ ] 使用 <code>&lt;script setup lang=&quot;ts&quot;&gt;</code> 语法</li><li>[ ] Props 有类型定义</li><li>[ ] 表单有验证规则</li><li>[ ] 删除操作有确认弹窗</li><li>[ ] 加载状态处理(loading)</li><li>[ ] 空数据处理</li></ul><h3 id="权限" tabindex="-1">权限 <a class="header-anchor" href="#权限" aria-label="Permalink to &quot;权限&quot;">​</a></h3><ul><li>[ ] 按钮级权限使用 <code>v-perm</code> 指令</li><li>[ ] 权限码与后端一致</li></ul><h3 id="性能" tabindex="-1">性能 <a class="header-anchor" href="#性能" aria-label="Permalink to &quot;性能&quot;">​</a></h3><ul><li>[ ] 列表数据分页加载</li><li>[ ] 图片懒加载</li><li>[ ] 组件按需引入</li></ul><h2 id="Git-提交审查" tabindex="-1">Git 提交审查 <a class="header-anchor" href="#Git-提交审查" aria-label="Permalink to &quot;Git 提交审查&quot;">​</a></h2><ul><li>[ ] commit message 格式正确</li><li>[ ] 一个 commit 只做一件事</li><li>[ ] 无调试代码残留(console.log、dump)</li><li>[ ] 无敏感信息泄露(密码、密钥)</li></ul>',22)])])}const p=l(d,[["render",c]]);export{m as __pageData,p as default};