Добавлен новый api: checkinuser

Клиент вызывает этот метод при старте
Переименован старый api-метод
This commit is contained in:
Denis Smirnov 2013-10-24 10:37:23 +04:00
parent 1d00b8f3e1
commit d9bba851b0
6 changed files with 20 additions and 4 deletions

Binary file not shown.

Binary file not shown.

2
client

@ -1 +1 @@
Subproject commit e6d506f6cbd01943527317e64d55c78c3ef86e3b
Subproject commit 3f19818df431f0fe2f6219b18c3f6fdfc6c2b29e

View File

@ -1,3 +1,4 @@
Devices = new Meteor.Collection("devices");
Users = new Meteor.Collection("users");
Devices_Type = new Meteor.Collection("device_types");
Devices_Type = new Meteor.Collection("device_types");
Log_User_Login = new Meteor.Collection("log_user_login");

View File

@ -1,11 +1,11 @@
Meteor.startup(function () {
RESTstop.add('checkin/:param', function () {
RESTstop.add('checkindevice/:param', function () {
var param = this.params.param;
var mac = param.substring(0, 12);
var uid = param.substring(13);
console.log("Пришел запрос: MAC = " + mac + ", UID = " + uid);
console.log("Запрос api-метода checkindevice: MAC = " + mac + ", UID = " + uid);
var user = GetUserByMAC(mac);
if (!user)

View File

@ -0,0 +1,15 @@
Meteor.startup(function () {
RESTstop.add('checkinuser/:mac', function () {
var mac = this.params.mac;
console.log("Запрос api-метода checkinuser: MAC = " + mac);
var user = GetUserByMAC(mac);
if (!user)
return "Can't find such MAC-addreses";
var date = new Date();
Log_User_Login.insert({name: user.name, surname: user.sername, login_date: date});
});
});