httpQueueMgr.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * 房间坑位管理http接口
  3. */
  4. 'use strict';
  5. var F = require('../common/function');
  6. var C = require('../config/index');
  7. var _ = require('underscore');
  8. _.str = require('underscore.string');
  9. _.v = require('validator');
  10. var co = require('co');
  11. module.exports = function (app) {
  12. var mgr_map = app.common_mgr.mgr_map;
  13. var http_app = app.app;
  14. /**
  15. * 5.7.http:Java服务同步修改坑位/麦位接口(Java→IM)
  16. * @param room_id 房间id
  17. * @param type 整形 1:更新key 2:删除key
  18. * @param key 队列下标
  19. * @param value 坑位信息
  20. */
  21. http_app.regPost('/imroom/:apiVer/pushRoomMicUpdateNotice', function* (ctx) {
  22. // TODO 添加用户是否在房间判断
  23. yield F.checkParamsNull(ctx, "room_id, type, key, value"); // ext参数不能为空
  24. let room_id = ctx.I.room_id;
  25. let type = ctx.I.type;
  26. let key = ctx.I.key;
  27. let value = ctx.I.value;
  28. let room_info = yield mgr_map.room.getRoomInfo(room_id);
  29. if (F.isNull(room_info)) {
  30. F.throwErrCode(100200);
  31. }
  32. let room_socket = yield mgr_map.redis.getRoomSocketList(room_id);
  33. // TODO:根据type区分类型
  34. yield mgr_map.notice.pushQueueMicUpdateNotice(room_socket, room_id, key, value);
  35. F.setResJson(ctx, 0);
  36. });
  37. };