mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-12 20:23:52 +08:00
This commit is contained in:
55
server/internal/model/input/payin/general.go
Normal file
55
server/internal/model/input/payin/general.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package payin
|
||||
|
||||
import (
|
||||
"github.com/go-pay/gopay/wechat/v3"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
officialJs "github.com/silenceper/wechat/v2/officialaccount/js"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
// 和功能库[payment]包的通用输入/输出
|
||||
|
||||
// CreateOrderInp 统一创建订单入口
|
||||
type CreateOrderInp struct {
|
||||
Pay *entity.PayLog
|
||||
}
|
||||
|
||||
type CreateOrderModel struct {
|
||||
TradeType string `json:"tradeType" description:"交易类型"`
|
||||
PayURL string `json:"payURL" description:"支付地址"`
|
||||
OutTradeNo string `json:"outTradeNo" description:"商户订单号"`
|
||||
JsApi *JSAPI `json:"jsApi" description:"jsapi支付参数"`
|
||||
}
|
||||
|
||||
type JSAPI struct {
|
||||
Config *officialJs.Config `json:"config" description:"js初始化配置"`
|
||||
Params *wechat.JSAPIPayParams `json:"params" description:"支付参数"`
|
||||
}
|
||||
|
||||
// NotifyInp 统一异步通知处理入口
|
||||
type NotifyInp struct {
|
||||
}
|
||||
|
||||
type NotifyModel struct {
|
||||
OutTradeNo string `json:"outTradeNo" description:"商户订单号"`
|
||||
TransactionId string `json:"transactionId" description:"交易号"`
|
||||
PayAt *gtime.Time `json:"payAt" description:"支付时间"`
|
||||
ActualAmount float64 `json:"actualAmount" description:"实付金额"`
|
||||
}
|
||||
|
||||
// NotifyCallFuncInp 异步通知回调,用于异步通知验签通过后回调到具体的业务中
|
||||
type NotifyCallFuncInp struct {
|
||||
Pay *entity.PayLog
|
||||
}
|
||||
|
||||
// RefundInp 统一退款处理入口
|
||||
type RefundInp struct {
|
||||
Pay *entity.PayLog
|
||||
RefundMoney float64 `json:"refundMoney" dc:"退款金额"`
|
||||
RefundSn string `json:"refundSn" dc:"退款单号"`
|
||||
Reason string `json:"reason" dc:"申请退款原因"`
|
||||
Remark string `json:"remark" dc:"退款备注"`
|
||||
}
|
||||
|
||||
type RefundModel struct {
|
||||
}
|
||||
199
server/internal/model/input/payin/pay.go
Normal file
199
server/internal/model/input/payin/pay.go
Normal file
@@ -0,0 +1,199 @@
|
||||
// Package payin
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package payin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/form"
|
||||
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// PayNotifyInp 异步通知
|
||||
type PayNotifyInp struct {
|
||||
PayType string `json:"payType" description:"支付类型"`
|
||||
}
|
||||
|
||||
type PayNotifyModel struct {
|
||||
PayType string `json:"payType" description:"支付类型"`
|
||||
Code string `json:"code" description:"状态码"`
|
||||
Message string `json:"message" description:"响应文本消息"`
|
||||
}
|
||||
|
||||
type PayNotifyUpdate struct {
|
||||
TransactionId string `json:"transactionId" description:"交易号"`
|
||||
PayStatus int `json:"payStatus" description:"支付状态"`
|
||||
PayAt *gtime.Time `json:"payAt" description:"支付时间"`
|
||||
PayIp string `json:"payIp" description:"支付者ip"`
|
||||
TraceIds *gjson.Json `json:"traceIds" description:"链路id集合"`
|
||||
}
|
||||
|
||||
// PayCreateInp 创建支付订单和日志
|
||||
type PayCreateInp struct {
|
||||
Subject string `json:"subject" description:"订单标题"`
|
||||
Detail *gjson.Json `json:"detail" description:"支付商品详情"`
|
||||
OrderSn string `json:"orderSn" description:"关联订单号"`
|
||||
OrderGroup string `json:"orderGroup" description:"组别[默认统一支付类型]"`
|
||||
Openid string `json:"openid" description:"openid"`
|
||||
PayType string `json:"payType" description:"支付类型"`
|
||||
TradeType string `json:"tradeType" description:"交易类型"`
|
||||
PayAmount float64 `json:"payAmount" description:"支付金额"`
|
||||
ReturnUrl string `json:"returnUrl" description:"买家付款成功跳转地址"`
|
||||
}
|
||||
|
||||
type PayCreateModel struct {
|
||||
Order *CreateOrderModel
|
||||
}
|
||||
|
||||
// PayEditInp 修改/新增支付日志
|
||||
type PayEditInp struct {
|
||||
entity.PayLog
|
||||
}
|
||||
|
||||
func (in *PayEditInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type PayEditModel struct{}
|
||||
|
||||
// PayDeleteInp 删除支付日志
|
||||
type PayDeleteInp struct {
|
||||
Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"`
|
||||
}
|
||||
|
||||
func (in *PayDeleteInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type PayDeleteModel struct{}
|
||||
|
||||
// PayViewInp 获取指定支付日志信息
|
||||
type PayViewInp struct {
|
||||
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
|
||||
}
|
||||
|
||||
func (in *PayViewInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type PayViewModel struct {
|
||||
entity.PayLog
|
||||
}
|
||||
|
||||
// PayListInp 获取支付日志列表
|
||||
type PayListInp struct {
|
||||
form.PageReq
|
||||
Id int64 `json:"id" dc:"ID"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
TestCategoryName string `json:"testCategoryName" dc:"分类名称"`
|
||||
}
|
||||
|
||||
func (in *PayListInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type PayListModel struct {
|
||||
Id int64 `json:"id" description:"主键"`
|
||||
MemberId uint64 `json:"memberId" description:"用户id"`
|
||||
AppId string `json:"appId" description:"应用id"`
|
||||
AddonsName string `json:"addonsName" description:"插件名称"`
|
||||
OrderSn string `json:"orderSn" description:"关联订单号"`
|
||||
OrderGroup string `json:"orderGroup" description:"组别[默认统一支付类型]"`
|
||||
Openid string `json:"openid" description:"openid"`
|
||||
MchId string `json:"mchId" description:"商户支付账户"`
|
||||
Body string `json:"body" description:"创建支付报文"`
|
||||
AuthCode string `json:"authCode" description:"刷卡码"`
|
||||
OutTradeNo string `json:"outTradeNo" description:"商户订单号"`
|
||||
TransactionId string `json:"transactionId" description:"交易号"`
|
||||
PayType int `json:"payType" description:"支付类型"`
|
||||
PayFee float64 `json:"payFee" description:"支付金额"`
|
||||
PayStatus int `json:"payStatus" description:"支付状态"`
|
||||
PayAt *gtime.Time `json:"payAt" description:"支付时间"`
|
||||
TradeType string `json:"tradeType" description:"交易类型"`
|
||||
RefundSn string `json:"refundSn" description:"退款编号"`
|
||||
RefundFee float64 `json:"refundFee" description:"退款金额"`
|
||||
RefundRemark string `json:"refundRemark" description:"退款备注"`
|
||||
IsRefund int `json:"isRefund" description:"是否退款"`
|
||||
CreateIp string `json:"createIp" description:"创建者ip"`
|
||||
PayIp string `json:"payIp" description:"支付者ip"`
|
||||
NotifyUrl string `json:"notifyUrl" description:"支付通知回调地址"`
|
||||
ReturnUrl string `json:"returnUrl" description:"买家付款成功跳转地址"`
|
||||
TraceIds *gjson.Json `json:"traceIds" description:"链路id集合"`
|
||||
Status int `json:"status" description:"状态"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
|
||||
}
|
||||
|
||||
// PayExportModel 导出支付日志
|
||||
type PayExportModel struct {
|
||||
Id int64 `json:"id" description:"主键"`
|
||||
MemberId uint64 `json:"memberId" description:"用户id"`
|
||||
AppId string `json:"appId" description:"应用id"`
|
||||
AddonsName string `json:"addonsName" description:"插件名称"`
|
||||
OrderSn string `json:"orderSn" description:"关联订单号"`
|
||||
OrderGroup string `json:"orderGroup" description:"组别[默认统一支付类型]"`
|
||||
Openid string `json:"openid" description:"openid"`
|
||||
MchId string `json:"mchId" description:"商户支付账户"`
|
||||
Body string `json:"body" description:"创建支付报文"`
|
||||
AuthCode string `json:"authCode" description:"刷卡码"`
|
||||
OutTradeNo string `json:"outTradeNo" description:"商户订单号"`
|
||||
TransactionId string `json:"transactionId" description:"交易号"`
|
||||
PayType int `json:"payType" description:"支付类型"`
|
||||
PayFee float64 `json:"payFee" description:"支付金额"`
|
||||
PayStatus int `json:"payStatus" description:"支付状态"`
|
||||
PayAt *gtime.Time `json:"payAt" description:"支付时间"`
|
||||
TradeType string `json:"tradeType" description:"交易类型"`
|
||||
RefundSn string `json:"refundSn" description:"退款编号"`
|
||||
RefundFee float64 `json:"refundFee" description:"退款金额"`
|
||||
RefundRemark string `json:"refundRemark" description:"退款备注"`
|
||||
IsRefund int `json:"isRefund" description:"是否退款"`
|
||||
CreateIp string `json:"createIp" description:"创建者ip"`
|
||||
PayIp string `json:"payIp" description:"支付者ip"`
|
||||
NotifyUrl string `json:"notifyUrl" description:"支付通知回调地址"`
|
||||
ReturnUrl string `json:"returnUrl" description:"买家付款成功跳转地址"`
|
||||
TraceIds *gjson.Json `json:"traceIds" description:"链路id集合"`
|
||||
Status int `json:"status" description:"状态"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
|
||||
}
|
||||
|
||||
// PayMaxSortInp 获取支付日志最大排序
|
||||
type PayMaxSortInp struct{}
|
||||
|
||||
func (in *PayMaxSortInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type PayMaxSortModel struct {
|
||||
Sort int `json:"sort" description:"排序"`
|
||||
}
|
||||
|
||||
// PayStatusInp 更新支付日志状态
|
||||
type PayStatusInp struct {
|
||||
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
}
|
||||
|
||||
func (in *PayStatusInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type PayStatusModel struct{}
|
||||
|
||||
// PaySwitchInp 更新支付日志开关状态
|
||||
type PaySwitchInp struct {
|
||||
form.SwitchReq
|
||||
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
|
||||
}
|
||||
|
||||
func (in *PaySwitchInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type PaySwitchModel struct{}
|
||||
59
server/internal/model/input/payin/refund.go
Normal file
59
server/internal/model/input/payin/refund.go
Normal file
@@ -0,0 +1,59 @@
|
||||
// Package payin
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.5.3
|
||||
// @AutoGenerate Date 2023-04-15 15:59:58
|
||||
package payin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/form"
|
||||
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// PayRefundInp 订单退款
|
||||
type PayRefundInp struct {
|
||||
OrderSn string `json:"orderSn" dc:"业务订单号"`
|
||||
RefundMoney float64 `json:"refundMoney" dc:"退款金额"`
|
||||
Reason string `json:"reason" dc:"申请退款原因"`
|
||||
Remark string `json:"remark" dc:"退款备注"`
|
||||
}
|
||||
|
||||
func (in *PayRefundInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type PayRefundModel struct {
|
||||
entity.PayRefund
|
||||
}
|
||||
|
||||
// PayRefundListInp 获取资产变动列表
|
||||
type PayRefundListInp struct {
|
||||
form.PageReq
|
||||
Id int64 `json:"id" dc:"变动ID"`
|
||||
MemberId int64 `json:"memberId" dc:"管理员ID"`
|
||||
AppId string `json:"appId" dc:"应用id"`
|
||||
CreditType string `json:"creditType" dc:"变动类型"`
|
||||
CreditGroup string `json:"creditGroup" dc:"变动的组别"`
|
||||
Remark string `json:"remark" dc:"备注"`
|
||||
Ip string `json:"ip" dc:"操作人IP"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
}
|
||||
|
||||
func (in *PayRefundListInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type PayRefundListModel struct {
|
||||
entity.PayRefund
|
||||
}
|
||||
|
||||
// PayRefundExportModel 导出资产变动
|
||||
type PayRefundExportModel struct {
|
||||
entity.PayRefund
|
||||
}
|
||||
Reference in New Issue
Block a user