60 lines
1.8 KiB
Go
60 lines
1.8 KiB
Go
package front
|
|
|
|
import "PaymentCenter/app/models/ordersmodel"
|
|
|
|
type ApiCommonBody struct {
|
|
AppId int64 `json:"app_id" validate:"required"`
|
|
Timestamp int64 `json:"timestamp" validate:"required"`
|
|
}
|
|
|
|
type RequestBody struct {
|
|
AppId int64 `json:"app_id" validate:"required"`
|
|
Timestamp int64 `json:"timestamp" validate:"required"`
|
|
Data string `json:"data" validate:"required"`
|
|
}
|
|
|
|
type PayReqs struct {
|
|
ApiCommonBody
|
|
PayChannelId int64 `json:"pay_channel_id" validate:"required" label:"支付渠道"`
|
|
OutTradeNo string `json:"out_trade_no" validate:"required" label:"外侧商户订单号"`
|
|
OrderType int `json:"order_type" validate:"required" label:"订单类型,支付,退款"`
|
|
Amount int `json:"amount" validate:"required" label:"支付金额,单位分"`
|
|
ExtJson string `json:"ext_json" label:"扩展参数"`
|
|
Desc string `json:"desc" validate:"max=100" label:"商品描述"`
|
|
}
|
|
|
|
type OrderApiResp struct {
|
|
Code int
|
|
Msg string
|
|
Data interface{}
|
|
}
|
|
|
|
type QueryReqs struct {
|
|
ApiCommonBody
|
|
OutTradeNo string `json:"out_trade_no" validate:"required" label:"外侧商户订单号"`
|
|
}
|
|
|
|
type OrdersResponse struct {
|
|
Id int64 `json:"id"`
|
|
PayChannelId int64 `json:"pay_channel_id"`
|
|
AppId int64 `json:"app_id"`
|
|
OutTreadNo string `json:"out_tread_no"`
|
|
Status int `json:"status"`
|
|
OrderType int `json:"order_type"`
|
|
Amount int `json:"amount"`
|
|
PayerTotal int `json:"payer_total"`
|
|
CreateTime string `json:"create_time"`
|
|
}
|
|
|
|
func (o *OrdersResponse) ResponseFromDb(db ordersmodel.Orders) {
|
|
o.Id = db.Id
|
|
o.PayChannelId = db.PayChannelId
|
|
o.AppId = db.AppId
|
|
o.OutTreadNo = db.OutTreadNo
|
|
o.Status = db.Status
|
|
o.OrderType = db.OrderType
|
|
o.Amount = db.Amount
|
|
o.PayerTotal = db.PayerTotal
|
|
o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05")
|
|
}
|