暂时先注释掉权限管理验证,修改组织结构不使用分页进行数据返回
This commit is contained in:
parent
bdf2d82a37
commit
697762157e
|
|
@ -31,8 +31,8 @@ local function isExistDepartment(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 查询数据表中的所有组织架构信息
|
-- 查询数据表中的所有组织架构信息
|
||||||
function _M.getSystemDepartments(pageNum, pageSize)
|
function _M.getSystemDepartments()
|
||||||
return departmentModel:paginate(pageNum, pageSize)
|
return departmentModel:all()
|
||||||
end
|
end
|
||||||
|
|
||||||
--根据组织架构id获取组织架构信息
|
--根据组织架构id获取组织架构信息
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,7 @@ function _M.getSystemDepartments()
|
||||||
if perm:hasPermission(role, perms) == false then
|
if perm:hasPermission(role, perms) == false then
|
||||||
ngx.exit(ngx.HTTP_FORBIDDEN)
|
ngx.exit(ngx.HTTP_FORBIDDEN)
|
||||||
end
|
end
|
||||||
--获取页码和请求的数据量
|
local code,ret = departmentDao.getSystemDepartments()
|
||||||
local pageNum = ngx.var.pagenum or 1
|
|
||||||
local pageSize = ngx.var.pagesize or 10
|
|
||||||
local code,ret = departmentDao.getSystemDepartments(pageNum, pageSize)
|
|
||||||
local result = resp:json(code, ret)
|
local result = resp:json(code, ret)
|
||||||
resp:send(result)
|
resp:send(result)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ end
|
||||||
|
|
||||||
-- 检查角色是否拥有指定权限
|
-- 检查角色是否拥有指定权限
|
||||||
function _M:hasPermission(role_name, permission)
|
function _M:hasPermission(role_name, permission)
|
||||||
|
do return true end
|
||||||
if role_name == nil or permission == nil then
|
if role_name == nil or permission == nil then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,14 @@
|
||||||
local cjson = require('cjson')
|
local cjson = require('cjson')
|
||||||
local conf = require('config')
|
local conf = require('config')
|
||||||
local error_code = require('util.status')
|
local error_code = require('util.status')
|
||||||
local ngx = ngx
|
|
||||||
|
|
||||||
local _M = {}
|
local _M = {}
|
||||||
|
|
||||||
function _M:json(status, message, data, http_status)
|
function _M:json(status, message, data, http_status)
|
||||||
-- you can modify this response struct as you favor
|
-- you can modify this response struct as you favor
|
||||||
if status == 0 then status = ngx.ok end
|
if status == 0 then status = ngx.HTTP_OK end
|
||||||
local msg = message
|
local msg = message
|
||||||
local response_status = http_status or ngx.OK
|
local response_status = http_status or ngx.HTTP_OK
|
||||||
if msg == nil or msg == '' then
|
if msg == nil or msg == '' then
|
||||||
--local locale = ngx.ctx.locale or conf.locale
|
--local locale = ngx.ctx.locale or conf.locale
|
||||||
--if error_code[locale] ~= nil then
|
--if error_code[locale] ~= nil then
|
||||||
|
|
@ -17,7 +16,7 @@ function _M:json(status, message, data, http_status)
|
||||||
--end
|
--end
|
||||||
msg = error_code[status]
|
msg = error_code[status]
|
||||||
end
|
end
|
||||||
local response = {code=status, msg=msg, result=data,timestamp=ngx.time()}
|
local response = {code = status, msg = msg, result = data,timestamp = ngx.time()}
|
||||||
if not response.code then
|
if not response.code then
|
||||||
response.code = -1
|
response.code = -1
|
||||||
response.message = 'not find status code'
|
response.message = 'not find status code'
|
||||||
|
|
@ -31,11 +30,12 @@ end
|
||||||
|
|
||||||
function _M:json(status, data, http_status)
|
function _M:json(status, data, http_status)
|
||||||
-- you can modify this response struct as you favor
|
-- you can modify this response struct as you favor
|
||||||
|
if status == 0 then status = ngx.HTTP_OK end
|
||||||
local msg = ''
|
local msg = ''
|
||||||
local response_status = http_status or ngx.OK
|
local response_status = http_status or ngx.HTTP_OK
|
||||||
msg = error_code[status]
|
msg = error_code[status]
|
||||||
|
|
||||||
local response = {code=status, msg=msg, result=data,timestamp=ngx.time()}
|
local response = {code = status, msg = msg, result = data,timestamp = ngx.time()}
|
||||||
if not response.code then
|
if not response.code then
|
||||||
response.code = -1
|
response.code = -1
|
||||||
response.message = 'not find status code'
|
response.message = 'not find status code'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user