1
This commit is contained in:
@@ -317,21 +317,19 @@ func (c *OrderManager) GetOrders(ctx *jxcontext.Context, isIncludeFake bool, fro
|
||||
var db = dao.GetDB()
|
||||
//权限
|
||||
if permission.IsRoled(ctx) {
|
||||
// 查询用户门店
|
||||
if storeIDsMap, err := permission.GetUserStoresResultMap(ctx.GetUserID()); err == nil {
|
||||
var storeIDs2 []int
|
||||
var storeIDs []int
|
||||
if err = utils.UnmarshalUseNumber([]byte(params["storeIDs"].(string)), &storeIDs); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if params["storeIDs"] != nil {
|
||||
for _, v := range storeIDs {
|
||||
if storeIDsMap[v] != 0 {
|
||||
storeIDs2 = append(storeIDs2, v)
|
||||
var storeIDs []int
|
||||
if err = utils.UnmarshalUseNumber([]byte(params["storeIDs"].(string)), &storeIDs); err == nil {
|
||||
for _, v := range storeIDs {
|
||||
if storeIDsMap[v] != 0 {
|
||||
storeIDs2 = append(storeIDs2, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(storeIDs2) == 0 { // todo
|
||||
storeIDs2 = append(storeIDs2, storeIDs...)
|
||||
if len(storeIDs2) == 0 {
|
||||
storeIDs2 = append(storeIDs2, -1)
|
||||
}
|
||||
} else {
|
||||
if len(storeIDsMap) > 0 {
|
||||
@@ -339,7 +337,7 @@ func (c *OrderManager) GetOrders(ctx *jxcontext.Context, isIncludeFake bool, fro
|
||||
storeIDs2 = append(storeIDs2, k)
|
||||
}
|
||||
} else {
|
||||
storeIDs2 = append(storeIDs2, storeIDs...)
|
||||
storeIDs2 = append(storeIDs2, -1)
|
||||
}
|
||||
}
|
||||
if data, err := json.Marshal(storeIDs2); err == nil {
|
||||
@@ -347,7 +345,7 @@ func (c *OrderManager) GetOrders(ctx *jxcontext.Context, isIncludeFake bool, fro
|
||||
}
|
||||
}
|
||||
}
|
||||
//if isJxIncomeArea {
|
||||
//if isJxIncomeArea {
|
||||
// begin = utils.MustInterface2Int64(params["jxIncomeBegin"])
|
||||
// end = utils.MustInterface2Int64(params["jxIncomeEnd"])
|
||||
// pageSize = math.MaxInt32
|
||||
|
||||
@@ -382,14 +382,14 @@ func GetUserStoresResultMap(userID string) (resultMap map[int]int, err error) {
|
||||
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
|
||||
//}
|
||||
if user.Type == 23 {
|
||||
return false
|
||||
} else {
|
||||
if user.Type&model.UserTypeRole != 0 {
|
||||
return true
|
||||
}
|
||||
//if user.Type == 23 {
|
||||
// return false
|
||||
//} else {
|
||||
// return true
|
||||
//}
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user