- 禁止在老版活动上创建补贴表,迁移至新版,暂时保持活动表的兼容

This commit is contained in:
gazebo
2019-07-25 08:35:30 +08:00
parent 3eb2b1395a
commit db45cf2051
3 changed files with 19 additions and 3 deletions

View File

@@ -287,13 +287,22 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
}
var skuPriceMap map[int64]*dao.PromotionStoreSku
var actStoreSkuMap *jxutils.ActStoreSkuMap
if len(skuIDMap) > 0 {
skuPriceMap, err = dao.GetPromotionSkuPriceMap(db, model.VendorIDJX, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt)
if err != nil {
globals.SugarLogger.Errorf("updateOrderSkuOtherInfo can not get sku promotion info for orderID:%s, error:%v", order.VendorOrderID, err)
return err
}
actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, nil, []int{jxStoreID}, jxutils.IntMap2List(skuIDMap), order.OrderCreatedAt, order.OrderCreatedAt)
if err != nil {
globals.SugarLogger.Errorf("updateOrderSkuOtherInfo can not get sku promotion info for error:%v", err)
return err
}
actStoreSkuMap = jxutils.NewActStoreSkuMap(actStoreSkuList, true)
}
for _, v := range orderSkus {
v.VendorOrderID = order.VendorOrderID
v.VendorID = order.VendorID
@@ -321,6 +330,12 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
v.EarningPrice = int64(skuPriceMap[index].EarningPrice)
}
}
} else if actStoreSkuMap != nil {
if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 /*&& v.StoreSubName != ""*/ {
if actStoreSku := actStoreSkuMap.GetActStoreSku(jxStoreID, skuID, order.VendorID); actStoreSku != nil {
v.EarningPrice = actStoreSku.EarningPrice
}
}
}
}
}

View File

@@ -512,6 +512,8 @@ func updateActPrice4StoreSkuNameNew(db *dao.DaoDB, storeIDs, skuIDs []int, skuNa
index := dao.GenSkuPriceMapKey(skuName.StoreID, v.SkuID)
if jxSkuPriceMap[index] != nil {
v.EarningPrice = jxSkuPriceMap[index].EarningPrice
} else if actStoreSku != nil {
v.EarningPrice = int(actStoreSku.EarningPrice)
}
v.RealEarningPrice = v.EarningPrice

View File

@@ -4,7 +4,6 @@ import (
"fmt"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
"github.com/astaxie/beego"
@@ -41,8 +40,8 @@ type PromotionController struct {
func (c *PromotionController) CreatePromotion() {
c.callCreatePromotion(func(params *tPromotionCreatePromotionParams) (retVal interface{}, errCode string, err error) {
if globals.EnableNewAct {
if params.VendorID == model.VendorIDJD {
return retVal, "", fmt.Errorf("请使用新版活动管理创建平台活动")
if true { //params.VendorID == model.VendorIDJD {
return retVal, "", fmt.Errorf("请使用新版活动管理创建活动")
}
}
beginAt, err := utils.TryStr2Time(params.BeginAt)