2024-06-19 18:32:34 +08:00
|
|
|
package front
|
|
|
|
|
|
|
|
import (
|
|
|
|
"qteam/app/models/ordersmodel"
|
|
|
|
"qteam/app/utils"
|
2024-06-27 17:46:36 +08:00
|
|
|
"qteam/app/utils/encrypt"
|
|
|
|
"qteam/config"
|
2024-06-19 18:32:34 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
type OrderCreateRequest struct {
|
|
|
|
ProductId int `form:"product_id" validate:"required"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type OrderQueryRequest struct {
|
2024-06-27 11:01:49 +08:00
|
|
|
OrderId string `form:"order_id"`
|
|
|
|
OrderNo string `form:"order_no"`
|
2024-06-19 18:32:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type OrderListRequest struct {
|
|
|
|
PageRequest
|
2024-06-24 11:44:38 +08:00
|
|
|
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"`
|
2024-06-25 10:12:48 +08:00
|
|
|
CustNo string `json:"custNo"`
|
2024-06-27 18:36:01 +08:00
|
|
|
Price string `json:"price"`
|
2024-06-24 11:44:38 +08:00
|
|
|
ProductId int `json:"product_id"`
|
|
|
|
ProductName string `json:"product_name"`
|
|
|
|
State int `json:"state"`
|
|
|
|
VoucherLink string `json:"voucher_link"`
|
|
|
|
CreateTime string `json:"create_time"`
|
2024-07-10 14:03:09 +08:00
|
|
|
NotifyUrl string `json:"notify_url"`
|
2024-06-24 11:44:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *OrderListResponse) ResponseFromDb(l ordersmodel.OrdersProductsList) {
|
|
|
|
p.Id = l.Id
|
|
|
|
p.OrderNo = l.OrderNo
|
|
|
|
p.MainImage = l.MainImage
|
|
|
|
p.UserId = l.UserId
|
2024-06-25 10:12:48 +08:00
|
|
|
p.CustNo = l.CustNo
|
2024-06-27 18:36:01 +08:00
|
|
|
p.Price = l.Price
|
2024-06-24 11:44:38 +08:00
|
|
|
p.ProductId = l.ProductId
|
|
|
|
p.ProductName = l.ProductName
|
|
|
|
p.State = l.State
|
2024-07-10 14:03:09 +08:00
|
|
|
p.NotifyUrl = config.GetConf().YouChu.NotifyUrl
|
2024-06-27 17:46:36 +08:00
|
|
|
if l.VoucherLink != "" {
|
|
|
|
p.VoucherLink = string(encrypt.AesDecryptCBC(l.VoucherLink, []byte(config.GetConf().OpenApiMarketConfig.SecretKey)))
|
|
|
|
}
|
2024-06-24 11:44:38 +08:00
|
|
|
p.CreateTime = l.CreateTime.Format("2006-01-02 15:04:05")
|
|
|
|
return
|
2024-06-19 18:32:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type OrderQueryResponse struct {
|
|
|
|
Id int `json:"id"`
|
|
|
|
OrderNo string `json:"order_no"`
|
|
|
|
UserId int `json:"user_id"`
|
|
|
|
UserName string `json:"user_name"`
|
2024-06-27 18:36:01 +08:00
|
|
|
Price string `json:"price"`
|
|
|
|
MainImage string `json:"main_image"`
|
2024-06-19 18:32:34 +08:00
|
|
|
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")
|
2024-07-03 18:30:53 +08:00
|
|
|
if l.VoucherLink != "" {
|
|
|
|
p.VoucherLink = string(encrypt.AesDecryptCBC(l.VoucherLink, []byte(config.GetConf().OpenApiMarketConfig.SecretKey)))
|
|
|
|
}
|
2024-06-19 18:32:34 +08:00
|
|
|
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"`
|
2024-06-27 15:56:47 +08:00
|
|
|
OrgTxnSeq string `json:"orgTxnSeq"`
|
2024-06-19 18:32:34 +08:00
|
|
|
}
|