调试token接口中的返回token接口的验证验证用户信息等问题
This commit is contained in:
parent
23826f0cd5
commit
30fdac7cf8
|
|
@ -88,6 +88,9 @@ function _M.getApplicationByUserid(user_id, client_id, client_secret)
|
|||
return applicationDao.getApplicationByUserid(user_id, client_id, client_secret)
|
||||
end
|
||||
|
||||
function _M.addApplicationToken(client_id, ret)
|
||||
return applicationTokenDao.addApplicationToken(client_id, ret)
|
||||
end
|
||||
function _M.updateApplicationToken(client_id, ret)
|
||||
return applicationTokenDao.updateApplicationToken(client_id, ret)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ local _M = {}
|
|||
--判断应用是否存在
|
||||
local function isExistApplicationToken(client_id)
|
||||
--根据应用id进行验证应用是否存在
|
||||
local code, res = applicationTokenModel:find(client_id)
|
||||
local code, res = applicationTokenModel:where("application_id", "=", client_id):get()
|
||||
if code ~= 0 or res == nil then
|
||||
return false
|
||||
end
|
||||
|
|
@ -38,7 +38,7 @@ function _M.getApplicationToken(id)
|
|||
end
|
||||
|
||||
--增加应用信息到数据表
|
||||
function _M.addSystemApplicationToken(client_id, jsonData)
|
||||
function _M.addApplicationToken(client_id, jsonData)
|
||||
--根据应用进行验证是否存在
|
||||
local code, res = applicationTokenModel:where("application_id", "=", client_id):get()
|
||||
if code ~= 0 or res == nil then
|
||||
|
|
@ -68,12 +68,13 @@ end
|
|||
function _M.updateApplicationToken(id, jsonData)
|
||||
--根据用户id进行验证用户是否存在
|
||||
local ok = isExistApplicationToken(id)
|
||||
|
||||
--用户不存在则返回
|
||||
if ok == false then
|
||||
return 0x000001,nil
|
||||
jsonData.application_id = id
|
||||
return applicationTokenModel:create(jsonData)
|
||||
end
|
||||
--对数据内容进行更
|
||||
jsonData.update_time = ngx.time()
|
||||
return applicationTokenModel:where('application_id', '=', id):update(jsonData)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ local function authorizateCode(args)
|
|||
ret.refresh_token = new_refresh_token
|
||||
ret.id_token = new_id_token
|
||||
-- 6.将生成的数据存储到数据库中
|
||||
local code, res = oauthDao.addSystemApplicationToken(client_id, ret)
|
||||
local code, res = oauthDao.updateApplicationToken(client_id, ret)
|
||||
if code ~= 0 then
|
||||
local result = resp:json(0x000001)
|
||||
resp:send(result)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user