diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..ce729694 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,111 @@ +# Copilot Instructions for This Repository + +## Project context + +This repository contains a multi-module mall system with admin-oriented database SQL organized by execution stage and business domain. +For any task related to database changes, RPC, RLS, or admin data access, treat `docs/sql/README_EXECUTION_ORDER.md` as the authoritative execution and validation reference. + +## Core database rules + +1. Follow the required execution order for database changes: + - Schema / Migration first + - RLS second + - RPC last + +2. Never change the order to RPC -> RLS -> Schema. + RPC and RLS may depend on fields, indexes, or policies created in Schema. + +3. Soft delete is the default deletion standard. + Do not implement physical deletes unless the task explicitly requires it and the user confirms. + Prefer updating soft-delete fields such as: + - `deleted_at` + - `deleted_by` + - `restored_at` + - `restored_by` + +4. For delete-related RPC or SQL: + - do not use physical `DELETE` by default + - write `deleted_at` and `deleted_by` + - preserve auditability + - apply cascade soft delete when the existing design requires it + +5. For RLS-related work: + - assume soft-deleted rows should be filtered by default + - when appropriate, ensure policies include logic equivalent to `deleted_at IS NULL` + - do not weaken existing RLS rules without clearly explaining why + +6. For existing RPC/functions: + - prefer `CREATE OR REPLACE FUNCTION` + - avoid creating duplicate function variants unless versioning is explicitly required + +## Required working method + +1. Analyze first, edit second. + Before making changes, first inspect the relevant files and summarize: + - affected files + - dependencies + - execution order + - risks + +2. Limit the scope of changes. + Only modify the business domain and files directly related to the task. + Do not refactor unrelated modules. + +3. Do not invent schema details. + Before generating SQL or admin code, inspect the actual table definitions, RPC files, and RLS files already present in the repository. + +4. Preserve current naming and directory conventions. + Keep the existing staged SQL structure such as: + - `10_schema/**` + - `20_rls/**` + - `30_rpc/**` + +5. Keep admin-facing behavior consistent with current project conventions. + Do not silently break existing frontend call paths, parameter names, return structures, or pagination contracts. + +## Output requirements for Copilot responses + +For any non-trivial task, respond with: + +1. A short impact summary +2. The list of files to change +3. The implementation plan in the correct order +4. The actual code/SQL changes +5. A validation checklist +6. Any risks, assumptions, or rollback notes + +## Validation requirements + +When a task changes database behavior, include verification steps for: + +- field existence +- soft-delete index existence +- RLS effectiveness +- RPC behavior +- whether deletion remains soft delete instead of physical delete +- whether `deleted_at` / `deleted_by` are written correctly +- whether required cascade soft delete behavior still works + +## SQL and Supabase safety rules + +1. Do not assume a SQL file has already been executed just because it exists in the repository. +2. Do not assume a table is in `public` unless verified. +3. If a task involves Supabase-exposed data access, consider RLS impact explicitly. +4. If adding a new table or new admin data access path, mention whether RLS and policies also need to be added or updated. + +## Preferred behavior for complex tasks + +For large tasks, break the work into phases: + +1. inspect +2. plan +3. implement +4. validate + +Do not jump straight into large-scale edits without first identifying dependencies. + +## Reference + +Primary reference for database execution order and validation: + +- `docs/sql/README_EXECUTION_ORDER.md` diff --git a/layouts/admin/router/adminRoutes.uts b/layouts/admin/router/adminRoutes.uts index 429115cd..e87b05c6 100644 --- a/layouts/admin/router/adminRoutes.uts +++ b/layouts/admin/router/adminRoutes.uts @@ -246,7 +246,7 @@ export const routes: RouteRecord[] = [ // ========== 店铺模块 ========== { id: 'shop_manage', - title: '店铺管理', + title: '我的店铺', path: '/pages/mall/admin/shop/manage', componentKey: 'ShopManage', parentId: 'shop', diff --git a/pages/mall/admin/product/reviews/index.uvue b/pages/mall/admin/product/reviews/index.uvue index 0eb8920e..b2748517 100644 --- a/pages/mall/admin/product/reviews/index.uvue +++ b/pages/mall/admin/product/reviews/index.uvue @@ -5,30 +5,33 @@ 评价时间: - - 📅 - 开始日期 - 结束日期 + + + ~ + - - 评价状态: - 请选择 - 审核状态: - 请选择 + + + {{ statusLabels[statusPickerIndex] }} + + + 商品信息: - + 用户名称: - + - + + @@ -40,53 +43,75 @@ + + + {{ fetchError }} + + + + + 加载中... + + 评论ID 商品信息 - 规格 用户名称 评分 评价内容 回复内容 - 审核状态 + 状态 评价时间 操作 - + + + 暂无评价数据 + + + - {{ item.id }} - - - {{ item.productName }} + + {{ item.id.substring(0, 8) }}... + + + + + {{ item.product_name !== '' ? item.product_name : '—' }} + + + {{ item.username != null && item.username !== '' ? item.username : '匿名用户' }} + + {{ item.rating }}星 + + {{ item.content != null && item.content !== '' ? item.content : '—' }} + + + {{ item.merchant_reply != null && item.merchant_reply !== '' ? item.merchant_reply : '无' }} - {{ item.spec }} - {{ item.username }} - {{ item.score }} - {{ item.content }} - {{ item.reply || '无' }} - - {{ item.status === 1 ? '通过' : '待审核' }} + + {{ getStatusText(item.status) }} - {{ item.time }} + {{ formatTime(item.created_at) }} - 通过 - 驳回 - 回复 - 删除 + 通过 + 驳回 + 回复 + 删除 + + + + + + 回复评价 + + + +