|
|
@@ -423,25 +423,25 @@ func CreateOrderNotify(order *order_model.Order, product *product_model.Product)
|
|
|
}
|
|
|
|
|
|
//获取库存不足商品
|
|
|
-func FindNotEnoughPrd(storeMap map[int64]int64) (bool, string) {
|
|
|
+func FindNotEnoughPrd(buyList map[int64]int64) (bool, string) {
|
|
|
|
|
|
//判断商品库存
|
|
|
- for pId, nums := range storeMap {
|
|
|
+ for pId, nums := range buyList {
|
|
|
product := product_model.GetProductById(pId, true)
|
|
|
if product.Package {
|
|
|
beego.BeeLogger.Error("product id %d", product.Id)
|
|
|
packageList := product_model.GetPackageList(pId, true)
|
|
|
for _, one := range packageList {
|
|
|
- if _, ok := storeMap[one.ItemId]; ok {
|
|
|
+ if _, ok := buyList[one.ItemId]; ok {
|
|
|
//基本商品存在
|
|
|
- storeMap[one.ItemId] = storeMap[one.ItemId] + nums*one.Nums
|
|
|
+ buyList[one.ItemId] = buyList[one.ItemId] + nums*one.Nums
|
|
|
} else {
|
|
|
- storeMap[one.ItemId] = nums * one.Nums
|
|
|
+ buyList[one.ItemId] = nums * one.Nums
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- for r_pid, r_nums := range storeMap {
|
|
|
+ for r_pid, r_nums := range buyList {
|
|
|
product := product_model.GetProductById(r_pid, true)
|
|
|
if product.Count > int64(0) && product.Count < r_nums {
|
|
|
return true, product.Name
|