package backend import ( "PaymentCenter/app/http/entities" "PaymentCenter/app/models/ordercallbacklogmodel" "PaymentCenter/app/models/orderrequestlogmodel" "PaymentCenter/app/models/ordersmodel" "PaymentCenter/app/models/orderthirdpaylogmodel" "PaymentCenter/app/utils" "github.com/pkg/errors" "time" ) type OrderListRequest struct { Id int64 `json:"id" form:"id"` MerchantId int64 `json:"merchant_id" form:"merchant_id"` PayChannelId int64 `json:"pay_channel_id" form:"pay_channel_id"` AppId int64 `json:"app_id" form:"app_id"` OutTradeNo string `json:"out_trade_no" form:"out_trade_no"` Status int `json:"status" form:"status"` OrderType int `json:"order_type" form:"order_type"` StartTime string `json:"start_time" form:"start_time"` EndTime string `json:"end_time" form:"end_time"` entities.PageRequest } type OrderList struct { Id int64 `json:"id"` MerchantId int64 `json:"merchant_id"` PayChannelId int64 `json:"pay_channel_id"` AppId int64 `json:"app_id"` OutTradeNo string `json:"out_trade_no"` Status int `json:"status"` OrderType int `json:"order_type"` StartTime time.Time `json:"start_time"` EndTime time.Time `json:"end_time"` entities.PageRequest } func (o *OrderListRequest) ValidateRequest() (r OrderList, err error) { if o.StartTime != "" { r.StartTime, err = utils.StrToTimeShanghai(o.StartTime) if err != nil { err = errors.Wrap(err, "时间格式错误") return } } if o.EndTime != "" { r.EndTime, err = utils.StrToTimeShanghai(o.EndTime) if err != nil { err = errors.Wrap(err, "时间格式错误") return } } r.Id = o.Id r.MerchantId = o.MerchantId r.PayChannelId = o.PayChannelId r.AppId = o.AppId r.OutTradeNo = o.OutTradeNo r.Status = o.Status r.OrderType = o.OrderType r.PageRequest = o.PageRequest r.SetDefault() return } type OrdersResponse struct { Id int64 `json:"id"` MerchantId int64 `json:"merchant_id"` PayChannelId int64 `json:"pay_channel_id"` AppId int64 `json:"app_id"` OutTradeNo string `json:"out_trade_no"` Status int `json:"status"` OrderType int `json:"order_type"` Amount int `json:"amount"` PayerTotal int `json:"payer_total"` ExtJson string `json:"ext_json"` CreateTime string `json:"create_time"` UpdateTime string `json:"update_time"` MerchantName string `json:"merchant_name"` PayName string `json:"pay_name"` AppName string `json:"app_name"` } func (o *OrdersResponse) ResponseFromDb(db ordersmodel.OrdersBackendList) { o.Id = db.Id o.MerchantId = db.MerchantId o.PayChannelId = db.PayChannelId o.AppId = db.AppId o.OutTradeNo = db.OutTradeNo o.Status = db.Status o.OrderType = db.OrderType o.Amount = db.Amount o.PayerTotal = db.PayerTotal o.ExtJson = db.ExtJson o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") o.UpdateTime = db.UpdateTime.Format("2006-01-02 15:04:05") o.MerchantName = db.MerchantName o.PayName = db.PayName o.AppName = db.AppName } type OrderLogsListRequest struct { OrderId int64 `json:"order_id" form:"order_id"` entities.PageRequest } type OrderRequestLogResponse struct { Id int64 `json:"id"` AppId int64 `json:"app_id"` OutTradeNo string `json:"out_trade_no"` IpAddress string `json:"ip_address"` Url string `json:"url"` MerchantRequest string `json:"merchant_request"` MerchantResponse string `json:"merchant_response"` CreateTime string `json:"create_time"` Status int `json:"status"` } func (o *OrderRequestLogResponse) ResponseFromDb(db orderrequestlogmodel.OrderRequestLog) { o.Id = db.Id o.AppId = db.AppId o.OutTradeNo = db.OutTradeNo o.IpAddress = db.IpAddress o.Url = db.URL o.Status = db.Status o.MerchantRequest = db.MerchantRequest o.MerchantResponse = db.MerchantResponse o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") } type OrderThirdLogResponse struct { Id int64 `json:"id"` OrderId int64 `json:"order_id"` CreateTime string `json:"create_time"` PayCallback string `json:"pay_callback"` Status int `json:"status"` PayParam string `json:"pay_param"` MerchantCallback string `json:"merchant_callback"` } func (o *OrderThirdLogResponse) ResponseFromDb(db orderthirdpaylogmodel.OrderThirdPayLog) { o.Id = db.Id o.OrderId = db.OrderId o.PayCallback = db.PayCallback o.Status = db.Status o.PayParam = db.PayParam o.MerchantCallback = db.MerchantCallback o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") } type OrderCallbackLogResponse struct { Id int64 `json:"id"` OrderId int64 `json:"order_id"` MerchantRequest string `json:"merchant_request"` Status int `json:"status"` MerchantResponse string `json:"merchant_response"` CreateTime string `json:"create_time"` } func (o *OrderCallbackLogResponse) ResponseFromDb(db ordercallbacklogmodel.OrderCallbackLog) { o.Id = db.Id o.OrderId = db.OrderId o.MerchantRequest = db.MerchantRequest o.Status = db.Status o.MerchantResponse = db.MerchantResponse o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") }