From 7414b3e9bf3a0c2ec91fb19f3228c4dcd024f068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E6=B1=89?= <5725748+qin_and_han_dynasties@user.noreply.gitee.com> Date: Sun, 22 Mar 2026 21:52:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 178 +++++++++--- .../Frontend/.env.development | 2 +- Build_God_Api/Build_God_Api/DB/Character.cs | 12 +- .../Build_God_Api/Dto/CharacterDto.cs | 3 + .../Services/CharacterService.cs | 15 +- .../CharacterAttributeCalculateService.cs | 55 +++- .../Services/Game/TrainingService.cs | 2 +- .../Build_God_Api/Services/ScrapService.cs | 4 - Build_God_Game/.env.development | 2 + Build_God_Game/.env.production | 2 + Build_God_Game/src/api/auth.ts | 41 +-- Build_God_Game/src/api/character.ts | 70 +---- Build_God_Game/src/api/dailyMission.ts | 54 +--- Build_God_Game/src/api/index.ts | 34 +++ Build_God_Game/src/api/scrap.ts | 41 +-- Build_God_Game/src/views/CharacterView.vue | 80 +++++- Build_God_Game/src/views/DailyMissionView.vue | 268 +++++++++--------- Build_God_Game/src/views/GameView.vue | 99 ++----- Build_God_Game/src/views/TrainingView.vue | 100 ++++--- Build_God_Game/vite.config.ts | 14 - 20 files changed, 549 insertions(+), 527 deletions(-) create mode 100644 Build_God_Game/.env.development create mode 100644 Build_God_Game/.env.production create mode 100644 Build_God_Game/src/api/index.ts diff --git a/AGENTS.md b/AGENTS.md index a00c9f6..1a1b774 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,8 +4,9 @@ Guidelines for agentic coding agents working on this repository. ## Project Overview -- **Backend**: ASP.NET Core 8.0 Web API (C#) -- **Frontend**: Vue 3 + TypeScript + Vite + Element Plus +- **Backend**: ASP.NET Core 8.0 Web API (C#) with PostgreSQL and SqlSugar ORM +- **Admin Frontend**: Vue 3 + TypeScript + Vite + Element Plus (port 5173) +- **Game Frontend**: Vue 3 + TypeScript + Vite + Element Plus + TailwindCSS + Three.js (port 5174) --- @@ -14,16 +15,19 @@ Guidelines for agentic coding agents working on this repository. ### Backend (.NET API) ```bash -# Build the solution (from Build_God_Api directory) -dotnet build Build_God_Api/Build_God_Api.csproj +# Build the solution +dotnet build Build_God_Api/Build_God_Api/Build_God_Api.csproj -# Run the API -dotnet run --project Build_God_Api/Build_God_Api.csproj +# Run the API (launches on https://localhost:59447, http://localhost:59448) +dotnet run --project Build_God_Api/Build_God_Api/Build_God_Api.csproj + +# Run with specific URL +dotnet run --urls "http://localhost:5091" ``` **Note**: No test framework or linting is currently configured for the backend. -### Frontend (Vue 3) +### Admin Frontend (Build_God_Admin_Frontend/Frontend) ```bash # Install dependencies @@ -42,7 +46,23 @@ npm run type-check npm run preview ``` -**Note**: No test framework or ESLint is currently configured for the frontend. +### Game Frontend (Build_God_Game) + +```bash +# Install dependencies +npm install + +# Start development server (http://localhost:5174) +npm run dev + +# Build for production +npm run build + +# Type-check only +vue-tsc --build +``` + +**Note**: No test framework or ESLint is configured for either frontend. --- @@ -52,36 +72,43 @@ npm run preview #### Conventions - Use **file-scoped namespaces** (`namespace Build_God_Api.Controllers;`) -- Enable **nullable reference types** +- Enable **nullable reference types** (`enable`) - Use **primary constructors** for dependency injection - Use **async/await** for all I/O operations +- Use **region** sparingly - prefer natural code organization #### Naming - **Classes/Types**: PascalCase (`AccountController`, `AccountService`) - **Methods/Properties**: PascalCase (`GetAccount`, `UserName`) - **Local variables/Parameters**: camelCase (`accountId`, `emailAddress`) - **Interfaces**: Prefix with `I` (`IAccountService`) +- **DTOs**: Postfix with `Cmd` for commands, `Dto` for responses #### Project Structure ``` -Build_God_Api/ - Controllers/ # API endpoints - Services/ # Business logic (interface + implementation) - Services/Game/ # Game-specific services - DB/ # Database entities (extend BaseEntity) - Dto/ # Data transfer objects - Common/ # Utilities - Hubs/ # SignalR hubs +Build_God_Api/Build_God_Api/ + Controllers/ # API endpoints + Services/ # Business logic interfaces + Services/Game/ # Game-specific services + DB/ # Database entities (extend BaseEntity) + Dto/ # Data transfer objects + Common/ # Utilities and helpers + Hubs/ # SignalR hubs ``` #### Error Handling - Return `BadRequest("error message")` for validation errors - Return `Ok(result)` for successful operations -- Use try-catch with `ILogger` for error logging +- Use try-catch with `Console.WriteLine` for error logging +- Validate inputs at controller level using DataAnnotations #### Route Conventions - Use `[Route("api/god/[controller]")]` -- Use `[ApiController]` and HTTP method attributes +- Use `[ApiController]` and HTTP method attributes (`[HttpGet]`, `[HttpPost]`) + +#### Database Entities (SqlSugar) +- All entities extend `BaseEntity` which provides `Id`, `CreatedOn`, `UpdatedOn`, `CreatedBy`, `UpdatedBy` +- Use `[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]` for auto-increment primary keys --- @@ -90,35 +117,57 @@ Build_God_Api/ #### Conventions - Use **Composition API** with `