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

116 lines
4.5 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"
// ============================================================================
// C 端开发项目契约(迭代-2026-09-30 三期)
//
// 流程:后台建单(生成绑定令牌)→ 用户扫小程序码进入绑定页 → POST bind 绑定到
// 当前用户 → 后台维护阶段/小节点/交付物(原型、UI 设计稿等)→ 用户端只读查看。
// ============================================================================
// ProjectStageItem 项目阶段(含小节点与交付物)
type ProjectStageItem struct {
Id int64 `json:"id"`
Title string `json:"title"`
Status int `json:"status"` // 0未开始 1进行中 2已完成
StatusText string `json:"status_text"`
Nodes []ProjectNodeItem `json:"nodes"`
Files []ProjectFileItem `json:"files"`
}
// ProjectNodeItem 阶段小节点
type ProjectNodeItem struct {
Id int64 `json:"id"`
Title string `json:"title"`
IsDone int `json:"is_done"`
DoneAt string `json:"done_at"`
}
// ProjectFileItem 阶段交付物(图片,绝对 URL)
type ProjectFileItem struct {
Id int64 `json:"id"`
FileName string `json:"file_name"`
FileUrl string `json:"file_url"`
}
// ProjectPayItem 项目分期(后台确认到账,用户只读)
type ProjectPayItem 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"` // 0待支付 1已支付
PaidAt string `json:"paid_at"`
}
// ProjectMaintainOut 维护期信息
type ProjectMaintainOut struct {
PlanName string `json:"plan_name"`
FreeYears int `json:"free_years"`
YearlyFeeCents int64 `json:"yearly_fee_cents"`
SourceOnly int `json:"source_only"` // 1=仅源码无售后
Accepted int `json:"accepted"`
AcceptedAt string `json:"accepted_at"`
StartAt string `json:"start_at"` // 维护期起算日(后台可调)
PaidUntil string `json:"paid_until"` // 维护费已缴至(= 下次缴费日)
}
// ProjectItem 项目列表项
type ProjectItem struct {
Id int64 `json:"id"`
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"`
CoverUrl string `json:"cover_url"` // 入口图(第一个阶段交付物图片,可能为空)
UpdatedAt string `json:"updated_at"`
}
// ProjectMineReq 我的项目(扫码绑定后可见)
type ProjectMineReq struct {
g.Meta `path:"/service/project/mine" method:"get" tags:"service" summary:"我的开发项目"`
}
type ProjectMineRes struct {
List []ProjectItem `json:"list"`
}
// ProjectDetailReq 项目详情(仅限已绑定用户;含阶段/节点/交付物/分期/维护期)
type ProjectDetailReq struct {
g.Meta `path:"/service/project/detail" method:"get" tags:"service" summary:"开发项目详情"`
Id int64 `v:"required" json:"id"`
}
type ProjectDetailRes struct {
ProjectItem
Stages []ProjectStageItem `json:"stages"`
Pays []ProjectPayItem `json:"pays"` // 分期付款(进度与到账状态)
Maintain *ProjectMaintainOut `json:"maintain"` // 维护期信息(未选模板为 null)
CanAccept int `json:"can_accept"` // 1=可点「确认验收」(已交付且未验收)
}
// ProjectAcceptReq 用户确认验收:进入维护期(维护期起点=确认当天,后台可调整)。
type ProjectAcceptReq struct {
g.Meta `path:"/service/project/accept" method:"post" tags:"service" summary:"确认验收进入维护期"`
Id int64 `v:"required" json:"id"`
}
type ProjectAcceptRes struct {
MaintainStartAt string `json:"maintain_start_at"`
PaidUntil string `json:"paid_until"`
}
// ProjectBindReq 扫码绑定项目(令牌来自小程序码 scene)
type ProjectBindReq struct {
g.Meta `path:"/service/project/bind" method:"post" tags:"service" summary:"绑定开发项目"`
Token string `v:"required#缺少绑定令牌" json:"token"`
}
type ProjectBindRes struct {
ProjectId int64 `json:"project_id"`
}