|
@@ -915,8 +915,8 @@ func GenExpressPassword(expressNo string) string {
|
|
|
func GetNotInvovedAmount(promotionId int64, orderId string) int64 {
|
|
func GetNotInvovedAmount(promotionId int64, orderId string) int64 {
|
|
|
|
|
|
|
|
type PromotionPds struct {
|
|
type PromotionPds struct {
|
|
|
- ProductId int64 `orm:"column(product_id)" json:"product_id"` // int(11)
|
|
|
|
|
- Nums int64 `orm:"column(nums)" json:"nums"` // int(11)
|
|
|
|
|
|
|
+ ProductId int64 `orm:"column(product_id)"`
|
|
|
|
|
+ Nums int64 `orm:"column(nums)"`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
sql := `
|
|
sql := `
|
|
@@ -932,20 +932,17 @@ func GetNotInvovedAmount(promotionId int64, orderId string) int64 {
|
|
|
AND IF(od.nums IS NULL, 0, od.nums) > 0;
|
|
AND IF(od.nums IS NULL, 0, od.nums) > 0;
|
|
|
`
|
|
`
|
|
|
|
|
|
|
|
- var results []*PromotionPds
|
|
|
|
|
|
|
+ var results []PromotionPds
|
|
|
db := orm.NewOrm()
|
|
db := orm.NewOrm()
|
|
|
- _, err := db.Raw(sql, promotionId, orderId).QueryRows(&results)
|
|
|
|
|
|
|
+ _, err := db.Raw(sql, orderId, promotionId).QueryRows(&results)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
beego.BeeLogger.Debug("GetNotInvovedAmount err=%s", err)
|
|
beego.BeeLogger.Debug("GetNotInvovedAmount err=%s", err)
|
|
|
return 0
|
|
return 0
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
total := int64(0)
|
|
total := int64(0)
|
|
|
for _, item := range results {
|
|
for _, item := range results {
|
|
|
item_pd := product_model.GetProductById(item.ProductId, true)
|
|
item_pd := product_model.GetProductById(item.ProductId, true)
|
|
|
-
|
|
|
|
|
- beego.BeeLogger.Error("GetNotInvovedAmount-results.productId-%d", item.ProductId)
|
|
|
|
|
- beego.BeeLogger.Error("GetNotInvovedAmount-results.price-%d", item_pd.Price)
|
|
|
|
|
-
|
|
|
|
|
total += item.Nums * item_pd.Price
|
|
total += item.Nums * item_pd.Price
|
|
|
}
|
|
}
|
|
|
beego.BeeLogger.Error("GetNotInvovedAmount-total-%d", total)
|
|
beego.BeeLogger.Error("GetNotInvovedAmount-total-%d", total)
|