aa
This commit is contained in:
@@ -359,3 +359,14 @@ func GetUserStoresResultMap(userID string) (resultMap map[int]int, err error) {
|
||||
}
|
||||
return resultMap, err
|
||||
}
|
||||
|
||||
func IsRoled(ctx *jxcontext.Context) bool {
|
||||
if ctx.GetUserName() != "jxadmin" {
|
||||
if user, err := dao.GetUserByID(dao.GetDB(), "user_id", ctx.GetUserID()); err == nil {
|
||||
if user.Type&model.UserTypeRole != 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -517,20 +517,16 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
retVal.Stores = storeList
|
||||
}
|
||||
//权限
|
||||
if ctx.GetUserName() != "jxadmin" {
|
||||
if user, err := dao.GetUserByID(db, "user_id", ctx.GetUserID()); err == nil {
|
||||
if user.Type&model.UserTypeRole != 0 {
|
||||
if storeIDsMap, err := GetUserStoresResultMap(user.UserID); err == nil {
|
||||
var storeList2 []*StoreExt
|
||||
for _, v := range retVal.Stores {
|
||||
if storeIDsMap[v.ID] != 0 {
|
||||
storeList2 = append(storeList2, v)
|
||||
}
|
||||
}
|
||||
retVal.Stores = nil
|
||||
retVal.Stores = storeList2
|
||||
if IsRoled(ctx) {
|
||||
if storeIDsMap, err := GetUserStoresResultMap(ctx.GetUserID()); err == nil {
|
||||
var storeList2 []*StoreExt
|
||||
for _, v := range retVal.Stores {
|
||||
if storeIDsMap[v.ID] != 0 {
|
||||
storeList2 = append(storeList2, v)
|
||||
}
|
||||
}
|
||||
retVal.Stores = nil
|
||||
retVal.Stores = storeList2
|
||||
}
|
||||
}
|
||||
// 订单情况过滤
|
||||
|
||||
Reference in New Issue
Block a user