嘿所以我面临这个问题2天了,我试着阅读文档并没有解决它,
然后我尝试自己无法修复它!
代码:
function handleInternalEvent(evt) {
var Event = evt.name
trace("Event:" + Event)
if (evt.name == "loginRequest")
{
var error = ""
var nick = evt["nick"].split("~")[0]
var pass = evt["pass"]
var chan = evt["chan"]
var sql = "SELECT * FROM users WHERE username='" + nick + "'"
var SQL_Result = dbase.executeQuery(sql)
if (SQL_Result != null && SQL_Result.size() > 0) {
var tempRow = SQL_Result.get(0)
var user_id = tempRow.getItem("id")
}
var obj = _server.loginUser(nick, pass, chan)
if (obj.success == true) {
var user = _server.getUserByChannel(chan)
user.properties.put("id", user_id)
trace("UserID:" + user.getUserId())
}
}
}
请注意,数据库中的用户ID是1而不是0
我没有看到任何问题,感谢任何帮助
此外,当我跟踪user_id时,我需要数据库ID
它表明 [wqw.as]:UserID:1
跟踪输出:
DB Manager Activated ( com.mysql.jdbc.Driver )
Zone: zone_master
somerandomroomw... (id: 1, max: 40, pass:N)
09:31:04.838 - [ INFO ] > Zone Extension [ zm ] created, for zone:zone_master
[wqw.as]: Test - SmartFoxServer
--- [ Server Starting ] ---------------------------------
Server address: All
Server port : 5588
09:31:04.881 - [ INFO ] > [TaskScheduler] ... started ::
09:31:04.882 - [ INFO ] > [BlueBoxHandler]... started ::
09:31:04.883 - [ INFO ] > [EventWriter] ..... started :: 1 thread(s)
09:31:04.884 - [ INFO ] > [SystemHandler] ... started :: 1 thread(s)
09:31:04.885 - [ INFO ] > [ExtensionHandler]. started :: 1 thread(s)
09:31:04.886 - [ INFO ] > [DeadChannelsPolicy: strict]
09:31:04.886 - [ INFO ] > Server is up and running!
[wqw.as]: Event:serverReady
[wqw.as]: Event:loginRequest
[wqw.as]: UserID:0