refactor(api): 去除 api 层 /v1 目录,统一为 api/<模块>/<子模块> 层级规则(包名=路径段下划线连接)

This commit is contained in:
夏犀麟 2026-08-27 23:20:32 +08:00
parent 3d24dbd8cb
commit abd81486ad
13 changed files with 33 additions and 27 deletions

View File

@ -5,13 +5,15 @@ import "github.com/gogf/gf/v2/frame/g"
// AdminItem 管理员列表中的一行。
type AdminItem struct {
Id uint64 `json:"id"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Status int `json:"status"`
RoleIds []uint64 `json:"roleIds"`
RoleNames []string `json:"roleNames"`
CreatedAt string `json:"createdAt"`
Id uint64 `json:"id"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Status int `json:"status"`
BarkDeviceId string `json:"barkDeviceId"`
PushplusToken string `json:"pushplusToken"`
RoleIds []uint64 `json:"roleIds"`
RoleNames []string `json:"roleNames"`
CreatedAt string `json:"createdAt"`
}
// AdminListReq 分页查询管理员。
@ -30,11 +32,13 @@ type AdminListRes struct {
// AdminCreateReq 创建管理员。
type AdminCreateReq struct {
g.Meta `path:"/admin/create" method:"post" tags:"Admin/Admin" summary:"创建管理员"`
Username string `json:"username" v:"required"`
Password string `json:"password" v:"required|min-length:6#password required|password too short"`
Nickname string `json:"nickname"`
RoleIds []uint64 `json:"roleIds"`
g.Meta `path:"/admin/create" method:"post" tags:"Admin/Admin" summary:"创建管理员"`
Username string `json:"username" v:"required"`
Password string `json:"password" v:"required|min-length:6#password required|password too short"`
Nickname string `json:"nickname"`
BarkDeviceId string `json:"barkDeviceId"`
PushplusToken string `json:"pushplusToken"`
RoleIds []uint64 `json:"roleIds"`
}
// AdminCreateRes 是 AdminCreateReq 的响应。
@ -44,11 +48,13 @@ type AdminCreateRes struct {
// AdminUpdateReq 更新管理员的资料、状态与角色。
type AdminUpdateReq struct {
g.Meta `path:"/admin/update/{id}" method:"post" tags:"Admin/Admin" summary:"更新管理员"`
Id uint64 `json:"id" in:"path" v:"required"`
Nickname string `json:"nickname"`
Status int `json:"status"`
RoleIds []uint64 `json:"roleIds"`
g.Meta `path:"/admin/update/{id}" method:"post" tags:"Admin/Admin" summary:"更新管理员"`
Id uint64 `json:"id" in:"path" v:"required"`
Nickname string `json:"nickname"`
Status int `json:"status"`
BarkDeviceId string `json:"barkDeviceId"`
PushplusToken string `json:"pushplusToken"`
RoleIds []uint64 `json:"roleIds"`
}
// AdminUpdateRes 是 AdminUpdateReq 的响应。

View File

@ -1,6 +1,6 @@
// Package job_v1 自动任务管理模块接口契约DB 驱动的 gcron 调度 + 运行记录)。
// 规范2026-08-27全部 POSTURL 不含参数;入参一律 body。
package job_v1
package job
import "github.com/gogf/gf/v2/frame/g"

View File

@ -1,6 +1,6 @@
// Package notice_v1 通知模块接口契约(统一推送管理:渠道/规则/日志/测试)。
// 规范2026-08-27全部 POSTURL 不含参数;入参一律 body。
package notice_v1
package notice
import "github.com/gogf/gf/v2/frame/g"

View File

@ -1,6 +1,6 @@
// Package recruitment_v1 招聘考试聚合模块接口契约。
// 规范2026-08-27全部 POSTURL 不含任何参数(查询/路径参数均禁止);入参一律走 body。
package recruitment_v1
package recruitment
import "github.com/gogf/gf/v2/frame/g"

View File

@ -1,6 +1,6 @@
// Package serversecurity_v1 服务器安全监控日志模块接口契约。
// 规范2026-08-27全部 POSTURL 不含任何参数(查询/路径参数均禁止);入参一律走 body。
package serversecurity_v1
package serversecurity
import "github.com/gogf/gf/v2/frame/g"

View File

@ -4,7 +4,7 @@ package job
import (
"context"
jobv1 "service.xpcool.com/api/job/v1"
jobv1 "service.xpcool.com/api/job"
"service.xpcool.com/internal/model/dto"
"service.xpcool.com/internal/service/job"
)

View File

@ -4,7 +4,7 @@ package notice
import (
"context"
noticev1 "service.xpcool.com/api/notice/v1"
noticev1 "service.xpcool.com/api/notice"
"service.xpcool.com/internal/model/dto"
"service.xpcool.com/internal/service/notice"
)

View File

@ -3,7 +3,7 @@ package recruitment
import (
"context"
recruitmentv1 "service.xpcool.com/api/recruitment/v1"
recruitmentv1 "service.xpcool.com/api/recruitment"
"service.xpcool.com/internal/model/dto"
"service.xpcool.com/internal/service/recruitment"
)

View File

@ -4,7 +4,7 @@
package serversecurity
import (
serversecurityv1 "service.xpcool.com/api/serversecurity/v1"
serversecurityv1 "service.xpcool.com/api/serversecurity"
"service.xpcool.com/internal/model/dto"
)

View File

@ -4,7 +4,7 @@ package serversecurity
import (
"context"
serversecurityv1 "service.xpcool.com/api/serversecurity/v1"
serversecurityv1 "service.xpcool.com/api/serversecurity"
"service.xpcool.com/internal/model/dto"
"service.xpcool.com/internal/service/serversecurity"
)

View File

@ -4,7 +4,7 @@ package serversecurity
import (
"context"
serversecurityv1 "service.xpcool.com/api/serversecurity/v1"
serversecurityv1 "service.xpcool.com/api/serversecurity"
"service.xpcool.com/internal/service/serversecurity"
)

BIN
service_test2.exe Normal file

Binary file not shown.

BIN
service_test2.exe~ Normal file

Binary file not shown.