- Store and StoreMap add DeletedAt.
This commit is contained in:
@@ -3,7 +3,6 @@ package cms
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler/basesch"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
@@ -54,7 +53,7 @@ func (v *VendorSync) SyncCategory(db *dao.DaoDB, categoryID int, isForce bool, u
|
||||
if categoryID > 0 {
|
||||
cond[model.FieldID] = categoryID
|
||||
}
|
||||
if err = dao.GetEntities(db, &cats, cond, true); err == nil {
|
||||
if err = dao.GetEntitiesByKV(db, &cats, cond, true); err == nil {
|
||||
tasksch.RunTask("", func(batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
||||
cat := batchItemList[0].(*model.SkuCategory)
|
||||
if (cat.JdSyncStatus & model.SyncFlagDeletedMask) != 0 { //删除
|
||||
@@ -76,17 +75,16 @@ func (v *VendorSync) SyncCategory(db *dao.DaoDB, categoryID int, isForce bool, u
|
||||
return err
|
||||
}
|
||||
|
||||
func (v *VendorSync) SyncStore(db *dao.DaoDB, vendorID int, store *model.Store, isForce bool, userName string) (err error) {
|
||||
globals.SugarLogger.Debugf("SyncStore, store:%s", utils.Format4Output(store, true))
|
||||
func (v *VendorSync) SyncStore(db *dao.DaoDB, vendorID, storeID int, isForce bool, userName string) (err error) {
|
||||
globals.SugarLogger.Debugf("SyncStore, storeID:%d", storeID)
|
||||
if db == nil {
|
||||
db = dao.GetDB()
|
||||
}
|
||||
err = v.LoopStoreMap(db, store.ID, func(batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
||||
err = v.LoopStoreMap(db, storeID, func(batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
||||
storeMap := batchItemList[0].(*model.StoreMap)
|
||||
globals.SugarLogger.Debugf("SyncStore, storeMap:%s", utils.Format4Output(store, true))
|
||||
if (vendorID == -1 || vendorID == storeMap.VendorID) && (isForce || storeMap.SyncStatus != 0) {
|
||||
if handler := GetPurchaseHandler(storeMap.VendorID); handler != nil {
|
||||
if err = handler.UpdateStore(store.ID, userName); err == nil {
|
||||
if err = handler.UpdateStore(storeID, userName); err == nil {
|
||||
storeMap.SyncStatus = 0
|
||||
_, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
|
||||
}
|
||||
@@ -116,7 +114,7 @@ func (v *VendorSync) SyncSku(db *dao.DaoDB, nameID, skuID int, isForce bool, use
|
||||
if skuID != -1 {
|
||||
cond[model.FieldID] = skuID
|
||||
}
|
||||
if err = dao.GetEntities(db, &skuList, cond, true); err == nil {
|
||||
if err = dao.GetEntitiesByKV(db, &skuList, cond, true); err == nil {
|
||||
tasksch.RunTask("", func(batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
||||
sku := batchItemList[0].(*model.Sku)
|
||||
if (skuID == -1 || skuID == sku.ID) && (isForce || sku.JdSyncStatus != 0) {
|
||||
|
||||
Reference in New Issue
Block a user