aa
This commit is contained in:
@@ -359,3 +359,14 @@ func GetUserStoresResultMap(userID string) (resultMap map[int]int, err error) {
|
|||||||
}
|
}
|
||||||
return resultMap, err
|
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,10 +517,8 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
|||||||
retVal.Stores = storeList
|
retVal.Stores = storeList
|
||||||
}
|
}
|
||||||
//权限
|
//权限
|
||||||
if ctx.GetUserName() != "jxadmin" {
|
if IsRoled(ctx) {
|
||||||
if user, err := dao.GetUserByID(db, "user_id", ctx.GetUserID()); err == nil {
|
if storeIDsMap, err := GetUserStoresResultMap(ctx.GetUserID()); err == nil {
|
||||||
if user.Type&model.UserTypeRole != 0 {
|
|
||||||
if storeIDsMap, err := GetUserStoresResultMap(user.UserID); err == nil {
|
|
||||||
var storeList2 []*StoreExt
|
var storeList2 []*StoreExt
|
||||||
for _, v := range retVal.Stores {
|
for _, v := range retVal.Stores {
|
||||||
if storeIDsMap[v.ID] != 0 {
|
if storeIDsMap[v.ID] != 0 {
|
||||||
@@ -531,8 +529,6 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
|||||||
retVal.Stores = storeList2
|
retVal.Stores = storeList2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
// 订单情况过滤
|
// 订单情况过滤
|
||||||
storeList, err = filterStoreByOrderInfo(db, retVal.Stores, orderTimeFrom, orderTimeTo, orderCountFrom, orderCountTo)
|
storeList, err = filterStoreByOrderInfo(db, retVal.Stores, orderTimeFrom, orderTimeTo, orderCountFrom, orderCountTo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user