--- --- Generated by EmmyLua(https://github.com/EmmyLua) --- Created by frankly. --- DateTime: 2025/10/29 23:36 --- local userDao = require("dao.system.user") local _M = {} --认证用户返回用户数据信息 local function authenticate(name, passwd) --验证用户名是否为空 if name == "" then return 0x010003, nil end --验证密码是否为空 if passwd == "" then return 0x010002, nil end return userDao:adjustUser(name, passwd) end --用户登录业务逻辑处理 function _M.login(jsonData) --解析json中的键和数据值 local name = jsonData["username"] local passwd = jsonData["password"] local captcha = jsonData["captcha"] local checkKey = jsonData["checkKey"] --验证用户名是否为空 local code, res = authenticate(name, passwd) if code ~= 0 then return 0x000001,res end local num = 0 if res ~= nil then num = table.getn(res) end --用户存在时返回用户已经存在 if num <= 0 then return 0x01000C,nil end local userid = res[1].id --获取用户id查询角色信息 local err, rest = userDao:userRole(userid) if rest == nil then return 0x01000C,nil end res[1].role_id = rest[1].role_id res[1].role_name = rest[1].role_name return 0, res end --用户登出业务逻辑处理 function _M.logout(jsonData) local code = 0 local ret = "{}" return code, ret end --用户注册业务逻辑处理 function _M.signup(jsonData) return userDao:addSystemUser(jsonData) end function _M.getUser(userid) return userDao:getSystemUser(userid) end return _M