aa
This commit is contained in:
@@ -2905,7 +2905,7 @@ func ReorderVendorCategories(ctx *jxcontext.Context, parentID, vendorID int, ven
|
||||
}
|
||||
}
|
||||
dao.Commit(db)
|
||||
SyncReorderCategories(ctx, parentID, true)
|
||||
err = SyncReorderCategories2(ctx, parentID, vendorID, vendorOrgCode)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -260,6 +260,31 @@ func SyncReorderCategories(ctx *jxcontext.Context, parentCatID int, isAsync bool
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func SyncReorderCategories2(ctx *jxcontext.Context, parentCatID, vendorID int, vendorOrgCode string) (err error) {
|
||||
globals.SugarLogger.Debugf("SyncReorderCategories parentCatID:%d", parentCatID)
|
||||
db := dao.GetDB()
|
||||
multiStoresHandler := CurVendorSync.GetMultiStoreHandler(vendorID)
|
||||
if multiStoresHandler != nil {
|
||||
var vendorCatIDList []string
|
||||
var parentVendorCatID string
|
||||
vendorCatList, _ := dao.GetVendorCategoryMapExt(db, parentCatID, 0, vendorID, vendorOrgCode, 0)
|
||||
for _, v := range vendorCatList {
|
||||
if v.VendorThingID != "" {
|
||||
vendorCatIDList = append(vendorCatIDList, v.VendorThingID)
|
||||
}
|
||||
}
|
||||
thingMaps, _ := dao.GetThingMapList(db, model.ThingTypeCategory, []int{vendorID}, []int{parentCatID}, []string{vendorOrgCode})
|
||||
parentVendorCatID = thingMaps[0].VendorThingID
|
||||
|
||||
if len(vendorCatIDList) > 0 {
|
||||
err = multiStoresHandler.ReorderCategories2(ctx, vendorOrgCode, parentVendorCatID, vendorCatIDList)
|
||||
}
|
||||
} else {
|
||||
err = fmt.Errorf("非法平台:%d", vendorID)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func getThingMap(db *dao.DaoDB, thingMap *model.ThingMap) (err error) {
|
||||
return dao.GetEntity(db, thingMap, "ThingID", "ThingType", "VendorID", "VendorOrgCode", model.FieldDeletedAt)
|
||||
}
|
||||
|
||||
@@ -501,6 +501,7 @@ func GetVendorCategoryMapExt(db *DaoDB, parentID, level, vendorID int, vendorOrg
|
||||
WHERE a.deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
model.ThingTypeCategory,
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if parentID >= 0 {
|
||||
|
||||
Reference in New Issue
Block a user