const system = require('../../../system');
const settings = require('../../../../config/settings');
class SocketNotifyCtl {
  constructor() {
  }
  setSocketServer(s) {
    this.socketServer = s;
  }
  // 异步推送消息到客户端
  notifyClientMsg(user, msg) {
    const uk = this.buildPrivateChannel(user);
    const msgHandler = this.socketServer.users[uk];
    msgHandler.notifyClient(uk, msg);
  }
  buildPrivateChannel(user) {
    const ukchannel = `${user.app_id}￥${user.id}`;
    return ukchannel;
  }
  buildMsgTarget(user) {
    const ukchannel = `${user.app_id}￥${user.id}`;
    const { nickName } = user;
    const { imgUrl } = user;
    const rtn = `${ukchannel}￥${nickName}￥${imgUrl}`;
    return rtn;
  }
}
module.exports = SocketNotifyCtl;
