瀏覽代碼

1.修改商品

master
huangjiajun 6 月之前
父節點
當前提交
0677909df5
共有 1 個檔案被更改,包括 3 行新增3 行删除
  1. +3
    -3
      app/admin/svc/order/svc_order_list.go

+ 3
- 3
app/admin/svc/order/svc_order_list.go 查看文件

@@ -725,21 +725,21 @@ func OrderEditNum(c *gin.Context) {
return
}
num = orderGoods.Num - utils.StrToInt(args["num"])
all.WaitBakingNum -= orderGoods.Num
all.WaitMakeNum -= orderGoods.Num
order.Amount = utils.Float64ToStr(utils.StrToFloat64(order.Amount) - float64(num)*utils.StrToFloat64(orderGoods.Price))
//销量扣除
sqlSecond := `UPDATE goods SET sale=sale-%d WHERE id=%d`
sqlSecond = fmt.Sprintf(sqlSecond, num, orderGoods.GoodsId)
db.QueryNativeStringSess(sess, sqlSecond)
} else {
all.WaitBakingNum += orderGoods.Num
all.WaitMakeNum += orderGoods.Num
order.Amount = utils.Float64ToStr(utils.StrToFloat64(order.Amount) + float64(num)*utils.StrToFloat64(orderGoods.Price))
//销量增加
sqlSecond := `UPDATE goods SET sale=sale+%d WHERE id=%d`
sqlSecond = fmt.Sprintf(sqlSecond, num, orderGoods.GoodsId)
db.QueryNativeStringSess(sess, sqlSecond)
}
_, err := sess.Where("id=?", all.Id).Cols("wait_baking_num").Update(all)
_, err := sess.Where("id=?", all.Id).Cols("wait_make_num").Update(all)
if err != nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "修改失败"))


Loading…
取消
儲存