123456789101112131415161718192021222324 |
- --用户
- local M = {}
- local mysqldbx = require "mysqldbx"
- local tools = require "tools"
- local skynet = require "skynet"
- function M.Login(msg_body)
- local isok ,key = tools.checkData({"account","password"},msg_body)
- if not isok then
- return false,string.format("缺少字段: %s.", key)
- end
- local sql = string.format("SELECT * FROM admin_user WHERE account = '%s' and password = '%s' ", msg_body.account, msg_body.password)
- local isok,res;
- res = mysqldbx.query(sql)
- if #res <= 0 then
- return false ,"账号或密码错误!"
- end
- return true, {}
- end
- return M
|