浏览代码

修改注册/登录

neo 1 年之前
父节点
当前提交
811548bca6
共有 2 个文件被更改,包括 5 次插入73 次删除
  1. 4 4
      dev/base/baseAdapt.lua
  2. 1 69
      nodes/login/controllers/usr.lua

+ 4 - 4
dev/base/baseAdapt.lua

@@ -11,13 +11,13 @@ local sharetable = require "skynet.sharetable"
11 11
 
12 12
 local dir = skynet.getenv("config_path")
13 13
 
14
-local baseAdapt = {}
14
+local root = {}
15 15
 
16
-function baseAdapt:getConfig(name)
16
+function root:getConfig(name)
17 17
     return sharetable.query(dir .. name .. ".lua")
18 18
 end
19 19
 
20
-function baseAdapt:getOneConfig(name, value, key)
20
+function root:getOneConfig(name, value, key)
21 21
     local conf = self:getConfig(name)
22 22
     if not conf then
23 23
         return
@@ -31,4 +31,4 @@ function baseAdapt:getOneConfig(name, value, key)
31 31
     end
32 32
 end
33 33
 
34
-return baseAdapt
34
+return root

+ 1 - 69
nodes/login/controllers/usr.lua

@@ -82,8 +82,7 @@ function root.register(msg)
82 82
         msg.sysVer or "",
83 83
         msg.uuid,
84 84
         msg.udid,
85
-        msg.ip,
86
-        msg.idfa
85
+        msg.ip
87 86
     }
88 87
     logRegister:raw(table.concat(cntDatas, ";"))
89 88
 
@@ -160,74 +159,4 @@ function root.login(msg)
160 159
     return code.OK, ret
161 160
 end
162 161
 
163
-local function l_get_account_uid(account)
164
-    if is_empty(account) then
165
-        return
166
-    end
167
-    local sql = string.format("select max(uid) as uid from mdl_account where account = '%s';", account)
168
-    local result = lib_game_mysql:query(sql)
169
-    log.info("l_is_account_registed account[%s] result[%s]", tostring(account), tostring(result))
170
-    if is_empty(result) then
171
-        return
172
-    end
173
-
174
-    local uid = result[1]["uid"]
175
-    if is_nil(uid) then
176
-        return
177
-    end
178
-    return tonumber(uid)
179
-end
180
-function root.account_register(msg)
181
-    local account, password = msg.account, msg.password
182
-    if is_empty(account) or is_empty(password) then
183
-        return code.PARAMTER_ERROR
184
-    end
185
-
186
-    msg.password = nil
187
-    -- 重置uuid
188
-    local errCode, ret = root.register(msg)
189
-    if not code.is_ok(errCode) then
190
-        return errCode
191
-    end
192
-
193
-    -- 账号信息
194
-    local uid = l_get_account_uid(account)
195
-    if uid then
196
-        return code.USR.ALREADY_REGISTER
197
-    end
198
-    -- 新增账号
199
-    local sql =
200
-        string.format(
201
-        "replace into `mdl_account` (`uid`, `account`, `password`) VALUE (%s, '%s', '%s');",
202
-        tostring(uid),
203
-        account,
204
-        password
205
-    )
206
-    lib_game_mysql:query(sql)
207
-
208
-    return code.OK, {uid = ret.uid, password = ret.password}
209
-end
210
-function root.account_login(msg)
211
-    local account, password = msg.account, msg.password
212
-    if is_empty(account) or is_empty(password) then
213
-        return code.PARAMTER_ERROR
214
-    end
215
-
216
-    local uid = l_get_account_uid(account)
217
-    if is_empty(uid) then
218
-        return code.USR.NOT_EXIST_USER
219
-    end
220
-
221
-    -- 密码检验
222
-    if not userData:user_is_match_password(password) then
223
-        return code.USR.LOGIN_PASSWORD_ERROR
224
-    end
225
-
226
-    msg.password = password
227
-    return root.login(msg)
228
-end
229
-
230 162
 return root