- debug LockPromotionSkus
This commit is contained in:
@@ -834,7 +834,7 @@ func RefreshJdPromotionLockStatus(ctx *jxcontext.Context, promotionID int) (err
|
||||
}
|
||||
|
||||
func LockPromotionSkus(ctx *jxcontext.Context, promotionID int, isLock int, skuIDs []int) (num int64, err error) {
|
||||
globals.SugarLogger.Debugf("LockPromotionSkus promotionID:%d, isLock:%t, skuIDs:%v", promotionID, isLock, skuIDs)
|
||||
globals.SugarLogger.Debugf("begin LockPromotionSkus promotionID:%d, isLock:%t, skuIDs:%v", promotionID, isLock, skuIDs)
|
||||
if isLock != 0 {
|
||||
isLock = 1
|
||||
}
|
||||
@@ -865,6 +865,7 @@ func LockPromotionSkus(ctx *jxcontext.Context, promotionID int, isLock int, skuI
|
||||
RefreshJdStoreSkuStock()
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("end LockPromotionSkus promotionID:%d, isLock:%t, skuIDs:%v", promotionID, isLock, skuIDs)
|
||||
return num, err
|
||||
}
|
||||
|
||||
@@ -1000,10 +1001,12 @@ func createLocalPromotionFromRemote(promotionInfoId int64) (retVal *jdapi.Callba
|
||||
return jdapi.Err2CallbackResponse(nil, "")
|
||||
}
|
||||
|
||||
func UpdatePromotionStatusFromRemote(ctx *jxcontext.Context, prommotionID int) (err error) {
|
||||
func UpdatePromotionStatusFromRemote(ctx *jxcontext.Context, promotionID int) (err error) {
|
||||
globals.SugarLogger.Debugf("UpdatePromotionStatusFromRemote promotionID:%d", promotionID)
|
||||
|
||||
db := dao.GetDB()
|
||||
promotion := &model.Promotion{}
|
||||
promotion.ID = prommotionID
|
||||
promotion.ID = promotionID
|
||||
if err = dao.GetEntity(db, promotion); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -66,10 +66,58 @@ func (p *PurchaseHandler) SyncStoreCategory(ctx *jxcontext.Context, parentTask t
|
||||
}
|
||||
return rootTask.ID, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) ReadStoreCategories(storeID int) (cats []*model.SkuCategory, err error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) SyncLocalStoreCategory(db *dao.DaoDB, storeID int, userName string) (err error) {
|
||||
remoteCats, err := api.MtwmAPI.RetailCatList(utils.Int2Str(storeID))
|
||||
if err == nil {
|
||||
return err
|
||||
}
|
||||
if db == nil {
|
||||
db = dao.GetDB()
|
||||
}
|
||||
catMap := make(map[string]*dao.StoreCatSyncInfo)
|
||||
for i := 0; i < 2; i++ {
|
||||
localCats, err := dao.GetStoreCategories(db, model.VendorIDMTWM, storeID, i+1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, cat := range localCats {
|
||||
cat.StoreSkuCategoryMap.MtwmSyncStatus = model.SyncFlagNewMask
|
||||
catMap[cat.ParentVendorCatID+"/"+cat.MtwmID] = cat
|
||||
}
|
||||
}
|
||||
strStoreID := utils.Int2Str(storeID)
|
||||
|
||||
processRemoteCat := func(catName, parentCatName string) (err error) {
|
||||
localCat := catMap[parentCatName+"/"+catName]
|
||||
if localCat == nil {
|
||||
if err = api.MtwmAPI.RetailCatDelete(strStoreID, catName); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
// localCat.StoreSkuCategoryMap.MtwmSyncStatus = model.SyncFlagModifiedMask
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, remoteCat := range remoteCats {
|
||||
name := utils.Interface2String(remoteCat.Name)
|
||||
if err = processRemoteCat("", name); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, subRemoteCat := range remoteCat.Children {
|
||||
if err = processRemoteCat(name, utils.Interface2String(subRemoteCat.Name)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) ReadStoreSku(storeID, skuID int) (skuNameExt *model.SkuNameExt, err error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user