package front import ( "qteam/app/models/ordersmodel" "qteam/app/utils" ) type OrderCreateRequest struct { ProductId int `form:"product_id" validate:"required"` } type OrderQueryRequest struct { OrderId string `form:"order_id" validate:"required"` } type OrderListRequest struct { PageRequest State int `form:"state"` } type OrderListResponse struct { Id int `json:"id"` OrderNo string `json:"order_no"` MainImage string `json:"main_image"` UserId int `json:"user_id"` UserName string `json:"user_name"` 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"` } func (p *OrderListResponse) ResponseFromDb(l ordersmodel.OrdersProductsList) { p.Id = l.Id p.OrderNo = l.OrderNo p.MainImage = l.MainImage p.UserId = l.UserId p.UserName = l.UserName p.Mobile = l.Mobile p.ProductId = l.ProductId p.ProductName = l.ProductName p.State = l.State p.VoucherLink = l.VoucherLink p.CreateTime = l.CreateTime.Format("2006-01-02 15:04:05") return } type OrderQueryResponse struct { Id int `json:"id"` OrderNo string `json:"order_no"` UserId int `json:"user_id"` UserName string `json:"user_name"` 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"` } func (p *OrderQueryResponse) ResponseFromDb(l ordersmodel.Orders) { utils.EntityCopy(p, &l) p.CreateTime = l.CreateTime.Format("2006-01-02 15:04:05") return } type OrdersUpdateRequest struct { Id int `json:"id" validate:"required" form:"id" validate:"required" example:"1"` Status int `json:"status" form:"status" validate:"oneof=1 2 3 4" example:"1"` // '状态(1/待支付,2/已支付,3/已完成4/取消5作废)' VoucherLink string `json:"voucher_link"` }