我想在第一次登录时设置某些变量,而我正在使用外部API。例如。仅在第一次登录时,我们创建var score 0,以及一系列与配置文件相关的不同变量。流星;如何为新用户设置一个时间变量?
Accounts.onLogin(function() {
// To retrieve more details about user
var steamApiKey = ("XXXXXXXXXXXXXXXXXXXX"); //Steam API KEY
var steam64Id = Meteor.user().profile.id; //User's Steam 64 ID
var result = Meteor.http.get('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' + steamApiKey + '&steamids=' + steam64Id);
Meteor.users.update(Meteor.userId(), // Steam Nickname
{ $set: { 'profile.personaname': result.data.response.players[0].personaname}}
);
Meteor.users.update(Meteor.userId(), // Steam Avatar
{ $set: { 'profile.steamAvatar': result.data.response.players[0].avatarmedium}}
);
Meteor.users.update(Meteor.userId(),
{ $set: { 'profile.score': "0"}}
);
});
我只有这一点,我意识到它会随时更新为0,每次我登录即使寿我手动更新得分为100
在先进的感谢!
非常感谢您的工作。我不得不调整,以满足我的需求,但我认为*我得到了我需要的东西。欣赏它! – Farhan