小程序一些功能更新
This commit is contained in:
64
api/admin/v1/attachment.go
Normal file
64
api/admin/v1/attachment.go
Normal file
@@ -0,0 +1,64 @@
|
||||
package v1
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
// ============================================================================
|
||||
// 管理端附件管理契约(迭代-2026-09-29):upload / list / delete
|
||||
//
|
||||
// 所有上传(含用户端头像)都会登记到 attachments 表;本模块提供后台统一查看、
|
||||
// 上传日期、删除。删除为「记录软删 + 文件本体按引用检查」:仍被头像/封面等引用
|
||||
// 的文件只移除记录不删文件,返回 removed_file=false 说明这一点。
|
||||
// ============================================================================
|
||||
|
||||
// AdminUploadReq 管理端上传(multipart/form-data,文件字段名 file,表单字段 scene=cover|attachment)
|
||||
type AdminUploadReq struct {
|
||||
g.Meta `path:"/admin/upload" method:"post" mime:"multipart/form-data" tags:"admin" summary:"管理端上传文件"`
|
||||
Scene string `v:"required|in:cover,attachment#请指定上传场景|不支持的上传场景" json:"scene"`
|
||||
}
|
||||
type AdminUploadRes struct {
|
||||
Id int64 `json:"id"` // 附件登记 id(0 = 登记跳过/失败,不影响文件可用)
|
||||
Url string `json:"url"` // 绝对 URL(按 site.base_url 现拼,直接展示用)
|
||||
Path string `json:"path"` // 相对路径(/static/...)—— 商品封面等库内只存这个
|
||||
FileName string `json:"file_name"` // 原始文件名
|
||||
Ext string `json:"ext"` // 扩展名(小写含点)
|
||||
SizeBytes int64 `json:"size_bytes"` // 字节
|
||||
}
|
||||
|
||||
// AdminAttachmentItem 附件列表项(响应 snake_case)
|
||||
type AdminAttachmentItem struct {
|
||||
Id int64 `json:"id"`
|
||||
Scene string `json:"scene"` // avatar / cover / attachment
|
||||
FileName string `json:"file_name"`
|
||||
FilePath string `json:"file_path"`
|
||||
Url string `json:"url"` // 绝对 URL(现拼)
|
||||
Ext string `json:"ext"`
|
||||
SizeBytes int64 `json:"size_bytes"`
|
||||
Md5 string `json:"md5"`
|
||||
UploaderId int64 `json:"uploader_id"`
|
||||
UploaderType string `json:"uploader_type"` // admin / user
|
||||
IsReferenced bool `json:"is_referenced"` // 是否仍被头像/封面/其他记录引用
|
||||
IsImage bool `json:"is_image"` // 是否图片(可缩略预览)
|
||||
CreatedAt string `json:"created_at"` // 上传日期
|
||||
}
|
||||
|
||||
// AdminAttachmentListReq 附件列表
|
||||
type AdminAttachmentListReq struct {
|
||||
g.Meta `path:"/admin/attachment/list" method:"get" tags:"admin" summary:"附件列表"`
|
||||
Keyword string `json:"keyword"` // 文件名模糊
|
||||
Scene string `json:"scene"` // 空=全部;avatar/cover/attachment
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
type AdminAttachmentListRes struct {
|
||||
List []AdminAttachmentItem `json:"list"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
// AdminAttachmentDeleteReq 删除附件(记录软删;文件本体无引用时才落盘删除)
|
||||
type AdminAttachmentDeleteReq struct {
|
||||
g.Meta `path:"/admin/attachment/delete" method:"post" tags:"admin" summary:"删除附件"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
}
|
||||
type AdminAttachmentDeleteRes struct {
|
||||
RemovedFile bool `json:"removed_file"` // false = 文件仍被引用,仅移除了登记记录
|
||||
}
|
||||
89
api/admin/v1/goods.go
Normal file
89
api/admin/v1/goods.go
Normal file
@@ -0,0 +1,89 @@
|
||||
package v1
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
// ============================================================================
|
||||
// 管理端软件开发服务契约(迭代-2026-09-29):list / detail / save / delete
|
||||
//
|
||||
// 封面 cover_path 库内存相对路径(/static/...);响应里 cover_url 为按
|
||||
// site.base_url 拼接的绝对地址。content_md 为 Markdown 原文,管理端编辑预览、
|
||||
// 小程序端解析渲染(富文本节点),后端只存原文不渲染。
|
||||
// ============================================================================
|
||||
|
||||
// AdminGoodsItem 服务列表项(响应 snake_case,不含 content_md —— 详情接口单独取)
|
||||
type AdminGoodsItem 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"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
||||
// AdminGoodsListReq 服务列表
|
||||
type AdminGoodsListReq struct {
|
||||
g.Meta `path:"/admin/goods/list" method:"get" tags:"admin" summary:"软件开发服务列表"`
|
||||
Keyword string `json:"keyword"`
|
||||
Category int `json:"category"` // 0=全部
|
||||
IsEnabled *int `json:"isEnabled"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
SortBy string `json:"sortBy"`
|
||||
SortOrder string `json:"sortOrder"` // asc / desc
|
||||
}
|
||||
type AdminGoodsListRes struct {
|
||||
List []AdminGoodsItem `json:"list"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
// AdminGoodsDetailReq 服务详情(编辑回填,含 content_md)
|
||||
type AdminGoodsDetailReq struct {
|
||||
g.Meta `path:"/admin/goods/detail" method:"get" tags:"admin" summary:"软件开发服务详情"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
}
|
||||
type AdminGoodsDetailRes struct {
|
||||
Id int64 `json:"id"`
|
||||
Category int `json:"category"`
|
||||
CategoryName string `json:"category_name"`
|
||||
Title string `json:"title"`
|
||||
Summary string `json:"summary"`
|
||||
ContentMd string `json:"content_md"`
|
||||
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"`
|
||||
}
|
||||
|
||||
// AdminGoodsSaveReq 新增/编辑服务(id=0 新建)。coverPath 传上传接口返回的 path(相对路径)。
|
||||
type AdminGoodsSaveReq struct {
|
||||
g.Meta `path:"/admin/goods/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"`
|
||||
PriceCents int64 `v:"min:0#价格不能为负" json:"priceCents"`
|
||||
PriceNote string `v:"length:0,64#价格备注最多 64 字" json:"priceNote"`
|
||||
CoverPath string `json:"coverPath"`
|
||||
Sort int `json:"sort"`
|
||||
IsEnabled int `json:"isEnabled"`
|
||||
}
|
||||
type AdminGoodsSaveRes struct {
|
||||
Id int64 `json:"id"`
|
||||
}
|
||||
|
||||
// AdminGoodsDeleteReq 删除服务(软删除)
|
||||
type AdminGoodsDeleteReq struct {
|
||||
g.Meta `path:"/admin/goods/delete" method:"post" tags:"admin" summary:"删除软件开发服务"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
}
|
||||
type AdminGoodsDeleteRes struct{}
|
||||
341
api/admin/v1/project.go
Normal file
341
api/admin/v1/project.go
Normal file
@@ -0,0 +1,341 @@
|
||||
package v1
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
// ============================================================================
|
||||
// 管理端开发项目契约(迭代-2026-09-30 三期)
|
||||
//
|
||||
// 建单 → 生成绑定小程序码(scene 携带 bind_token)→ 用户扫码绑定;
|
||||
// 阶段/小节点/交付物(原型、UI 设计稿)均为即时保存接口(管理端逐项操作)。
|
||||
// 阶段状态变更 / 交付物上传 / 交付 会向绑定用户推站内信。
|
||||
// ============================================================================
|
||||
|
||||
// AdminProjectPayItem 项目分期
|
||||
type AdminProjectPayItem struct {
|
||||
Id int64 `json:"id"`
|
||||
Seq int `json:"seq"`
|
||||
Percent int `json:"percent"`
|
||||
AmountCents int64 `json:"amount_cents"`
|
||||
Trigger string `json:"trigger"`
|
||||
TriggerText string `json:"trigger_text"`
|
||||
Status int `json:"status"`
|
||||
PaidAt string `json:"paid_at"`
|
||||
PaidNote string `json:"paid_note"`
|
||||
}
|
||||
|
||||
// AdminProjectItem 项目列表项
|
||||
type AdminProjectItem struct {
|
||||
Id int64 `json:"id"`
|
||||
UserId int64 `json:"user_id"`
|
||||
UserNickname string `json:"user_nickname"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
PriceCents int64 `json:"price_cents"`
|
||||
PriceNote string `json:"price_note"`
|
||||
DueNote string `json:"due_note"`
|
||||
Status int `json:"status"`
|
||||
StatusText string `json:"status_text"`
|
||||
StageTotal int `json:"stage_total"`
|
||||
StageDone int `json:"stage_done"`
|
||||
BindToken string `json:"bind_token"`
|
||||
CodeUrl string `json:"code_url"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
Stages []AdminProjectStageItem `json:"stages"`
|
||||
|
||||
MaintainPlanId int64 `json:"maintain_plan_id"`
|
||||
PayPlanId int64 `json:"pay_plan_id"`
|
||||
MaintainPlanName string `json:"maintain_plan_name"`
|
||||
PayPlanName string `json:"pay_plan_name"`
|
||||
Accepted int `json:"accepted"`
|
||||
AcceptedAt string `json:"accepted_at"`
|
||||
MaintainStartAt string `json:"maintain_start_at"`
|
||||
MaintainPaidUntil string `json:"maintain_paid_until"`
|
||||
MaintainDaysLeft int `json:"maintain_days_left"` // 距下次缴费天数(未启用维护为 -1)
|
||||
Pays []AdminProjectPayItem `json:"pays"`
|
||||
}
|
||||
|
||||
// AdminProjectListReq 项目列表
|
||||
type AdminProjectListReq struct {
|
||||
g.Meta `path:"/admin/service/project/list" method:"get" tags:"admin" summary:"开发项目列表"`
|
||||
Keyword string `json:"keyword"`
|
||||
Status *int `json:"status"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
type AdminProjectListRes struct {
|
||||
List []AdminProjectItem `json:"list"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
// AdminProjectSaveReq 新增/编辑项目(id=0 新建并生成绑定令牌;userId>0 直接绑定)
|
||||
type AdminProjectSaveReq struct {
|
||||
g.Meta `path:"/admin/service/project/save" method:"post" tags:"admin" summary:"保存开发项目"`
|
||||
Id int64 `json:"id"`
|
||||
Title string `v:"required#请填写项目名称" json:"title"`
|
||||
Description string `v:"length:0,1000#需求描述最多 1000 字" json:"description"`
|
||||
PriceCents int64 `v:"min:0#金额不能为负" json:"priceCents"`
|
||||
PriceNote string `v:"length:0,64#金额备注最多 64 字" json:"priceNote"`
|
||||
DueNote string `v:"length:0,64#交付周期最多 64 字" json:"dueNote"`
|
||||
Status int `v:"in:1,2,3#状态不合法" json:"status"`
|
||||
UserId int64 `json:"userId"` // 编辑时可直接改绑(填 0 = 解绑待扫码)
|
||||
MaintainPlanId int64 `json:"maintainPlanId"` // 维护模板(0=未选)
|
||||
PayPlanId int64 `json:"payPlanId"` // 付款分期模板(0=未选)
|
||||
}
|
||||
type AdminProjectSaveRes struct {
|
||||
Id int64 `json:"id"`
|
||||
BindToken string `json:"bind_token"` // 新建时返回,供前端直接弹码
|
||||
}
|
||||
|
||||
// AdminProjectDeleteReq 删除项目(软删除;阶段/节点/交付物一并硬删)
|
||||
type AdminProjectDeleteReq struct {
|
||||
g.Meta `path:"/admin/service/project/delete" method:"post" tags:"admin" summary:"删除开发项目"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
}
|
||||
type AdminProjectDeleteRes struct{}
|
||||
|
||||
// AdminProjectStageItem 阶段(含节点与文件,管理端详情用)
|
||||
type AdminProjectStageItem struct {
|
||||
Id int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Status int `json:"status"`
|
||||
StatusText string `json:"status_text"`
|
||||
Sort int `json:"sort"`
|
||||
IsEnabled int `json:"is_enabled"`
|
||||
Nodes []AdminProjectNodeItem `json:"nodes"`
|
||||
Files []AdminProjectFileItem `json:"files"`
|
||||
}
|
||||
|
||||
// AdminProjectNodeItem 小节点
|
||||
type AdminProjectNodeItem struct {
|
||||
Id int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
IsDone int `json:"is_done"`
|
||||
Sort int `json:"sort"`
|
||||
}
|
||||
|
||||
// AdminProjectFileItem 交付物(绝对 URL 直显)
|
||||
type AdminProjectFileItem struct {
|
||||
Id int64 `json:"id"`
|
||||
FileName string `json:"file_name"`
|
||||
FileUrl string `json:"file_url"`
|
||||
}
|
||||
|
||||
// AdminProjectDetailReq 项目详情(管理态全量:阶段/节点/文件)
|
||||
type AdminProjectDetailReq struct {
|
||||
g.Meta `path:"/admin/service/project/detail" method:"get" tags:"admin" summary:"开发项目详情"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
}
|
||||
type AdminProjectDetailRes struct {
|
||||
AdminProjectItem
|
||||
}
|
||||
|
||||
// AdminProjectQrcodeReq 生成/重取绑定小程序码(微信 getUnlimited,scene=项目+令牌)
|
||||
type AdminProjectQrcodeReq struct {
|
||||
g.Meta `path:"/admin/service/project/qrcode" method:"post" tags:"admin" summary:"生成项目绑定小程序码"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
}
|
||||
type AdminProjectQrcodeRes struct {
|
||||
CodeUrl string `json:"code_url"`
|
||||
}
|
||||
|
||||
// AdminProjectStageSaveReq 新增/编辑阶段
|
||||
type AdminProjectStageSaveReq struct {
|
||||
g.Meta `path:"/admin/service/project/stage/save" method:"post" tags:"admin" summary:"保存项目阶段"`
|
||||
Id int64 `json:"id"`
|
||||
ProjectId int64 `v:"required" json:"projectId"`
|
||||
Title string `v:"required#请填写阶段名称" json:"title"`
|
||||
Status int `v:"in:0,1,2#状态不合法" json:"status"`
|
||||
Sort int `json:"sort"`
|
||||
IsEnabled int `json:"isEnabled"`
|
||||
}
|
||||
type AdminProjectStageSaveRes struct {
|
||||
Id int64 `json:"id"`
|
||||
}
|
||||
|
||||
// AdminProjectStageDeleteReq 删除阶段(其节点与交付物一并删除)
|
||||
type AdminProjectStageDeleteReq struct {
|
||||
g.Meta `path:"/admin/service/project/stage/delete" method:"post" tags:"admin" summary:"删除项目阶段"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
}
|
||||
type AdminProjectStageDeleteRes struct{}
|
||||
|
||||
// AdminProjectNodeSaveReq 新增/编辑小节点(isDone 变更即时生效)
|
||||
type AdminProjectNodeSaveReq struct {
|
||||
g.Meta `path:"/admin/service/project/node/save" method:"post" tags:"admin" summary:"保存阶段小节点"`
|
||||
Id int64 `json:"id"`
|
||||
StageId int64 `v:"required" json:"stageId"`
|
||||
Title string `v:"required#请填写节点内容" json:"title"`
|
||||
IsDone int `json:"isDone"`
|
||||
Sort int `json:"sort"`
|
||||
}
|
||||
type AdminProjectNodeSaveRes struct {
|
||||
Id int64 `json:"id"`
|
||||
}
|
||||
|
||||
// AdminProjectNodeDeleteReq 删除小节点
|
||||
type AdminProjectNodeDeleteReq struct {
|
||||
g.Meta `path:"/admin/service/project/node/delete" method:"post" tags:"admin" summary:"删除阶段小节点"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
}
|
||||
type AdminProjectNodeDeleteRes struct{}
|
||||
|
||||
// AdminProjectFileAddReq 登记交付物(文件本体先经 /admin/upload 上传,此处只落 path)
|
||||
type AdminProjectFileAddReq struct {
|
||||
g.Meta `path:"/admin/service/project/file/add" method:"post" tags:"admin" summary:"登记项目交付物"`
|
||||
ProjectId int64 `v:"required" json:"projectId"`
|
||||
StageId int64 `json:"stageId"`
|
||||
FileName string `v:"required#请填写文件名" json:"fileName"`
|
||||
FilePath string `v:"required#缺少文件路径" json:"filePath"`
|
||||
}
|
||||
type AdminProjectFileAddRes struct {
|
||||
Id int64 `json:"id"`
|
||||
}
|
||||
|
||||
// AdminProjectFileDeleteReq 删除交付物登记
|
||||
type AdminProjectFileDeleteReq struct {
|
||||
g.Meta `path:"/admin/service/project/file/delete" method:"post" tags:"admin" summary:"删除项目交付物"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
}
|
||||
type AdminProjectFileDeleteRes struct{}
|
||||
|
||||
// ---------- 维护模板 ----------
|
||||
|
||||
// AdminMaintainPlanItem 维护模板
|
||||
type AdminMaintainPlanItem struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
FreeYears int `json:"free_years"`
|
||||
YearlyFeeCents int64 `json:"yearly_fee_cents"`
|
||||
SourceOnly int `json:"source_only"`
|
||||
Sort int `json:"sort"`
|
||||
IsEnabled int `json:"is_enabled"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
// AdminMaintainPlanListReq 维护模板列表
|
||||
type AdminMaintainPlanListReq struct {
|
||||
g.Meta `path:"/admin/service/maintain-plan/list" method:"get" tags:"admin" summary:"维护模板列表"`
|
||||
}
|
||||
type AdminMaintainPlanListRes struct {
|
||||
List []AdminMaintainPlanItem `json:"list"`
|
||||
}
|
||||
|
||||
// AdminMaintainPlanSaveReq 保存维护模板
|
||||
type AdminMaintainPlanSaveReq struct {
|
||||
g.Meta `path:"/admin/service/maintain-plan/save" method:"post" tags:"admin" summary:"保存维护模板"`
|
||||
Id int64 `json:"id"`
|
||||
Name string `v:"required#请填写模板名称" json:"name"`
|
||||
FreeYears int `v:"min:0" json:"freeYears"`
|
||||
YearlyFeeCents int64 `v:"min:0" json:"yearlyFeeCents"`
|
||||
SourceOnly int `json:"sourceOnly"`
|
||||
Sort int `json:"sort"`
|
||||
IsEnabled int `json:"isEnabled"`
|
||||
Remark string `v:"length:0,255" json:"remark"`
|
||||
}
|
||||
type AdminMaintainPlanSaveRes struct {
|
||||
Id int64 `json:"id"`
|
||||
}
|
||||
|
||||
// AdminMaintainPlanDeleteReq 删除维护模板
|
||||
type AdminMaintainPlanDeleteReq struct {
|
||||
g.Meta `path:"/admin/service/maintain-plan/delete" method:"post" tags:"admin" summary:"删除维护模板"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
}
|
||||
type AdminMaintainPlanDeleteRes struct{}
|
||||
|
||||
// ---------- 付款分期模板 ----------
|
||||
|
||||
// AdminPayPlanItem 付款分期模板
|
||||
type AdminPayPlanItem struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Schedule string `json:"schedule"` // JSON:[{seq,percent,trigger}]
|
||||
Sort int `json:"sort"`
|
||||
IsEnabled int `json:"is_enabled"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
// AdminPayPlanListReq 分期模板列表
|
||||
type AdminPayPlanListReq struct {
|
||||
g.Meta `path:"/admin/service/pay-plan/list" method:"get" tags:"admin" summary:"付款分期模板列表"`
|
||||
}
|
||||
type AdminPayPlanListRes struct {
|
||||
List []AdminPayPlanItem `json:"list"`
|
||||
}
|
||||
|
||||
// AdminPayPlanSaveReq 保存分期模板
|
||||
type AdminPayPlanSaveReq struct {
|
||||
g.Meta `path:"/admin/service/pay-plan/save" method:"post" tags:"admin" summary:"保存付款分期模板"`
|
||||
Id int64 `json:"id"`
|
||||
Name string `v:"required#请填写模板名称" json:"name"`
|
||||
Schedule string `v:"required#请填写分期计划 JSON" json:"schedule"`
|
||||
Sort int `json:"sort"`
|
||||
IsEnabled int `json:"isEnabled"`
|
||||
Remark string `v:"length:0,255" json:"remark"`
|
||||
}
|
||||
type AdminPayPlanSaveRes struct {
|
||||
Id int64 `json:"id"`
|
||||
}
|
||||
|
||||
// AdminPayPlanDeleteReq 删除分期模板
|
||||
type AdminPayPlanDeleteReq struct {
|
||||
g.Meta `path:"/admin/service/pay-plan/delete" method:"post" tags:"admin" summary:"删除付款分期模板"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
}
|
||||
type AdminPayPlanDeleteRes struct{}
|
||||
|
||||
// ---------- 分期到账 / 维护期 ----------
|
||||
|
||||
// AdminProjectPayMarkReq 标记分期到账(后台确认收款,用户端推站内信)
|
||||
type AdminProjectPayMarkReq struct {
|
||||
g.Meta `path:"/admin/service/project/pay/mark" method:"post" tags:"admin" summary:"标记分期到账"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
PaidNote string `v:"length:0,64#备注最多 64 字" json:"paidNote"`
|
||||
}
|
||||
type AdminProjectPayMarkRes struct{}
|
||||
|
||||
// AdminProjectPayUnmarkReq 撤销分期到账(误操作回退)
|
||||
type AdminProjectPayUnmarkReq struct {
|
||||
g.Meta `path:"/admin/service/project/pay/unmark" method:"post" tags:"admin" summary:"撤销分期到账"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
}
|
||||
type AdminProjectPayUnmarkRes struct{}
|
||||
|
||||
// AdminProjectMaintainRenewReq 维护费 +1 年已收(paid_until 顺延一年并通知用户)
|
||||
type AdminProjectMaintainRenewReq struct {
|
||||
g.Meta `path:"/admin/service/project/maintain/renew" method:"post" tags:"admin" summary:"维护费续收一年"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
}
|
||||
type AdminProjectMaintainRenewRes struct {
|
||||
PaidUntil string `json:"paid_until"`
|
||||
}
|
||||
|
||||
// AdminProjectMaintainAdjustReq 调整维护期起算日(重算已缴至与到期提醒)
|
||||
type AdminProjectMaintainAdjustReq struct {
|
||||
g.Meta `path:"/admin/service/project/maintain/adjust" method:"post" tags:"admin" summary:"调整维护期起算日"`
|
||||
Id int64 `v:"required" json:"id"`
|
||||
StartAt string `v:"required#请选择起算日期" json:"startAt"` // YYYY-MM-DD
|
||||
}
|
||||
type AdminProjectMaintainAdjustRes struct {
|
||||
PaidUntil string `json:"paid_until"`
|
||||
}
|
||||
|
||||
// ---------- 缴费提醒设置 ----------
|
||||
|
||||
// AdminMaintainRemindGetReq 提醒设置读取
|
||||
type AdminMaintainRemindGetReq struct {
|
||||
g.Meta `path:"/admin/service/maintain-remind/get" method:"get" tags:"admin" summary:"维护费提醒设置读取"`
|
||||
}
|
||||
type AdminMaintainRemindGetRes struct {
|
||||
RemindDays int `json:"remind_days"`
|
||||
AdminNotifyUserId int64 `json:"admin_notify_user_id"`
|
||||
}
|
||||
|
||||
// AdminMaintainRemindSaveReq 提醒设置保存
|
||||
type AdminMaintainRemindSaveReq struct {
|
||||
g.Meta `path:"/admin/service/maintain-remind/save" method:"post" tags:"admin" summary:"维护费提醒设置保存"`
|
||||
RemindDays int `v:"min:1|max:90#提醒天数需在 1-90 之间" json:"remindDays"`
|
||||
AdminNotifyUserId int64 `json:"adminNotifyUserId"`
|
||||
}
|
||||
type AdminMaintainRemindSaveRes struct{}
|
||||
181
api/admin/v1/service.go
Normal file
181
api/admin/v1/service.go
Normal file
@@ -0,0 +1,181 @@
|
||||
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{}
|
||||
33
api/admin/v1/setting.go
Normal file
33
api/admin/v1/setting.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package v1
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
// ============================================================================
|
||||
// 管理端系统配置契约(迭代-2026-09-29)
|
||||
//
|
||||
// 走 settings 表(约定 S9:配置一律走 settings 表,不写 config.yaml);本模块
|
||||
// 只开放白名单键,当前是 site.base_url(图片等静态资源的对外拼接前缀)。
|
||||
// ============================================================================
|
||||
|
||||
// AdminSettingItem 配置项
|
||||
type AdminSettingItem struct {
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
// AdminSettingGetReq 读取白名单配置项
|
||||
type AdminSettingGetReq struct {
|
||||
g.Meta `path:"/admin/setting/get" method:"get" tags:"admin" summary:"系统配置读取"`
|
||||
}
|
||||
type AdminSettingGetRes struct {
|
||||
Items []AdminSettingItem `json:"items"`
|
||||
}
|
||||
|
||||
// AdminSettingSaveReq 保存一项配置(key 必须在白名单内)
|
||||
type AdminSettingSaveReq struct {
|
||||
g.Meta `path:"/admin/setting/save" method:"post" tags:"admin" summary:"系统配置保存"`
|
||||
Key string `v:"required" json:"key"`
|
||||
Value string `v:"length:0,255#配置值最多 255 字" json:"value"`
|
||||
}
|
||||
type AdminSettingSaveRes struct{}
|
||||
Reference in New Issue
Block a user