service.xpcool.com/PROJECT_STRUCTURE.md
夏犀麟 1486bb903f feat(api): 新增公共接口 api/common/v1(tools 工具端点)并修复 gtime 格式化
- api/common/v1/tools.go 契约 + internal/controller/common 实现:uuid/md5/random/time/ip
- cmd.go 注册 /api/common/v1 公开分组(无鉴权),复用 common/tools Go 包
- 修复 gtime v2.10.2 坑:Format 为 PHP 风格,Go layout 须用 Layout(),timex 封装为 Layout 语义
- 冒烟测试 5 端点全部通过;AGENTS.md / PROJECT_STRUCTURE.md / change-log 同步更新
2026-08-24 17:29:30 +08:00

2.0 KiB

Production layout

service.xpcool.com/
├── api/                         # HTTP contracts and Swagger metadata
│   ├── user/v1/                 # /api/v1 - client-facing API
│   ├── admin/v1/                # /admin/v1 - administration API
│   └── common/v1/               # /api/common/v1 - public API for frontends (no auth)
├── common/                      # public reusable module (no internal/ deps)
│   └── tools/                   # utility toolbox: md5, cryptox, uuid, random,
│                                #   timex, convertx, strx, slicex, ip, filex
├── internal/
│   ├── cmd/                     # application bootstrap and route isolation
│   ├── consts/                  # application error codes and constants
│   ├── controller/              # API-to-service adapters only (incl. common/ public API)
│   ├── service/                 # domain use cases and provider interfaces
│   ├── dao/                     # generated by gf gen dao; never hand edited
│   ├── model/
│   │   ├── entity/              # generated database entities
│   │   ├── do/                  # generated Data Objects
│   │   ├── dto/                 # service boundary input/output
│   │   └── vo/                  # API view models
│   ├── middleware/              # configurable route-group middleware
│   └── library/                 # JWT, response, pagination primitives
├── docs/change-log/             # per-request change records (agent context)
├── manifest/
│   ├── config/                  # config.dev/test/prod.yaml
│   └── sql/                     # ordered MySQL migrations
└── utility/                     # optional cross-cutting helpers

dao, model/do and model/entity are generated after migration, so their schema never drifts from MySQL. Controllers do not access DAO; only services do.

See AGENTS.md for the agent-facing conventions and the context-memory system.