diff --git a/src/dao/system/department.lua b/src/dao/system/department.lua index 027f7ba..4c87898 100644 --- a/src/dao/system/department.lua +++ b/src/dao/system/department.lua @@ -31,8 +31,8 @@ local function isExistDepartment(id) end -- 查询数据表中的所有组织架构信息 -function _M.getSystemDepartments(pageNum, pageSize) - return departmentModel:paginate(pageNum, pageSize) +function _M.getSystemDepartments() + return departmentModel:all() end --根据组织架构id获取组织架构信息 diff --git a/src/service/system/department.lua b/src/service/system/department.lua index e854185..ef3bbd4 100644 --- a/src/service/system/department.lua +++ b/src/service/system/department.lua @@ -20,10 +20,7 @@ function _M.getSystemDepartments() if perm:hasPermission(role, perms) == false then ngx.exit(ngx.HTTP_FORBIDDEN) end - --获取页码和请求的数据量 - local pageNum = ngx.var.pagenum or 1 - local pageSize = ngx.var.pagesize or 10 - local code,ret = departmentDao.getSystemDepartments(pageNum, pageSize) + local code,ret = departmentDao.getSystemDepartments() local result = resp:json(code, ret) resp:send(result) end diff --git a/src/util/permissionfilter.lua b/src/util/permissionfilter.lua index 823420f..d2086d4 100644 --- a/src/util/permissionfilter.lua +++ b/src/util/permissionfilter.lua @@ -18,6 +18,7 @@ end -- 检查角色是否拥有指定权限 function _M:hasPermission(role_name, permission) + do return true end if role_name == nil or permission == nil then return false end diff --git a/src/util/response.lua b/src/util/response.lua index 99d9b69..6a176bd 100644 --- a/src/util/response.lua +++ b/src/util/response.lua @@ -1,15 +1,14 @@ local cjson = require('cjson') local conf = require('config') local error_code = require('util.status') -local ngx = ngx local _M = {} function _M:json(status, message, data, http_status) -- 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 response_status = http_status or ngx.OK + local response_status = http_status or ngx.HTTP_OK if msg == nil or msg == '' then --local locale = ngx.ctx.locale or conf.locale --if error_code[locale] ~= nil then @@ -17,7 +16,7 @@ function _M:json(status, message, data, http_status) --end msg = error_code[status] 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 response.code = -1 response.message = 'not find status code' @@ -31,11 +30,12 @@ end function _M:json(status, data, http_status) -- you can modify this response struct as you favor + if status == 0 then status = ngx.HTTP_OK end local msg = '' - local response_status = http_status or ngx.OK + local response_status = http_status or ngx.HTTP_OK 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 response.code = -1 response.message = 'not find status code'