gomod引用

This commit is contained in:
2025-12-12 18:16:28 +08:00
parent a4ba4dd715
commit 465c138f21
11 changed files with 340 additions and 403 deletions

View File

@@ -2,13 +2,16 @@ package dto
import (
"time"
"github.com/gogf/gf/v2/frame/g"
)
// CreateOrderReq 创建订单请求
type CreateOrderReq struct {
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
UserID string `json:"user_id" binding:"required"` // 户ID
g.Meta `path:"/create" method:"post" tags:"订单管理" summary:"创建订单" dc:"创建新订单"`
TenantID interface{} `json:"tenant_id" binding:"required"` // 户ID
UserID int64 `json:"user_id" binding:"required"` // 用户ID
OrderType string `json:"order_type" binding:"required"` // 订单类型
Subject string `json:"subject" binding:"required"` // 订单标题
Description string `json:"description"` // 订单描述
@@ -58,6 +61,7 @@ type CreateOrderResp struct {
// PayOrderReq 支付订单请求
type PayOrderReq struct {
g.Meta `path:"/pay" method:"post" tags:"订单管理" summary:"支付订单" dc:"发起订单支付"`
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
OrderNo string `json:"order_no" binding:"required"` // 订单号
PayMethod string `json:"pay_method" binding:"required"` // 支付方式wechat/alipay
@@ -82,6 +86,7 @@ type PayOrderResp struct {
// QueryOrderReq 查询订单请求
type QueryOrderReq struct {
g.Meta `path:"/query" method:"get" tags:"订单管理" summary:"查询订单详情" dc:"根据订单号查询订单详情"`
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
OrderNo string `json:"order_no" binding:"required"` // 订单号
}
@@ -96,7 +101,7 @@ type QueryOrderResp struct {
type OrderDetail struct {
ID string `json:"id"` // 订单ID
TenantID string `json:"tenant_id"` // 租户ID
TenantID interface{} `json:"tenant_id"` // 租户ID
OrderNo string `json:"order_no"` // 订单号
UserID int64 `json:"user_id"` // 用户ID
TotalAmount int64 `json:"total_amount"` // 订单总金额
@@ -161,6 +166,7 @@ type PayInfo struct {
// CancelOrderReq 取消订单请求
type CancelOrderReq struct {
g.Meta `path:"/cancel" method:"post" tags:"订单管理" summary:"取消订单" dc:"取消指定订单"`
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
OrderNo string `json:"order_no" binding:"required"` // 订单号
Reason string `json:"reason"` // 取消原因
@@ -176,6 +182,7 @@ type CancelOrderResp struct {
// RefundOrderReq 退款请求
type RefundOrderReq struct {
g.Meta `path:"/refund" method:"post" tags:"订单管理" summary:"订单退款" dc:"发起订单退款"`
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
OrderNo string `json:"order_no" binding:"required"` // 订单号
RefundAmount int64 `json:"refund_amount" binding:"required"` // 退款金额(分)
@@ -193,6 +200,7 @@ type RefundOrderResp struct {
// ListOrdersReq 订单列表请求
type ListOrdersReq struct {
g.Meta `path:"/orders" method:"get" tags:"订单管理" summary:"订单列表" dc:"分页查询订单列表"`
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
UserID string `json:"user_id"` // 用户ID可选
Status string `json:"status"` // 订单状态(可选)
@@ -225,6 +233,7 @@ type OrderSummary struct {
// PaymentNotifyReq 支付回调请求
type PaymentNotifyReq struct {
g.Meta `path:"/paymentNotify" method:"post" tags:"支付管理" summary:"支付回调" dc:"处理支付平台回调通知"`
TenantID string `json:"tenant_id"` // 租户ID
OrderNo string `json:"order_no"` // 订单号
PayMethod string `json:"pay_method"` // 支付方式
@@ -243,6 +252,7 @@ type PaymentNotifyResp struct {
// RefundNotifyReq 退款回调请求
type RefundNotifyReq struct {
g.Meta `path:"/refundNotify" method:"post" tags:"退款管理" summary:"退款回调" dc:"处理退款平台回调通知"`
TenantID string `json:"tenant_id"` // 租户ID
RefundNo string `json:"refund_no"` // 退款单号
Status string `json:"status"` // 退款状态
@@ -256,85 +266,9 @@ type RefundNotifyResp struct {
Success bool `json:"success"` // 是否成功
}
// CreatePaymentConfigReq 创建支付配置请求
// CommonResp 通用响应
type CreatePaymentConfigReq struct {
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
PayMethod string `json:"pay_method" binding:"required"` // 支付方式wechat/alipay
ConfigName string `json:"config_name" binding:"required"` // 配置名称
Remark string `json:"remark"` // 备注
IsEnabled bool `json:"is_enabled"` // 是否启用
Config map[string]interface{} `json:"config" binding:"required"` // 配置参数
}
// UpdatePaymentConfigReq 更新支付配置请求
type UpdatePaymentConfigReq struct {
ID string `json:"id" binding:"required"` // 配置ID
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
ConfigName string `json:"config_name" binding:"required"` // 配置名称
Remark string `json:"remark"` // 备注
IsEnabled bool `json:"is_enabled"` // 是否启用
Config map[string]interface{} `json:"config" binding:"required"` // 配置参数
}
// QueryPaymentConfigReq 查询支付配置请求
type QueryPaymentConfigReq struct {
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
PayMethod string `json:"pay_method"` // 支付方式(可选)
}
// PaymentConfigResp 支付配置响应
type PaymentConfigResp struct {
ID string `json:"id"` // 配置ID
TenantID string `json:"tenant_id"` // 租户ID
PayMethod string `json:"pay_method"` // 支付方式
ConfigName string `json:"config_name"` // 配置名称
Remark string `json:"remark"` // 备注
IsEnabled bool `json:"is_enabled"` // 是否启用
Config map[string]interface{} `json:"config"` // 配置参数
CreatedAt time.Time `json:"created_at"` // 创建时间
UpdatedAt time.Time `json:"updated_at"` // 更新时间
}
// WechatConfig 微信支付配置
type WechatConfig struct {
ID string `json:"id"` // 配置ID
TenantID string `json:"tenant_id"` // 租户ID
ConfigName string `json:"config_name"` // 配置名称
AppID string `json:"app_id"` // 应用ID
MchID string `json:"mch_id"` // 商户号
APIKey string `json:"api_key"` // API密钥
NotifyURL string `json:"notify_url"` // 回调地址
ReturnURL string `json:"return_url"` // 返回地址
CertPath string `json:"cert_path"` // 证书路径
KeyPath string `json:"key_path"` // 密钥路径
Sandbox bool `json:"sandbox"` // 是否沙箱环境
SupportNative bool `json:"support_native"` // 支持扫码支付
SupportJSAPI bool `json:"support_jsapi"` // 支持JSAPI支付
SupportAPP bool `json:"support_app"` // 支持APP支付
SupportH5 bool `json:"support_h5"` // 支持H5支付
GatewayURL string `json:"gateway_url"` // 网关地址
}
// AlipayConfig 支付宝支付配置
type AlipayConfig struct {
ID string `json:"id"` // 配置ID
TenantID string `json:"tenant_id"` // 租户ID
ConfigName string `json:"config_name"` // 配置名称
AppID string `json:"app_id"` // 应用ID
NotifyURL string `json:"notify_url"` // 回调地址
ReturnURL string `json:"return_url"` // 返回地址
AppPrivateKey string `json:"app_private_key"` // 应用私钥
AlipayPublicKey string `json:"alipay_public_key"` // 支付宝公钥
Sandbox bool `json:"sandbox"` // 是否沙箱环境
GatewayURL string `json:"gateway_url"` // 网关地址
SupportNative bool `json:"support_native"` // 支持扫码支付
SupportJSAPI bool `json:"support_jsapi"` // 支持JSAPI支付
SupportAPP bool `json:"support_app"` // 支持APP支付
SupportH5 bool `json:"support_h5"` // 支持H5支付
type CommonResp struct {
Success bool `json:"success"` // 是否成功
Message string `json:"message"` // 消息
}

View File

@@ -8,7 +8,7 @@ import (
// GetOrderStatisticsReq 获取订单统计数据请求
type GetOrderStatisticsReq struct {
g.Meta `path:"/statistics" method:"get" tags:"订单统计" summary:"获取订单统计数据" dc:"根据报表类型和日期获取订单统计数据"`
g.Meta `path:"/getStatistics" method:"get" tags:"订单统计" summary:"获取订单统计数据" dc:"根据报表类型和日期获取订单统计数据"`
TenantID int64 `v:"required" json:"tenant_id" dc:"租户ID"`
ReportType string `v:"required|in:daily,monthly,quarterly,yearly" json:"report_type" dc:"报表类型"`
StartDate string `json:"start_date,omitempty" dc:"开始日期"`
@@ -62,7 +62,7 @@ type OrderStatisticsDetail struct {
// GetOrderStatisticsListReq 获取订单统计列表请求
type GetOrderStatisticsListReq struct {
g.Meta `path:"/statistics/list" method:"get" tags:"订单统计" summary:"获取订单统计列表" dc:"分页获取订单统计列表"`
g.Meta `path:"/getStatisticsList" method:"get" tags:"订单统计" summary:"获取订单统计列表" dc:"分页获取订单统计列表"`
TenantID int64 `v:"required" json:"tenant_id" dc:"租户ID"`
ReportType string `v:"required|in:daily,monthly,quarterly,yearly" json:"report_type" dc:"报表类型"`
StartDate string `json:"start_date,omitempty" dc:"开始日期"`
@@ -81,7 +81,7 @@ type GetOrderStatisticsListRes struct {
// GenerateOrderStatisticsReq 生成订单统计数据请求
type GenerateOrderStatisticsReq struct {
g.Meta `path:"/statistics/generate" method:"post" tags:"订单统计" summary:"生成订单统计数据" dc:"手动触发生成指定日期的统计数据"`
g.Meta `path:"/generateStatistics" method:"post" tags:"订单统计" summary:"生成订单统计数据" dc:"手动触发生成指定日期的统计数据"`
TenantID int64 `v:"required" json:"tenant_id" dc:"租户ID"`
ReportType string `v:"required|in:daily,monthly,quarterly,yearly" json:"report_type" dc:"报表类型"`
ReportDate string `json:"report_date,omitempty" dc:"统计日期格式YYYY-MM-DD"`
@@ -96,7 +96,7 @@ type GenerateOrderStatisticsRes struct {
// GetOrderTrendReq 获取订单趋势数据请求
type GetOrderTrendReq struct {
g.Meta `path:"/statistics/trend" method:"get" tags:"订单统计" summary:"获取订单趋势数据" dc:"获取指定时间范围内的订单趋势数据"`
g.Meta `path:"/getTrend" method:"get" tags:"订单统计" summary:"获取订单趋势数据" dc:"获取指定时间范围内的订单趋势数据"`
TenantID int64 `v:"required" json:"tenant_id" dc:"租户ID"`
StartDate string `v:"required" json:"start_date" dc:"开始日期格式YYYY-MM-DD"`
EndDate string `v:"required" json:"end_date" dc:"结束日期格式YYYY-MM-DD"`
@@ -117,7 +117,7 @@ type TrendDataPoint struct {
// GetTopAssetsReq 获取热门资产请求
type GetTopAssetsReq struct {
g.Meta `path:"/statistics/top-assets" method:"get" tags:"订单统计" summary:"获取热门资产" dc:"获取指定时间范围内的热门资产排行"`
g.Meta `path:"/getTopAssets" method:"get" tags:"订单统计" summary:"获取热门资产" dc:"获取指定时间范围内的热门资产排行"`
TenantID int64 `v:"required" json:"tenant_id" dc:"租户ID"`
StartDate string `v:"required" json:"start_date" dc:"开始日期格式YYYY-MM-DD"`
EndDate string `v:"required" json:"end_date" dc:"结束日期格式YYYY-MM-DD"`

120
model/dto/payment_config.go Normal file
View File

@@ -0,0 +1,120 @@
package dto
import (
"time"
"github.com/gogf/gf/v2/frame/g"
)
// CreatePaymentConfigReq 创建支付配置请求
type CreatePaymentConfigReq struct {
g.Meta `path:"/create" method:"post" tags:"支付配置" summary:"创建支付配置" dc:"创建新的支付配置"`
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
PayMethod string `json:"pay_method" binding:"required"` // 支付方式wechat/alipay
ConfigName string `json:"config_name" binding:"required"` // 配置名称
Remark string `json:"remark"` // 备注
IsEnabled bool `json:"is_enabled"` // 是否启用
Config map[string]interface{} `json:"config" binding:"required"` // 配置参数
}
// UpdatePaymentConfigReq 更新支付配置请求
type UpdatePaymentConfigReq struct {
g.Meta `path:"/update" method:"put" tags:"支付配置" summary:"更新支付配置" dc:"更新指定支付配置"`
ID string `json:"id" binding:"required"` // 配置ID
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
ConfigName string `json:"config_name" binding:"required"` // 配置名称
Remark string `json:"remark"` // 备注
IsEnabled bool `json:"is_enabled"` // 是否启用
Config map[string]interface{} `json:"config" binding:"required"` // 配置参数
}
// QueryPaymentConfigReq 查询支付配置请求
type QueryPaymentConfigReq struct {
g.Meta `path:"/query" method:"get" tags:"支付配置" summary:"查询支付配置" dc:"查询支付配置列表"`
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
PayMethod string `json:"pay_method"` // 支付方式(可选)
}
// ListPaymentConfigReq 查询支付配置列表请求
type ListPaymentConfigReq struct {
g.Meta `path:"/list" method:"get" tags:"支付配置" summary:"查询支付配置列表" dc:"分页查询支付配置列表"`
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
}
// DeletePaymentConfigReq 删除支付配置请求
type DeletePaymentConfigReq struct {
g.Meta `path:"/delete" method:"delete" tags:"支付配置" summary:"删除支付配置" dc:"删除指定支付配置"`
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
ConfigID string `json:"config_id" binding:"required"` // 配置ID
}
// EnablePaymentConfigReq 启用支付配置请求
type EnablePaymentConfigReq struct {
g.Meta `path:"/enable" method:"post" tags:"支付配置" summary:"启用支付配置" dc:"启用指定支付配置"`
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
ConfigID string `json:"config_id" binding:"required"` // 配置ID
}
// DisablePaymentConfigReq 禁用支付配置请求
type DisablePaymentConfigReq struct {
g.Meta `path:"/disable" method:"post" tags:"支付配置" summary:"禁用支付配置" dc:"禁用指定支付配置"`
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
ConfigID string `json:"config_id" binding:"required"` // 配置ID
}
// PaymentConfigListResp 支付配置列表响应
type PaymentConfigListResp struct {
List []PaymentConfigResp `json:"list"` // 配置列表
Total int64 `json:"total"` // 总数
}
// PaymentConfigResp 支付配置响应
type PaymentConfigResp struct {
ID string `json:"id"` // 配置ID
TenantID string `json:"tenant_id"` // 租户ID
PayMethod string `json:"pay_method"` // 支付方式
ConfigName string `json:"config_name"` // 配置名称
Remark string `json:"remark"` // 备注
IsEnabled bool `json:"is_enabled"` // 是否启用
Config map[string]interface{} `json:"config"` // 配置参数
CreatedAt time.Time `json:"created_at"` // 创建时间
UpdatedAt time.Time `json:"updated_at"` // 更新时间
}
// WechatConfig 微信支付配置
type WechatConfig struct {
ID string `json:"id"` // 配置ID
TenantID string `json:"tenant_id"` // 租户ID
ConfigName string `json:"config_name"` // 配置名称
AppID string `json:"app_id"` // 应用ID
MchID string `json:"mch_id"` // 商户号
APIKey string `json:"api_key"` // API密钥
NotifyURL string `json:"notify_url"` // 回调地址
ReturnURL string `json:"return_url"` // 返回地址
CertPath string `json:"cert_path"` // 证书路径
KeyPath string `json:"key_path"` // 密钥路径
Sandbox bool `json:"sandbox"` // 是否沙箱环境
SupportNative bool `json:"support_native"` // 支持扫码支付
SupportJSAPI bool `json:"support_jsapi"` // 支持JSAPI支付
SupportAPP bool `json:"support_app"` // 支持APP支付
SupportH5 bool `json:"support_h5"` // 支持H5支付
GatewayURL string `json:"gateway_url"` // 网关地址
}
// AlipayConfig 支付宝支付配置
type AlipayConfig struct {
ID string `json:"id"` // 配置ID
TenantID string `json:"tenant_id"` // 租户ID
ConfigName string `json:"config_name"` // 配置名称
AppID string `json:"app_id"` // 应用ID
NotifyURL string `json:"notify_url"` // 回调地址
ReturnURL string `json:"return_url"` // 返回地址
AppPrivateKey string `json:"app_private_key"` // 应用私钥
AlipayPublicKey string `json:"alipay_public_key"` // 支付宝公钥
Sandbox bool `json:"sandbox"` // 是否沙箱环境
GatewayURL string `json:"gateway_url"` // 网关地址
SupportNative bool `json:"support_native"` // 支持扫码支付
SupportJSAPI bool `json:"support_jsapi"` // 支持JSAPI支付
SupportAPP bool `json:"support_app"` // 支持APP支付
SupportH5 bool `json:"support_h5"` // 支持H5支付
}