diff --git a/app/http/entities/front/Order.go b/app/http/entities/front/Order.go index fff49e3..f3209ea 100644 --- a/app/http/entities/front/Order.go +++ b/app/http/entities/front/Order.go @@ -72,10 +72,12 @@ type OrderQueryResponse struct { State int `json:"state"` VoucherLink string `json:"voucher_link"` CreateTime string `json:"create_time"` + NotifyUrl string `json:"notify_url"` } 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") if l.VoucherLink != "" { p.VoucherLink = string(encrypt.AesDecryptCBC(l.VoucherLink, []byte(config.GetConf().OpenApiMarketConfig.SecretKey))) diff --git a/app/services/OrderService.go b/app/services/OrderService.go index e49b05b..dbc7cdc 100644 --- a/app/services/OrderService.go +++ b/app/services/OrderService.go @@ -82,8 +82,8 @@ func CreateOrderService(userId int, productId int) (code int, data front.InsertO rs, err := session.Exec("update Products set stock = stock-1 where stock >= 1 and id = ?", product.Id) var affect, _ = rs.RowsAffected() if err != nil || affect < 1 { - return errorcode.ProductStockFAIL, data session.Rollback() + return errorcode.ProductStockFAIL, data } else { _ = session.Commit() }