数据表1对1进行关联关系数据表测试
This commit is contained in:
parent
36585af2fe
commit
2cbc1228e4
|
|
@ -17,34 +17,8 @@ local redis = require("share.redis")
|
|||
|
||||
--max =a and b or c--a?b:c
|
||||
|
||||
local radix = require("resty.radixtree")
|
||||
--[[
|
||||
local opts = {
|
||||
--host = ngx.var.host,
|
||||
method = ngx.var.request_method,
|
||||
--remote_addr = ngx.var.remote_addr,
|
||||
matched = {}
|
||||
}
|
||||
|
||||
local vars = {
|
||||
{"arg_name", "==", "json"},
|
||||
{"arg_weight", ">", 10},
|
||||
}
|
||||
|
||||
local rx = radix.new({
|
||||
{
|
||||
paths = {"/aa"},
|
||||
methods = {"GET"},
|
||||
filter_fun = function(vars)
|
||||
return vars["perms"] == "json"
|
||||
end,
|
||||
}
|
||||
})
|
||||
|
||||
-- try to match
|
||||
ngx.say(rx:match("/aa", opts, opts.matched))
|
||||
--]]
|
||||
|
||||
local radix = require("resty.radixtree")
|
||||
|
||||
-- 路由处理函数注册表
|
||||
local function user_handler(m)
|
||||
|
|
@ -79,12 +53,7 @@ local opts = {
|
|||
|
||||
-- 使用dispatch方法进行路由匹配
|
||||
local ok = rx:dispatch("/user/123", opts, opts.matched)
|
||||
|
||||
--local result, err = rx:match("/user/123", opts, opts.matched)
|
||||
--if result then
|
||||
-- print(result)
|
||||
-- --result.handler(opts, result.metadata)
|
||||
--end
|
||||
--]]
|
||||
|
||||
--[[
|
||||
--获取用户相关的角色数据的数据
|
||||
|
|
@ -132,6 +101,7 @@ ngx.say(addlib.add(5,7))
|
|||
-- ngx.say("zhangsan-system:user:list is not exist")
|
||||
--end
|
||||
|
||||
--[[
|
||||
local val1, err = redis:get("admin-system:user:add")
|
||||
local val2, err = redis:get("admin-system:user:edit")
|
||||
local val3, err = redis:get("admin-system:user:delete")
|
||||
|
|
@ -147,6 +117,8 @@ local val6, err = redis:get("admin-system:user:test")
|
|||
if val6 ~= nil then
|
||||
ngx.say("test:"..val6)
|
||||
end
|
||||
--]]
|
||||
|
||||
--[[
|
||||
local uuid = require("resty.jit-uuid")
|
||||
uuid.seed()
|
||||
|
|
@ -357,12 +329,14 @@ else
|
|||
end
|
||||
--]]
|
||||
|
||||
--[[
|
||||
--引用使用的库文件
|
||||
local Model = require("share.model")
|
||||
--创建一个数据表相关的模型
|
||||
local userModel = Model:new('sys_user')
|
||||
|
||||
local user_and_role = userModel:where('id', '=', "1"):with('sys_role'):get()
|
||||
|
||||
--[[
|
||||
--获取数据表中的记录数
|
||||
local code, res = userModel:count()
|
||||
ngx.say(res)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user