Переглянути джерело

update pay order product store rules

abiao 4 роки тому
батько
коміт
e3ff613346

+ 3 - 4
go/gopath/src/fohow.com/apps/controllers/pay_controller/pay_exchange_controller.go

@@ -113,13 +113,13 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
 		SaleNumsMap[product.Id] = item.Count
 		storeMap[product.Id] = item.Count
 	}
-	beego.BeeLogger.Error("SaleNumsMap1 %v", SaleNumsMap)
+	//beego.BeeLogger.Error("SaleNumsMap1 %v", SaleNumsMap)
 
 	resultStore, prdName := FindNotEnoughPrd(storeMap)
 	if resultStore {
 		self.ReturnError(403, []string{apps.ProductStockNotEnough[0], fmt.Sprintf("%s商品库存不足", prdName)}, "", nil)
 	}
-	beego.BeeLogger.Error("SaleNumsMap2 %v", SaleNumsMap)
+	//beego.BeeLogger.Error("SaleNumsMap2 %v", SaleNumsMap)
 
 	//第一次支付已更新支付方式,第一次支付才计算支付金额
 	if len(order.PayWay) <= 0 {
@@ -349,7 +349,6 @@ func (self *PayController) payCentExchange(oId, returnUrl, source, remark string
 	if resultStore {
 		self.ReturnError(403, []string{apps.ProductStockNotEnough[0], fmt.Sprintf("%s商品库存不足", prdName)}, "", nil)
 	}
-	beego.BeeLogger.Error("SaleNumsMap %v", SaleNumsMap)
 	order.Remark = remark
 	order.PayWay = order_model.PAY_WAY_CENT
 	order.Contact = address.Contact
@@ -431,7 +430,7 @@ func FindNotEnoughPrd(storeMap map[int64]int64) (bool, string) {
 	for pId, nums := range storeMap {
 		product := product_model.GetProductById(pId, true)
 		if product.Package {
-			beego.BeeLogger.Error("product id %d", product.Id)
+			//beego.BeeLogger.Error("product id %d", product.Id)
 			packageList := product_model.GetPackageList(pId, true)
 			for _, one := range packageList {
 				if _, ok := storeMap[one.ItemId]; ok {

+ 2 - 2
go/gopath/src/fohow.com/apps/models/order_model/order_dt_item.go

@@ -116,8 +116,8 @@ func GetDetailSoldCountByPId(pId int64, useCache bool) int64 {
 	o := orm.NewOrm()
 	new_tbn := "base_details"
 	tbn := new(Order).TableName()
-	sql := fmt.Sprintf("SELECT sum(`nums`) as count FROM `%s` WHERE order_no in ( select order_id from `%s` where  status not in (?, ?) ) and product_id=?;", new_tbn, tbn)
-	err := o.Raw(sql, STATUS_CLOSED, STATUS_UNPAY, pId).QueryRow(ret)
+	sql := fmt.Sprintf("SELECT sum(`nums`) as count FROM `%s` WHERE order_no in ( select order_id from `%s` where  status not in (?, ?, ?) ) and product_id=?;", new_tbn, tbn)
+	err := o.Raw(sql, STATUS_CLOSED, STATUS_UNPAY, STATUS_REFUNDED, pId).QueryRow(ret)
 	if err != nil {
 		beego.BeeLogger.Error("GetSoldCountByPId err=[%s]", err)
 		return 0