Files
qitongxue-api/api/admin/v1/service.go
2026-09-30 17:01:18 +08:00

182 lines
7.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package v1
import "github.com/gogf/gf/v2/frame/g"
// ============================================================================
// 管理端软件开发服务二期契约(迭代-2026-09-30):
// 介绍页模块(blocks)/ 作品案例(works)/ 报价申请(quotes)
//
// 图片字段库内只存相对路径(/static/...),响应里 *Url 为按 site.base_url 拼接的
// 绝对地址;保存时提交上传接口返回的 path。报价处理(handle)后向用户推站内信。
// ============================================================================
// ---------- 介绍页模块 ----------
// AdminServiceBlockItem 模块项(响应 snake_case)
type AdminServiceBlockItem struct {
Id int64 `json:"id"`
Kind string `json:"kind"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
ImagePath string `json:"image_path"`
ImageUrl string `json:"image_url"`
Images []string `json:"images"` // 相对路径数组(编辑回填用)
ImageUrls []string `json:"image_urls"`
Content string `json:"content"`
Sort int `json:"sort"`
IsEnabled int `json:"is_enabled"`
UpdatedAt string `json:"updated_at"`
}
// AdminServiceBlockListReq 模块列表(含停用;管理端全部可见)
type AdminServiceBlockListReq struct {
g.Meta `path:"/admin/service/block/list" method:"get" tags:"admin" summary:"服务介绍页模块列表"`
}
type AdminServiceBlockListRes struct {
List []AdminServiceBlockItem `json:"list"`
}
// AdminServiceBlockSaveReq 新增/编辑模块(id=0 新建)。images 传相对路径数组。
type AdminServiceBlockSaveReq struct {
g.Meta `path:"/admin/service/block/save" method:"post" tags:"admin" summary:"保存服务介绍页模块"`
Id int64 `json:"id"`
Kind string `v:"required|in:hero,rich,image_text,image_list,flow,checklist,price,developer,works,goods#请选择模块类型|模块类型不合法" json:"kind"`
Title string `v:"length:0,128#标题最多 128 字" json:"title"`
Subtitle string `v:"length:0,255#副标题最多 255 字" json:"subtitle"`
ImagePath string `json:"imagePath"`
Images []string `json:"images"`
Content string `json:"content"`
Sort int `json:"sort"`
IsEnabled int `json:"isEnabled"`
}
type AdminServiceBlockSaveRes struct {
Id int64 `json:"id"`
}
// AdminServiceBlockDeleteReq 删除模块
type AdminServiceBlockDeleteReq struct {
g.Meta `path:"/admin/service/block/delete" method:"post" tags:"admin" summary:"删除服务介绍页模块"`
Id int64 `v:"required" json:"id"`
}
type AdminServiceBlockDeleteRes struct{}
// ---------- 作品案例 ----------
// AdminServiceWorkItem 作品列表项(不含 content_md)
type AdminServiceWorkItem struct {
Id int64 `json:"id"`
Category int `json:"category"`
CategoryName string `json:"category_name"`
Title string `json:"title"`
Summary string `json:"summary"`
CoverPath string `json:"cover_path"`
CoverUrl string `json:"cover_url"`
PriceCents int64 `json:"price_cents"`
PriceNote string `json:"price_note"`
Sort int `json:"sort"`
IsEnabled int `json:"is_enabled"`
CreatedAt string `json:"created_at"`
}
// AdminServiceWorkListReq 作品列表
type AdminServiceWorkListReq struct {
g.Meta `path:"/admin/service/work/list" method:"get" tags:"admin" summary:"软件开发作品列表"`
Keyword string `json:"keyword"`
Category int `json:"category"`
IsEnabled *int `json:"isEnabled"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
type AdminServiceWorkListRes struct {
List []AdminServiceWorkItem `json:"list"`
Total int `json:"total"`
}
// AdminServiceWorkDetailReq 作品详情(编辑回填)
type AdminServiceWorkDetailReq struct {
g.Meta `path:"/admin/service/work/detail" method:"get" tags:"admin" summary:"软件开发作品详情"`
Id int64 `v:"required" json:"id"`
}
type AdminServiceWorkDetailRes struct {
Id int64 `json:"id"`
Category int `json:"category"`
Title string `json:"title"`
Summary string `json:"summary"`
ContentMd string `json:"content_md"`
CoverPath string `json:"cover_path"`
CoverUrl string `json:"cover_url"`
Images []string `json:"images"`
PriceCents int64 `json:"price_cents"`
PriceNote string `json:"price_note"`
Sort int `json:"sort"`
IsEnabled int `json:"is_enabled"`
}
// AdminServiceWorkSaveReq 新增/编辑作品
type AdminServiceWorkSaveReq struct {
g.Meta `path:"/admin/service/work/save" method:"post" tags:"admin" summary:"保存软件开发作品"`
Id int64 `json:"id"`
Category int `v:"required|in:1,2,3,4#请选择分类|分类不合法" json:"category"`
Title string `v:"required#请填写作品名称" json:"title"`
Summary string `v:"length:0,500#简介最多 500 字" json:"summary"`
ContentMd string `json:"contentMd"`
CoverPath string `json:"coverPath"`
Images []string `json:"images"`
PriceCents int64 `v:"min:0#价格不能为负" json:"priceCents"`
PriceNote string `v:"length:0,64#价格备注最多 64 字" json:"priceNote"`
Sort int `json:"sort"`
IsEnabled int `json:"isEnabled"`
}
type AdminServiceWorkSaveRes struct {
Id int64 `json:"id"`
}
// AdminServiceWorkDeleteReq 删除作品(软删除)
type AdminServiceWorkDeleteReq struct {
g.Meta `path:"/admin/service/work/delete" method:"post" tags:"admin" summary:"删除软件开发作品"`
Id int64 `v:"required" json:"id"`
}
type AdminServiceWorkDeleteRes struct{}
// ---------- 报价申请 ----------
// AdminServiceQuoteItem 报价申请列表项
type AdminServiceQuoteItem struct {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
UserNickname string `json:"user_nickname"`
WorkId int64 `json:"work_id"`
WorkTitle string `json:"work_title"`
Contact string `json:"contact"`
Requirement string `json:"requirement"`
Budget string `json:"budget"`
Status int `json:"status"`
StatusText string `json:"status_text"`
QuoteCents int64 `json:"quote_cents"`
QuoteNote string `json:"quote_note"`
HandledAt string `json:"handled_at"`
CreatedAt string `json:"created_at"`
}
// AdminServiceQuoteListReq 报价申请列表
type AdminServiceQuoteListReq struct {
g.Meta `path:"/admin/service/quote/list" method:"get" tags:"admin" summary:"报价申请列表"`
Status *int `json:"status"` // nil=全部
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
type AdminServiceQuoteListRes struct {
List []AdminServiceQuoteItem `json:"list"`
Total int `json:"total"`
}
// AdminServiceQuoteHandleReq 处理报价申请(填报价 + 状态),用户端推站内信
type AdminServiceQuoteHandleReq struct {
g.Meta `path:"/admin/service/quote/handle" method:"post" tags:"admin" summary:"处理报价申请"`
Id int64 `v:"required" json:"id"`
Status int `v:"in:0,1,2,3#状态不合法" json:"status"`
QuoteCents int64 `v:"min:0#报价不能为负" json:"quoteCents"`
QuoteNote string `v:"length:0,500#报价说明最多 500 字" json:"quoteNote"`
}
type AdminServiceQuoteHandleRes struct{}