|
@@ -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
|