diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 73217bec0..0fed8bc08 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -129,7 +129,7 @@ func (v *VendorSync) syncCategories(ctx *jxcontext.Context, parentTask tasksch.I } func (v *VendorSync) SyncCategory(ctx *jxcontext.Context, db *dao.DaoDB, categoryID int, isAsync bool, userName string) (hint string, err error) { - if !model.IsUseThingMap { + if !globals.IsUseThingMap { return v.oldSyncCategory(ctx, db, categoryID, isAsync, userName) } return SyncCategories(ctx, nil, nil, nil, []int{categoryID}, isAsync) @@ -165,7 +165,7 @@ func (v *VendorSync) oldSyncCategory(ctx *jxcontext.Context, db *dao.DaoDB, cate } func (v *VendorSync) SyncReorderCategories(ctx *jxcontext.Context, db *dao.DaoDB, categoryID int, isAsync bool, userName string) (hint string, err error) { - if !model.IsUseThingMap { + if !globals.IsUseThingMap { return v.oldSyncReorderCategories(ctx, db, categoryID, isAsync, userName) } return SyncReorderCategories(ctx, -1, isAsync) @@ -248,7 +248,7 @@ func (v *VendorSync) SyncSku(ctx *jxcontext.Context, db *dao.DaoDB, nameID, skuI } func (v *VendorSync) SyncSkus(ctx *jxcontext.Context, db *dao.DaoDB, nameIDs []int, skuIDs []int, isAsync, isContinueWhenError bool, userName string) (hint string, err error) { - if !model.IsUseThingMap { + if !globals.IsUseThingMap { return v.oldSyncSkus(ctx, db, nameIDs, skuIDs, isAsync, isContinueWhenError, userName) } return SyncSkus(ctx, nil, nil, nil, nameIDs, skuIDs, isAsync) @@ -563,7 +563,7 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, db *dao.DaoDB, taskN if len(loopInfoList) == 1 { taskName = fmt.Sprintf("%s,处理平台%s", taskName, model.VendorChineseNames[loopInfoList[0].VendorID]) } - globals.SugarLogger.Debugf("LoopStoresMap2 loopInfoList:%s", utils.Format4Output(loopInfoList, false)) + // globals.SugarLogger.Debugf("LoopStoresMap2 loopInfoList:%s", utils.Format4Output(loopInfoList, false)) task = tasksch.NewParallelTask(taskName, tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, handler, loopInfoList) tasksch.HandleTask(task, nil, isManageIt).Run() if !isAsync { diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index bc51053da..06508a7fc 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -168,7 +168,7 @@ func OnCreateThing(ctx *jxcontext.Context, db *dao.DaoDB, thingID int64, thingTy dao.WrapAddIDCULDEntity(thingMap, ctx.GetUserName()) errList.AddErr(dao.CreateEntity(db, thingMap)) } - if model.IsUseThingMap { + if globals.IsUseThingMap { err = errList.GetErrListAsOne() } return err @@ -196,7 +196,7 @@ func OnUpdateThing(ctx *jxcontext.Context, db *dao.DaoDB, thingID int64, thingTy errList.AddErr(err2) } } - if model.IsUseThingMap { + if globals.IsUseThingMap { err = errList.GetErrListAsOne() } return err @@ -229,7 +229,7 @@ func OnDeleteThing(ctx *jxcontext.Context, db *dao.DaoDB, thingID int64, thingTy errList.AddErr(err2) } } - if model.IsUseThingMap { + if globals.IsUseThingMap { err = errList.GetErrListAsOne() } return err diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 2005fca28..3ffa82eba 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -282,7 +282,7 @@ func GetDirtyStoreCategories(db *DaoDB, vendorID, storeID int, level int) (cats // 以store_sku_bind为基础来做同步,正常情况下使用 // 单多门店模式厂商通用 func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty bool) (skus []*StoreSkuSyncInfo, err error) { - if !model.IsUseThingMap { + if !globals.IsUseThingMap { return oldGetStoreSkus2(db, vendorID, storeID, skuIDs, mustDirty) } return newGetStoreSkus2(db, vendorID, storeID, skuIDs, mustDirty) @@ -495,7 +495,7 @@ func GetStoreSkus(db *DaoDB, vendorID, storeID int, skuIDs []int) (skus []*Store // 以sku为基础来做全同步, // 多门店模式厂商适用 func GetFullStoreSkus(db *DaoDB, vendorID, storeID int) (skus []*StoreSkuSyncInfo, err error) { - if !model.IsUseThingMap { + if !globals.IsUseThingMap { return oldGetFullStoreSkus(db, vendorID, storeID) } return newGetFullStoreSkus(db, vendorID, storeID) @@ -1061,7 +1061,7 @@ func GetStoreSkuNamePrice(db *DaoDB) (storeSkuNamePriceList []*model.StoreSkuNam } err = GetRows(db, &storeSkuNamePriceList, sql, sqlParams...) if err != nil { - return nil,err + return nil, err } return storeSkuNamePriceList, err } diff --git a/business/model/sync_map.go b/business/model/sync_map.go index 3de1b6fae..5ca1dcbae 100644 --- a/business/model/sync_map.go +++ b/business/model/sync_map.go @@ -6,10 +6,6 @@ const ( ThingTypeSku = 3 ) -const ( - IsUseThingMap = false -) - type ThingMap struct { ModelIDCULD diff --git a/conf/app.conf b/conf/app.conf index 752b09a24..7bf68d28d 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -97,6 +97,8 @@ zhongwuAppSecret = "29435497822f52f3cf659c65da548a79" getWeixinTokenKey = "c928ed0d-87a3-441a-8517-f92f0167296f" storeName = "京西菜市" +useThingMap = false + [dev] jdOrgCode = "320406" jdToken = "77e703b7-7997-441b-a12a-2e522efb117a" @@ -292,6 +294,8 @@ enableEbaiStoreWrite = true enableMtwmStoreWrite = true enableWscStoreWrite = false +useThingMap = true + [beta] enableStoreWrite = false enableJdStoreWrite = false diff --git a/globals/globals.go b/globals/globals.go index 5c51c004a..b0909ff04 100644 --- a/globals/globals.go +++ b/globals/globals.go @@ -51,6 +51,8 @@ var ( WxpayNotifyURL string JdOrgCode string + + IsUseThingMap bool ) func init() { @@ -99,6 +101,8 @@ func Init() { WxpayNotifyURL = beego.AppConfig.DefaultString("wxpayNotifyURL", "") JdOrgCode = beego.AppConfig.DefaultString("jdOrgCode", "") + + IsUseThingMap = beego.AppConfig.DefaultBool("useThingMap", false) } func IsCallbackAlwaysReturnSuccess() bool {