小程序一些功能更新
This commit is contained in:
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{}
|
||||
Reference in New Issue
Block a user