From 52536413c7232fb6b903cd2045ea5b08e9f60d8a Mon Sep 17 00:00:00 2001 From: mayiming <1627832236@qq.com> Date: Thu, 30 Oct 2025 09:57:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A0=94=E7=A9=B6=E5=AE=9E?= =?UTF-8?q?=E4=B9=A0=E9=A1=B9=E7=9B=AEapi=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/api/social_service_internship.api | 136 +++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 server/api/social_service_internship.api diff --git a/server/api/social_service_internship.api b/server/api/social_service_internship.api new file mode 100644 index 00000000..b35161f8 --- /dev/null +++ b/server/api/social_service_internship.api @@ -0,0 +1,136 @@ +// 通用基础响应结构(不含泛型,兼容Goctl) +type BaseResp { + Code int `json:"code"` // 状态码:0成功,非0失败 + Msg string `json:"message"` // 提示信息 +} + +// 社会服务实习实体结构(与表字段对应) +type SocialServiceInternship { + Id int64 `json:"id"` // 主键ID + Title string `json:"title"` // 标题 + Subtitle string `json:"subtitle,omitempty"` // 副标题 + CoverUrl string `json:"cover_url,omitempty"` // 封面图片URL + Intro string `json:"intro,omitempty"` // 简介(纯文字) + Content string `json:"content,omitempty"` // 内容(Markdown格式) + ImageEditors string `json:"image_editors,omitempty"` // 图片编辑者名单(逗号分隔) + TextEditors string `json:"text_editors,omitempty"` // 文字编辑者名单(逗号分隔) + ChiefEditor string `json:"chief_editor,omitempty"` // 总编辑 + Proofreaders string `json:"proofreaders,omitempty"` // 校对者名单(逗号分隔) + Reviewers string `json:"reviewers,omitempty"` // 审核者名单(逗号分隔) + PublishTime string `json:"publish_time"` // 发布时间(格式:yyyy-MM-dd HH:mm:ss) + UpdateTime string `json:"update_time"` // 最后更改时间(格式:yyyy-MM-dd HH:mm:ss) +} + +// 创建社会服务实习 - 请求参数 +type CreateSocialServiceInternshipReq { + Title string `json:"title" validate:"required"` // 标题(必填) + Subtitle string `json:"subtitle,omitempty"` // 副标题 + CoverUrl string `json:"cover_url,omitempty"` // 封面图片URL + Intro string `json:"intro,omitempty"` // 简介(纯文字) + Content string `json:"content,omitempty"` // 内容(Markdown格式) + ImageEditors string `json:"image_editors,omitempty"` // 图片编辑者名单(逗号分隔) + TextEditors string `json:"text_editors,omitempty"` // 文字编辑者名单(逗号分隔) + ChiefEditor string `json:"chief_editor,omitempty"` // 总编辑 + Proofreaders string `json:"proofreaders,omitempty"` // 校对者名单(逗号分隔) + Reviewers string `json:"reviewers,omitempty"` // 审核者名单(逗号分隔) +} + +// 创建社会服务实习 - 响应参数(嵌套数据,无泛型) +type CreateSocialServiceInternshipResp { + Code int `json:"code"` + Msg string `json:"message"` + Data CreateSocialServiceInternshipData `json:"data,omitempty"` +} + +type CreateSocialServiceInternshipData { + Id int64 `json:"id"` // 新增记录的ID +} + +// 获取社会服务实习列表 - 请求参数 +type ListSocialServiceInternshipReq { + Page int `json:"page" form:"page" validate:"min=1"` // 页码(默认1) + PageSize int `json:"page_size" form:"page_size" validate:"min=1,max=100"` // 每页条数(默认10,最大100) +} + +// 获取社会服务实习列表 - 响应参数(嵌套数据,无泛型) +type ListSocialServiceInternshipResp { + Code int `json:"code"` + Msg string `json:"message"` + Data ListSocialServiceInternshipData `json:"data,omitempty"` +} + +type ListSocialServiceInternshipData { + Total int64 `json:"total"` // 总条数 + List []SocialServiceInternship `json:"list"` // 列表数据 +} + +// 获取社会服务实习详情 - 请求参数(路径参数) +type GetSocialServiceInternshipReq { + Id int64 `json:"id" path:"id" validate:"min=1"` // 社会服务实习ID(必填) +} + +// 获取社会服务实习详情 - 响应参数(嵌套数据,无泛型) +type GetSocialServiceInternshipResp { + Code int `json:"code"` + Msg string `json:"message"` + Data SocialServiceInternship `json:"data,omitempty"` +} + +// 更新社会服务实习 - 请求参数 +type UpdateSocialServiceInternshipReq { + Id int64 `json:"-" path:"id" validate:"min=1"` // 社会服务实习ID(路径参数,必填) + Title string `json:"title,omitempty"` // 标题 + Subtitle string `json:"subtitle,omitempty"` // 副标题 + CoverUrl string `json:"cover_url,omitempty"` // 封面图片URL + Intro string `json:"intro,omitempty"` // 简介(纯文字) + Content string `json:"content,omitempty"` // 内容(Markdown格式) + ImageEditors string `json:"image_editors,omitempty"` // 图片编辑者名单(逗号分隔) + TextEditors string `json:"text_editors,omitempty"` // 文字编辑者名单(逗号分隔) + ChiefEditor string `json:"chief_editor,omitempty"` // 总编辑 + Proofreaders string `json:"proofreaders,omitempty"` // 校对者名单(逗号分隔) + Reviewers string `json:"reviewers,omitempty"` // 审核者名单(逗号分隔) +} + +// 更新社会服务实习 - 响应参数(基础响应,无额外数据) +type UpdateSocialServiceInternshipResp { + Code int `json:"code"` + Msg string `json:"message"` +} + +// 删除社会服务实习 - 请求参数(路径参数) +type DeleteSocialServiceInternshipReq { + Id int64 `json:"id" path:"id" validate:"min=1"` // 社会服务实习ID(必填) +} + +// 删除社会服务实习 - 响应参数(基础响应,无额外数据) +type DeleteSocialServiceInternshipResp { + Code int `json:"code"` + Msg string `json:"message"` +} + +@server ( + group: socialServiceInternship + prefix: /api/social-service/internship // 统一前缀,区分实习相关接口 +) +service social_service_internship_api { + // 创建社会服务实习 + @handler CreateSocialServiceInternshipHandler + post / (CreateSocialServiceInternshipReq) returns (CreateSocialServiceInternshipResp) + + // 获取社会服务实习列表 + @handler ListSocialServiceInternshipHandler + get /list (ListSocialServiceInternshipReq) returns (ListSocialServiceInternshipResp) + + // 获取社会服务实习详情 + @handler GetSocialServiceInternshipHandler + get /:id (GetSocialServiceInternshipReq) returns (GetSocialServiceInternshipResp) + + // 更新社会服务实习 + @handler UpdateSocialServiceInternshipHandler + put /:id (UpdateSocialServiceInternshipReq) returns (UpdateSocialServiceInternshipResp) + + // 删除社会服务实习 + @handler DeleteSocialServiceInternshipHandler + delete /:id (DeleteSocialServiceInternshipReq) returns (DeleteSocialServiceInternshipResp) +} +