增加品牌

This commit is contained in:
qiyunfanbo126.com 2024-10-18 10:57:16 +08:00
parent 9ceae39971
commit 1836b09bcd
2 changed files with 13 additions and 0 deletions

View File

@ -37,6 +37,8 @@ func OrderList(c *gin.Context) {
if count > 0 {
linq.From(orderList).SelectT(func(in ordersmodel.OrdersProductsList) (out front.OrderListResponse) {
out.ResponseFromDb(in)
out.PlainText = config.GetConf().YouChu.MchtNo + "|" + out.OrderNo + "|" + out.Price
out.Sign = utils.HmacSha256To16(config.GetConf().YouChu.Sha, out.PlainText)
return out
}).ToSlice(&rsp)
}
@ -50,6 +52,11 @@ func OrderQuery(c *gin.Context) {
order.Id = orderId
order.OrderNo = request.OrderNo
order.UserId = controllers.GetUserId(c)
if request.OrderId == "" || request.OrderNo == "" {
utils.Log(nil, "err", "参数不正确")
controllers.Error(c, 500, "订单查询失败")
return
}
var OrderQueryResponse front.OrderQueryResponse
has, err := services.OrderDetailService(&order)
if err != nil {
@ -71,6 +78,8 @@ func OrderQuery(c *gin.Context) {
}
OrderQueryResponse.ResponseFromDb(order)
OrderQueryResponse.MainImage = services.GetProductImage(order.ProductId)
OrderQueryResponse.PlainText = config.GetConf().YouChu.MchtNo + "|" + order.OrderNo + "|" + order.Price
OrderQueryResponse.Sign = utils.HmacSha256To16(config.GetConf().YouChu.Sha, OrderQueryResponse.PlainText)
controllers.Success(c, OrderQueryResponse, "请求成功")
} else {
controllers.HandCodeRes(c, nil, errorcode.NotFound)

View File

@ -37,6 +37,8 @@ type OrderListResponse struct {
NotifyUrl string `json:"notify_url"`
ExchangeTime string `json:"exchange_time"`
Brand string `json:"brand"`
Sign string `json:"sign"`
PlainText string `json:"plain_text"`
}
func (p *OrderListResponse) ResponseFromDb(l ordersmodel.OrdersProductsList) {
@ -81,6 +83,8 @@ type OrderQueryResponse struct {
NotifyUrl string `json:"notify_url"`
ExchangeTime string `json:"exchange_time"`
Brand string `json:"brand"`
Sign string `json:"sign"`
PlainText string `json:"plain_text"`
}
func (p *OrderQueryResponse) ResponseFromDb(l ordersmodel.OrdersProductsList) {