1
This commit is contained in:
@@ -1897,7 +1897,6 @@ func uniqueStoreNameBind(skuBindInfos []*StoreSkuBindInfo) (outSkuBindInfos []*S
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isScale, isRefreshHigh bool) (needSyncSkus []int, err error) {
|
func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isScale, isRefreshHigh bool) (needSyncSkus []int, err error) {
|
||||||
globals.SugarLogger.Debugf("---------------------------1")
|
|
||||||
// if len(storeIDs)*len(skuBindInfos) > maxStoreNameBind2 {
|
// if len(storeIDs)*len(skuBindInfos) > maxStoreNameBind2 {
|
||||||
// return nil, fmt.Errorf("门店商品信息大于%d", maxStoreNameBind2)
|
// return nil, fmt.Errorf("门店商品信息大于%d", maxStoreNameBind2)
|
||||||
// }
|
// }
|
||||||
@@ -1928,9 +1927,6 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
for _, storeID := range storeIDs {
|
for _, storeID := range storeIDs {
|
||||||
if storeID == 668470 {
|
|
||||||
globals.SugarLogger.Debugf("-----------------2")
|
|
||||||
}
|
|
||||||
// todo 可以考虑在需要更新价格再获取
|
// todo 可以考虑在需要更新价格再获取
|
||||||
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDJX, "")
|
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDJX, "")
|
||||||
if err != nil || storeDetail == nil {
|
if err != nil || storeDetail == nil {
|
||||||
@@ -1947,14 +1943,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
|||||||
if isScale {
|
if isScale {
|
||||||
scaleFactor = 100 / float64(jxutils.ConstrainPayPercentage(storeDetail.PayPercentage))
|
scaleFactor = 100 / float64(jxutils.ConstrainPayPercentage(storeDetail.PayPercentage))
|
||||||
}
|
}
|
||||||
if storeID == 668470 {
|
|
||||||
globals.SugarLogger.Debugf("-----------------3")
|
|
||||||
globals.SugarLogger.Debugf("---------skuBindInfos := %s", utils.Format4Output(skuBindInfos, false))
|
|
||||||
}
|
|
||||||
for _, skuBindInfo := range skuBindInfos {
|
for _, skuBindInfo := range skuBindInfos {
|
||||||
if storeID == 668470 {
|
|
||||||
globals.SugarLogger.Debugf("---------skuBindInfo := %s", utils.Format4Output(skuBindInfo, false))
|
|
||||||
}
|
|
||||||
// 关注且没有给价时,需要尝试从store_sku_bind中得到已有的单价
|
// 关注且没有给价时,需要尝试从store_sku_bind中得到已有的单价
|
||||||
needGetExistingUnitPrice := skuBindInfo.UnitPrice == 0 && skuBindInfo.IsFocus == 1
|
needGetExistingUnitPrice := skuBindInfo.UnitPrice == 0 && skuBindInfo.IsFocus == 1
|
||||||
inSkuBinds := skuBindInfo.Skus
|
inSkuBinds := skuBindInfo.Skus
|
||||||
@@ -2036,9 +2025,6 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
unitPrice = int(math.Floor(float64(unitPrice)*scaleFactor/10+0.5)) * 10 //四舍五入 价格为100倍 角分为十位个位 除以10 + 0.5对分位向下取整(完成四舍五入的方法)
|
unitPrice = int(math.Floor(float64(unitPrice)*scaleFactor/10+0.5)) * 10 //四舍五入 价格为100倍 角分为十位个位 除以10 + 0.5对分位向下取整(完成四舍五入的方法)
|
||||||
if storeID == 668470 {
|
|
||||||
globals.SugarLogger.Debugf("-----------allBinds := %s", utils.Format4Output(allBinds, false))
|
|
||||||
}
|
|
||||||
for _, v := range allBinds {
|
for _, v := range allBinds {
|
||||||
if v.Stock == 0 {
|
if v.Stock == 0 {
|
||||||
v.Stock = model.MaxStoreSkuStockQty
|
v.Stock = model.MaxStoreSkuStockQty
|
||||||
@@ -2060,9 +2046,20 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
|||||||
Status: model.StoreSkuBindStatusDontSale, // 缺省不可售?
|
Status: model.StoreSkuBindStatusDontSale, // 缺省不可售?
|
||||||
}
|
}
|
||||||
skuBind.JxPrice = jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage), skuBind.Price)
|
skuBind.JxPrice = jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage), skuBind.Price)
|
||||||
if tmpStatus := getSkuSaleStatus(inSkuBind, skuBindInfo); tmpStatus != model.StoreSkuBindStatusNA {
|
if storeID == 668470 {
|
||||||
|
globals.SugarLogger.Debugf("---------------skuBind := %s", utils.Format4Output(skuBind, false))
|
||||||
|
}
|
||||||
|
tmpStatus := getSkuSaleStatus(inSkuBind, skuBindInfo)
|
||||||
|
if storeID == 668470 {
|
||||||
|
globals.SugarLogger.Debugf("---------------tmpStatus := %s", utils.Format4Output(tmpStatus, false))
|
||||||
|
globals.SugarLogger.Debugf("---------------inSkuBind := %s", utils.Format4Output(inSkuBind, false))
|
||||||
|
}
|
||||||
|
if tmpStatus != model.StoreSkuBindStatusNA {
|
||||||
skuBind.Status = tmpStatus
|
skuBind.Status = tmpStatus
|
||||||
if inSkuBind != nil {
|
if inSkuBind != nil {
|
||||||
|
if storeID == 668470 {
|
||||||
|
globals.SugarLogger.Debugf("---------------inSkuBind.Stock := %s", utils.Format4Output(inSkuBind.Stock, false))
|
||||||
|
}
|
||||||
if inSkuBind.Stock != nil {
|
if inSkuBind.Stock != nil {
|
||||||
skuBind.Stock = *inSkuBind.Stock
|
skuBind.Stock = *inSkuBind.Stock
|
||||||
} else {
|
} else {
|
||||||
@@ -2074,6 +2071,9 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if storeID == 668470 {
|
||||||
|
globals.SugarLogger.Debugf("---------------skuBind2 := %s", utils.Format4Output(skuBind, false))
|
||||||
|
}
|
||||||
if globals.IsAddEvent {
|
if globals.IsAddEvent {
|
||||||
err = AddEventDetail(db, ctx, model.OperateAdd, v.RealSkuID, model.ThingTypeSku, storeID, "", utils.Int2Str(skuBind.UnitPrice))
|
err = AddEventDetail(db, ctx, model.OperateAdd, v.RealSkuID, model.ThingTypeSku, storeID, "", utils.Int2Str(skuBind.UnitPrice))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user