This commit is contained in:
suyl
2021-09-10 16:13:24 +08:00
parent 92fd4c8107
commit bbb3a27ca6

View File

@@ -2,6 +2,7 @@ package permission
import ( import (
"fmt" "fmt"
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
"strings" "strings"
"time" "time"
@@ -94,18 +95,23 @@ func GetRole(ctx *jxcontext.Context, name string) (roles []*model.Role, err erro
db = dao.GetDB() db = dao.GetDB()
) )
roles, err = dao.GetRole(db, name, "") roles, err = dao.GetRole(db, name, "")
for _, v := range roles { task := tasksch.NewParallelTask("GetRole", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
if v.CityCodes != "" { func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
if cityInfos, err := dao.GetPlaces(db, jxutils.StrListToIntList(strings.Split(v.CityCodes, ","))); err == nil { v := batchItemList[0].(*model.Role)
v.CityInfo = cityInfos if v.CityCodes != "" {
if cityInfos, err := dao.GetPlaces(db, jxutils.StrListToIntList(strings.Split(v.CityCodes, ","))); err == nil {
v.CityInfo = cityInfos
}
} }
} if v.StoreIDs != "" {
if v.StoreIDs != "" { if stores, err := dao.GetStoreList(db, jxutils.StrListToIntList(strings.Split(v.StoreIDs, ",")), nil, nil, nil, nil, ""); err == nil {
if stores, err := dao.GetStoreList(db, jxutils.StrListToIntList(strings.Split(v.StoreIDs, ",")), nil, nil, nil, nil, ""); err == nil { v.Stores = stores
v.Stores = stores }
} }
} return retVal, err
} }, roles)
tasksch.HandleTask(task, nil, false).Run()
task.GetResult(0)
return roles, err return roles, err
} }