diff --git a/app/http/entities/front/Order.go b/app/http/entities/front/Order.go index f3209ea..3077892 100644 --- a/app/http/entities/front/Order.go +++ b/app/http/entities/front/Order.go @@ -5,6 +5,7 @@ import ( "qteam/app/utils" "qteam/app/utils/encrypt" "qteam/config" + "time" ) type OrderCreateRequest struct { @@ -22,24 +23,26 @@ type OrderListRequest struct { } type OrderListResponse struct { - Id int `json:"id"` - OrderNo string `json:"order_no"` - MainImage string `json:"main_image"` - UserId int `json:"user_id"` - CustNo string `json:"custNo"` - Price string `json:"price"` - ProductId int `json:"product_id"` - ProductName string `json:"product_name"` - State int `json:"state"` - VoucherLink string `json:"voucher_link"` - CreateTime string `json:"create_time"` - NotifyUrl string `json:"notify_url"` + Id int `json:"id"` + OrderNo string `json:"order_no"` + MainImage string `json:"main_image"` + UserId int `json:"user_id"` + CustNo string `json:"custNo"` + Price string `json:"price"` + ProductId int `json:"product_id"` + ProductName string `json:"product_name"` + State int `json:"state"` + VoucherLink string `json:"voucher_link"` + CreateTime string `json:"create_time"` + NotifyUrl string `json:"notify_url"` + ExchangeTime string `json:"exchange_time"` } func (p *OrderListResponse) ResponseFromDb(l ordersmodel.OrdersProductsList) { p.Id = l.Id p.OrderNo = l.OrderNo p.MainImage = l.MainImage + p.ExchangeTime = l.ExchangeTime.Format(time.DateTime) p.UserId = l.UserId p.CustNo = l.CustNo p.Price = l.Price @@ -60,25 +63,27 @@ func (p *OrderListResponse) ResponseFromDb(l ordersmodel.OrdersProductsList) { } type OrderQueryResponse struct { - Id int `json:"id"` - OrderNo string `json:"order_no"` - UserId int `json:"user_id"` - UserName string `json:"user_name"` - Price string `json:"price"` - MainImage string `json:"main_image"` - Mobile string `json:"mobile"` - ProductId int `json:"product_id"` - ProductName string `json:"product_name"` - State int `json:"state"` - VoucherLink string `json:"voucher_link"` - CreateTime string `json:"create_time"` - NotifyUrl string `json:"notify_url"` + Id int `json:"id"` + OrderNo string `json:"order_no"` + UserId int `json:"user_id"` + UserName string `json:"user_name"` + Price string `json:"price"` + MainImage string `json:"main_image"` + Mobile string `json:"mobile"` + ProductId int `json:"product_id"` + ProductName string `json:"product_name"` + State int `json:"state"` + VoucherLink string `json:"voucher_link"` + CreateTime string `json:"create_time"` + NotifyUrl string `json:"notify_url"` + ExchangeTime string `json:"exchange_time"` } func (p *OrderQueryResponse) ResponseFromDb(l ordersmodel.Orders) { utils.EntityCopy(p, &l) p.NotifyUrl = config.GetConf().YouChu.NotifyUrl p.CreateTime = l.CreateTime.Format("2006-01-02 15:04:05") + p.ExchangeTime = l.ExchangeTime.Format(time.DateTime) if l.VoucherLink != "" { p.VoucherLink = string(encrypt.AesDecryptCBC(l.VoucherLink, []byte(config.GetConf().OpenApiMarketConfig.SecretKey))) }