小程序一些功能更新

This commit is contained in:
李琦
2026-09-30 17:01:18 +08:00
parent 75499ba85c
commit 6f51d99a78
46 changed files with 5280 additions and 37 deletions

19
api/user/v1/app_config.go Normal file
View File

@@ -0,0 +1,19 @@
package v1
import "github.com/gogf/gf/v2/frame/g"
// ============================================================================
// C 端应用配置契约(迭代-2026-09-30)
//
// 首页等界面级配置的轻量下发口。值来自 settings 表,key 对齐小程序端
// `config/features.ts` 的 FEATURE_ENTRIES key;未配置的 key 不出现在 map 中。
// ============================================================================
// AppConfigReq 应用配置(首页功能卡背景图等)
type AppConfigReq struct {
g.Meta `path:"/app/config" method:"get" tags:"app" summary:"应用配置"`
}
type AppConfigRes struct {
// FeatureCovers 首页便捷功能卡背景图:featureKey → 绝对 URL(后端按 site.base_url 拼好)
FeatureCovers map[string]string `json:"feature_covers"`
}

52
api/user/v1/goods.go Normal file
View File

@@ -0,0 +1,52 @@
package v1
import "github.com/gogf/gf/v2/frame/g"
// ============================================================================
// C 端软件开发服务契约(迭代-2026-09-29):list / detail
//
// 仅上架(is_enabled=1)商品可见;封面 url 由后端按 site.base_url 拼成绝对地址,
// 小程序端拿到即可直接用于 <image>,无需自行拼接域名。
// ============================================================================
// GoodsItem 服务列表项(响应 snake_case)
type GoodsItem struct {
Id int64 `json:"id"`
Category int `json:"category"` // 1网站 2小程序 3App 4桌面
CategoryName string `json:"category_name"` // 分类展示名(服务端映射)
Title string `json:"title"`
Summary string `json:"summary"`
CoverUrl string `json:"cover_url"` // 封面绝对 URL(可能为空 = 无封面)
PriceCents int64 `json:"price_cents"` // 0 = 面议
PriceNote string `json:"price_note"` // 价格备注(如「起」「/项目」)
}
// GoodsListReq 服务列表(C 端,仅上架)
type GoodsListReq struct {
g.Meta `path:"/goods/list" method:"get" tags:"goods" summary:"软件开发服务列表"`
Category int `json:"category"` // 0=全部
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
type GoodsListRes struct {
List []GoodsItem `json:"list"`
Total int `json:"total"`
}
// GoodsDetailReq 服务详情(C 端,仅上架;含 Markdown 原文,由前端解析渲染)
type GoodsDetailReq struct {
g.Meta `path:"/goods/detail" method:"get" tags:"goods" summary:"软件开发服务详情"`
Id int64 `v:"required" json:"id"`
}
type GoodsDetailRes 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"`
CoverUrl string `json:"cover_url"`
PriceCents int64 `json:"price_cents"`
PriceNote string `json:"price_note"`
UpdatedAt string `json:"updated_at"`
}

View File

@@ -93,6 +93,7 @@ type MemberOrderCheckRes struct {
type MemberOrdersReq struct {
g.Meta `path:"/member/orders" method:"get" tags:"member" summary:"我的会员订单"`
Limit int `json:"limit"`
Tab int `json:"tab"` // 0全部 1待付款 2已生效 3退款
}
type MemberOrderOut struct {
OutTradeNo string `json:"out_trade_no"`

47
api/user/v1/message.go Normal file
View File

@@ -0,0 +1,47 @@
package v1
import "github.com/gogf/gf/v2/frame/g"
// ============================================================================
// C 端站内信契约(迭代-2026-09-30)
//
// 写入点(后端业务事件统一落 user_messages,见 logic/message.go PushMessage):
// 会员开通/次数包到账(发货成功)、报价申请回执、报价处理结果、反馈官方回复。
// C 端只读:列表 / 未读数 / 标记已读(单条或全部)。
// ============================================================================
// MessageItem 站内信条目
type MessageItem struct {
Id int64 `json:"id"`
Type string `json:"type"` // order_delivered/quote_submitted/quote_handled/feedback_replied/system
Title string `json:"title"`
Content string `json:"content"`
Link string `json:"link"` // 小程序内跳转路由,空=不跳转
IsRead int `json:"is_read"`
CreatedAt string `json:"created_at"`
}
// MessageListReq 我的消息(最近 N 条 + 未读数;不自动置已读,已读走 /message/read)
type MessageListReq struct {
g.Meta `path:"/message/list" method:"get" tags:"message" summary:"我的站内信"`
Limit int `json:"limit"`
}
type MessageListRes struct {
List []MessageItem `json:"list"`
Unread int `json:"unread"`
}
// MessageUnreadReq 未读消息数(首页 / 我的页徽标)
type MessageUnreadReq struct {
g.Meta `path:"/message/unread" method:"get" tags:"message" summary:"未读站内信数"`
}
type MessageUnreadRes struct {
Count int `json:"count"`
}
// MessageReadReq 标记已读:Id>0 单条;Id=0 全部
type MessageReadReq struct {
g.Meta `path:"/message/read" method:"post" tags:"message" summary:"站内信标记已读"`
Id int64 `json:"id"`
}
type MessageReadRes struct{}

115
api/user/v1/project.go Normal file
View File

@@ -0,0 +1,115 @@
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"`
}

102
api/user/v1/service.go Normal file
View File

@@ -0,0 +1,102 @@
package v1
import "github.com/gogf/gf/v2/frame/g"
// ============================================================================
// C 端软件开发服务二期契约(迭代-2026-09-30):介绍页模块 / 作品案例 / 报价申请
//
// - 介绍页模块(service_blocks)由管理端逐块编辑(预设排版布局),C 端按 sort 输出;
// - 图片字段库内只存相对路径,输出统一为绝对 URL(同 goods 封面约定);
// - 报价申请提交后写站内信回执;处理结果(已报价/成交/关闭)再推站内信。
// ============================================================================
// ServiceBlockOut 介绍页模块(响应 snake_case)
type ServiceBlockOut struct {
Id int64 `json:"id"`
Kind string `json:"kind"` // hero/rich/image_text/image_list/developer/works/goods
Title string `json:"title"`
Subtitle string `json:"subtitle"`
ImageUrl string `json:"image_url"` // 主图绝对 URL(可能为空)
Images []string `json:"images"` // 图集绝对 URL(image_list)
Content string `json:"content"` // Markdown 原文,前端解析渲染
}
// ServicePageReq 服务介绍页模块列表(仅启用,sort 升序)
type ServicePageReq struct {
g.Meta `path:"/service/page" method:"get" tags:"service" summary:"软件开发服务介绍页"`
}
type ServicePageRes struct {
List []ServiceBlockOut `json:"list"`
}
// WorkItem 作品列表项
type WorkItem struct {
Id int64 `json:"id"`
Category int `json:"category"`
CategoryName string `json:"category_name"`
Title string `json:"title"`
Summary string `json:"summary"`
CoverUrl string `json:"cover_url"`
PriceCents int64 `json:"price_cents"` // 0 = 面议
PriceNote string `json:"price_note"`
}
// WorksListReq 作品列表(仅上架)
type WorksListReq struct {
g.Meta `path:"/service/works" method:"get" tags:"service" summary:"软件开发作品列表"`
Category int `json:"category"` // 0=全部
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
type WorksListRes struct {
List []WorkItem `json:"list"`
Total int `json:"total"`
}
// WorkDetailReq 作品详情(含图集与 Markdown 详情)
type WorkDetailReq struct {
g.Meta `path:"/service/works/detail" method:"get" tags:"service" summary:"软件开发作品详情"`
Id int64 `v:"required" json:"id"`
}
type WorkDetailRes struct {
WorkItem
Images []string `json:"images"` // 详情图集(绝对 URL)
ContentMd string `json:"content_md"`
UpdatedAt string `json:"updated_at"`
}
// QuoteSubmitReq 提交报价申请(需求 → 站内信回执)
type QuoteSubmitReq struct {
g.Meta `path:"/service/quote/submit" method:"post" tags:"service" summary:"提交软件开发报价申请"`
WorkId int64 `json:"work_id"` // 0 = 通用申请(不关联作品)
Contact string `v:"required#请填写联系方式" json:"contact"`
Requirement string `v:"required#请描述您的需求" json:"requirement"`
Budget string `json:"budget"` // 预算范围文案,可空
}
type QuoteSubmitRes struct {
Id int64 `json:"id"`
}
// QuoteMineItem 我的报价申请条目(含处理结果)
type QuoteMineItem struct {
Id int64 `json:"id"`
WorkId int64 `json:"work_id"`
WorkTitle string `json:"work_title"`
Requirement string `json:"requirement"`
Budget string `json:"budget"`
Status int `json:"status"`
StatusText string `json:"status_text"`
QuoteCents int64 `json:"quote_cents"` // 0=面议/未填
QuoteNote string `json:"quote_note"`
HandledAt string `json:"handled_at"`
CreatedAt string `json:"created_at"`
}
// QuoteMineReq 我的报价申请(最近 N 条)
type QuoteMineReq struct {
g.Meta `path:"/service/quote/mine" method:"get" tags:"service" summary:"我的报价申请"`
Limit int `json:"limit"`
}
type QuoteMineRes struct {
List []QuoteMineItem `json:"list"`
}