测试updatestoresskus
This commit is contained in:
@@ -1048,6 +1048,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
if user := ctx.GetFullUser(); user != nil {
|
||||
isUserCanDirectChangePrice = user.Type&model.UserTypeOperator != 0
|
||||
}
|
||||
fmt.Println("test11111111111111111111111111111111111")
|
||||
userName := ctx.GetUserName()
|
||||
needSyncIDMap := make(map[int]int)
|
||||
dao.Begin(db)
|
||||
@@ -1059,6 +1060,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
}()
|
||||
for _, storeID := range storeIDs {
|
||||
// todo 可以考虑在需要更新价格再获取
|
||||
fmt.Println("test22222222222222222222222222222222222222222")
|
||||
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDJX)
|
||||
if err != nil {
|
||||
dao.Rollback(db)
|
||||
@@ -1110,6 +1112,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
sqlParams = append(sqlParams, skuBindInfo.NameID, utils.DefaultTimeValue)
|
||||
// globals.SugarLogger.Debug(sql)
|
||||
if err = dao.GetRows(db, &allBinds, sql, sqlParams...); err == nil {
|
||||
fmt.Println("test3333333333333333333333333333333333333333")
|
||||
if len(allBinds) > 0 {
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(allBinds, false))
|
||||
inSkuBinsMap := make(map[int]*StoreSkuBindSkuInfo, len(inSkuBinds))
|
||||
@@ -1137,7 +1140,6 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
unitPrice = int(float64(unitPrice) * scaleFactor)
|
||||
for _, v := range allBinds {
|
||||
var num int64
|
||||
fmt.Println("test1111111111111111111111111111111111")
|
||||
inSkuBind := inSkuBinsMap[v.RealSkuID]
|
||||
isCanChangePrice := (isUserCanDirectChangePrice || jxutils.TranslateStorePriceType(v.ChangePriceType) != model.StoreChangePriceTypeBossDisabled)
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(inSkuBind, false))
|
||||
@@ -1238,7 +1240,6 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
skuBind.Status = tmpStatus
|
||||
setStoreSkuBindStatus(skuBind, model.SyncFlagSaleMask)
|
||||
}
|
||||
fmt.Println("test2222222222222222222222222222222222222")
|
||||
if skuBindInfo.UnitPrice != 0 && isCanChangePrice { // 这里是否需要加此条件限制
|
||||
price := jxutils.CaculateSkuPrice(unitPrice, v.SpecQuality, v.SpecUnit, v.SkuNameUnit)
|
||||
jxPrice := jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage), price)
|
||||
@@ -1282,7 +1283,6 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
err = AddEventDetail(db, ctx, model.OperateUpdate, v.RealSkuID, model.ThingTypeSku, storeID, BuildDiffData(mapBefore), BuildDiffData(mapAfter))
|
||||
}
|
||||
}
|
||||
fmt.Println("test33333333333333333333333333333333")
|
||||
if len(updateFieldMap) > 0 {
|
||||
updateFieldMap[model.FieldJdSyncStatus] = 1
|
||||
updateFieldMap[model.FieldEbaiSyncStatus] = 1
|
||||
|
||||
Reference in New Issue
Block a user