新增订单轮询
This commit is contained in:
parent
6c9f3f3e6e
commit
64c0373eba
|
@ -79,7 +79,7 @@ func CreateOrderService(userId int, productId int) (code int, data front.InsertO
|
||||||
utils.Log(nil, "CreateOrderService", err.Error())
|
utils.Log(nil, "CreateOrderService", err.Error())
|
||||||
return errorcode.SystemError, data
|
return errorcode.SystemError, data
|
||||||
} else {
|
} else {
|
||||||
rs, err := session.Exec("update Products set stock = stock-1 where stock >= 1 and id = ?", product.Id)
|
rs, err := session.Exec("update products set stock = stock-1 where stock >= 1 and id = ?", product.Id)
|
||||||
var affect, _ = rs.RowsAffected()
|
var affect, _ = rs.RowsAffected()
|
||||||
if err != nil || affect < 1 {
|
if err != nil || affect < 1 {
|
||||||
session.Rollback()
|
session.Rollback()
|
||||||
|
|
Loading…
Reference in New Issue