'use strict'; var P = require('quick-pomelo').Promise; var util = require('util'); var logger = require('quick-pomelo').logger.getLogger('hallRemote', __filename); var Remote = function (app) { this.app = app; }; module.exports = function (app) { return new Remote(app); }; Remote.prototype.leave = function (playerId, cb) { var app = this.app; return app.memdb.goose.transactionAsync(function () { // console.warn("大厅用户离开了"); app.controllers.bisai.delPlayer(playerId); return ; }, app.getServerId()) .then(res => (app.event.emit('transactionSuccess'), res), res => (app.event.emit('transactionFail'), res)) .nodeify(cb); }; Remote.prototype.creatTable = function (data, cb) { var app = this.app; return app.memdb.goose.transactionAsync(function () { // console.warn("hallremote 大厅创建房间 "+JSON.stringify(data)); app.controllers.bisai.addTable(data.id,data.agentId,data.playerAllCount); return ; }, app.getServerId()) .then(res => (app.event.emit('transactionSuccess'), res), res => (app.event.emit('transactionFail'), res)) .nodeify(cb); }; Remote.prototype.delTable = function (data, cb) { var app = this.app; return app.memdb.goose.transactionAsync(function () { // console.warn("大厅删除房间 "); app.controllers.bisai.delTable(data.id,data.agentId); return ; }, app.getServerId()) .then(res => (app.event.emit('transactionSuccess'), res), res => (app.event.emit('transactionFail'), res)) .nodeify(cb); };