订单详情增加notifyurl

This commit is contained in:
qiyunfanbo126.com 2024-07-18 09:34:11 +08:00
parent d43949a246
commit 235f8f70d3
2 changed files with 3 additions and 1 deletions

View File

@ -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)))

View File

@ -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()
}