package com.game;

import com.taurus.core.entity.ITObject;
import com.taurus.core.entity.TObject;
import com.taurus.core.plugin.redis.Redis;

/**
 * 圈子订阅服务
 */
public class GroupPublisherService {
	public static final String CHANNEL_NAME = "mgr_group";
	
	private static final String CMD_DEL_ROOM="del_room";
	private static final String CMD_UPDATE_ROOM="update_room";
	
	/**
	 * 删除房间事件
	 * @param groupId
	 * @param roomid
	 */
	public static void delRoomEvt(int groupId,String roomid) {
		if(groupId == 0)return;
		ITObject data = TObject.newInstance();
		data.putInt("gid", groupId);
		data.putUtfString("roomid", roomid);
		data.putUtfString("cmd", CMD_DEL_ROOM);
		Redis.use("group1_db11").publish(CHANNEL_NAME, data.toJson());
	}
	
	/**
	 * 更新房间事件
	 * @param groupId
	 * @param roomid
	 */
	public static void updateRoomEvt(int groupId,String roomid) {
		if(groupId == 0)return;
		ITObject data = TObject.newInstance();
		data.putInt("gid", groupId);
		data.putUtfString("roomid", roomid);
		data.putUtfString("cmd", CMD_UPDATE_ROOM);
		Redis.use("group1_db11").publish(CHANNEL_NAME, data.toJson());
	}

}
