订单详情增加notifyurl
This commit is contained in:
parent
d43949a246
commit
235f8f70d3
|
@ -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)))
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue