tourism-system/AGENTS.md

112 lines
4.3 KiB
Markdown

# AGENTS.md — Tourism Promotion Management System
> 旅游宣传管理系统 — 毕业设计项目. Full-stack tourism platform with admin dashboard and user-facing web app.
## Project Structure
Three independent subsystems in one repo (not a monorepo with shared packages):
| Directory | Stack | Dev Port | UI Framework |
|-----------|-------|----------|--------------|
| `tourism-server/` | SpringBoot 4.0.6 + JDK 21 | 8080 | — |
| `tourism-admin/` | Vue 3.5 + Vite 6 + TS 5.7 | 3000 | **Ant Design Vue 4** |
| `tourism-web/` | Vue 3.5 + Vite 6 + TS 5.7 | 3001 | **Element Plus 2.9** |
**Critical**: `tourism-admin` and `tourism-web` use **different UI frameworks**. Do not swap components between them.
## Development Commands
### Backend (`tourism-server/`)
```bash
mvn install -DskipTests
mvn spring-boot:run
```
- Main class: `com.tourism.TourismApplication`
- Application config: `application.yml` + `application-dev.yml`
- Active profile: `dev`
- Maven uses Aliyun + HuaweiCloud + Spring Milestones/Snapshots repositories
### Admin Frontend (`tourism-admin/`)
```bash
pnpm install # packageManager is pnpm@10.23.0
pnpm dev # port 3000
```
- Uses **pnpm** (not npm/yarn). `packageManager` field enforces this.
- Build: `pnpm build` (runs `vue-tsc -b && vite build`)
- Lint: `pnpm lint` (eslint with .vue,.ts extensions)
### Web Frontend (`tourism-web/`)
```bash
pnpm install
pnpm dev # port 3001
```
- Build: `pnpm build` (runs `vue-tsc -b && vite build`)
- No lint script configured
## API & Auth
- Both frontends proxy `/api` to `http://localhost:8080`
- Auth: **Sa-Token** (v1.45.0). Token sent in `token` header (not `Authorization`)
- Admin login mock: username `admin` / password `123456`
- Backend response format: `{ code: 200, msg: "...", data: ... }`
- 401 unauthenticated → redirect to login page
## Backend Architecture
- Package root: `com.tourism`
- Modules by domain: `user/`, `attraction/`, `product/`, `order/`, `travel/`, `admin/`, `payment/`, `file/`, `common/`
- Each module: `entity/`, `mapper/`, `service/`, `service/impl/`, `controller/`, `dto/`
- ORM: MyBatis-Plus 3.5.15 with logical delete (`isDeleted` field, 0=not deleted, 1=deleted)
- DB: MySQL 8.0 (`tourism_platform`), init script: `tourism_platform.sql` at repo root
- Passwords encrypted with `spring-security-crypto` (BCrypt)
- File storage: RustFS (configured in `application.yml`)
- Payment: Alipay sandbox SDK
- JSON: Fastjson2
- DTO mapping: MapStruct 1.6.3 + Lombok (both require annotation processor in Maven)
- API docs: Knife4j (Swagger UI alternative), available when server runs
## Database Setup
```bash
mysql -u root -p < tourism_platform.sql
```
Default credentials (override in `application-dev.yml`):
- URL: `jdbc:mysql://localhost:3306/tourism_platform`
- Username: `root`
- Password: `root` (in base config), `123456` (in dev profile)
## Frontend Architecture
### tourism-admin
- Entry: `src/main.ts`
- Router: `src/router/index.ts` (all routes in one file)
- State: Pinia (`stores/user.ts`, `stores/app.ts`)
- Icons: `@ant-design/icons-vue` (all registered globally)
- Charts: ECharts + vue-echarts
- **MockJS**: `src/mock/index.ts` provides mock data for all admin APIs. Imported in `main.ts`.
- Styles: SCSS (`src/assets/styles/index.scss`)
### tourism-web
- Entry: `src/main.ts`
- Router: `src/router/index.ts`
- State: Pinia (`stores/user.ts`, `stores/cart.ts`)
- Icons: `@element-plus/icons-vue`
- Styles: SCSS (`src/assets/styles/index.scss`)
## Design Systems
Design specs are in `design-system/` directory:
- `design-system/tourism-admin/MASTER.md` — Purple theme (#7C3AED), Fira Code/Sans, data-dense dashboard style
- `design-system/tourism-web/MASTER.md` — Sky blue theme (#0EA5E9), Noto Sans Thai, motion-driven storytelling style
## Important Notes
- **No tests exist** in any subsystem. Add tests if required.
- **No CI/CD** configured.
- Both frontends use `noUnusedLocals: false` and `noUnusedParameters: false` in tsconfig.
- Admin uses `unplugin-auto-import` and `unplugin-vue-components` (auto-import Vue APIs and components).
- All `@/` aliases resolve to `src/`.
- `tourism_platform.sql` at repo root is the single source of truth for database schema.
- This is a graduation project (毕业设计). Code may be simplified; prioritize clarity and functionality over enterprise patterns.