48 lines
939 B
Go
48 lines
939 B
Go
package api
|
|
|
|
import (
|
|
"PaymentCenter/app/models/ordersmodel"
|
|
)
|
|
|
|
type OrdersResp struct {
|
|
OrderNo int64 `json:"order_no"`
|
|
OrderType int `json:"order_type"`
|
|
OutTreadNo string `json:"out_tread_no"`
|
|
Amount int `json:"amount"`
|
|
Desc string `json:"desc"`
|
|
|
|
Status int `json:"status"`
|
|
CreateTime string `json:"create_time"`
|
|
}
|
|
|
|
type OrdersWithUrl struct {
|
|
Order *OrdersResp
|
|
Url string
|
|
}
|
|
|
|
func NewOrdersResp(db *ordersmodel.Orders) *OrdersResp {
|
|
return &OrdersResp{
|
|
OrderNo: db.Id,
|
|
OutTreadNo: db.OutTreadNo,
|
|
Status: db.Status,
|
|
OrderType: db.OrderType,
|
|
Amount: db.Amount,
|
|
Desc: db.Desc,
|
|
CreateTime: db.CreateTime.Format("2006-01-02 15:04:05"),
|
|
}
|
|
}
|
|
|
|
func (o *OrdersResp) WithUrl(url string) *OrdersWithUrl {
|
|
return &OrdersWithUrl{
|
|
Order: o,
|
|
Url: url,
|
|
}
|
|
}
|
|
|
|
func (o *OrdersResp) WithAes(url string) *OrdersWithUrl {
|
|
return &OrdersWithUrl{
|
|
Order: o,
|
|
Url: url,
|
|
}
|
|
}
|