<?php
/**
*消息队列
*/
class rabbitAction extends baseAction
{
	/**
	  * @method 发送消息
	  * @http	post
	  * @param  token              string [必填] 调用接口凭证 (post|get)
	  * @param  act                string [必填] 类型 TJ_API_PJL || TJ_WEB_YP
	  * @param  msg                array  [必填] 需要发送的信息数组
	  * @author soul
	  * @copyright 2017/10/31
	  * @return  末级车型ID
	  {"status":true,"data": ["send"=>10],"code":""}
	  {"status":false,"data":'失败原因',"code":''}
	  */
	public function send()
	{
		$MainRabbit = new MainRabbit($_POST['act']);
		$res = $MainRabbit->send($_POST['msg']);
		LibFc::EchoJson($res);
	}


	/**
	  * @method 发送一条消息
	  * @http	post
	  * @param  token              string [必填] 调用接口凭证 (post|get)
	  * @param  act                string [必填] 类型 TJ_API_PJL || TJ_WEB_YP
	  * @param  msg                string  [必填] '{"tj_uid":0,"tj_ip":"192.168.1.115","tj_from":"PJLH5"....}'
	  * @author soul
	  * @copyright 2017/10/31
	  * @return  末级车型ID
	  {"status":true,"data": ["send"=>10],"code":""}
	  {"status":false,"data":'失败原因',"code":''}
	  */
	public function sendOne()
	{
		$MainRabbit = new MainRabbit($_POST['act']);
		$res = $MainRabbit->send([$_POST['msg']]);
		LibFc::EchoJson($res);
	}


	/**
	  * @method 收集统计数据
	  * @http	post
	  * @param  token              string [必填] 调用接口凭证 (post|get)
	  * @param  act                string [必填] 类型 TJ_API_PJL || TJ_WEB_YP
	  * @param  msg                array  [必填] 需要发送的信息数组
	  * @author soul
	  * @copyright 2017/10/31
	  * @return  
	  {"status":true,"data": ["send"=>10],"code":""}
	  {"status":false,"data":'失败原因',"code":''}
	  */
	public function collTongji()
	{
		$MainRabbit = new MainRabbit($_POST['act']);
		$res = $MainRabbit->send([json_encode($_POST['msg'])]);
		LibFc::EchoJson($res);
	}


	/**
	  * @method 访问是否存在异常
	  * @http	post
	  * @param  token              string [必填] 调用接口凭证 (post|get)
	  * @param  act                string [必填] 类型 TJ_API_PJL || TJ_WEB_YP
	  * @param  msg                array  [必填] 需要发送的信息数组
	  * @author soul
	  * @copyright 2017/10/31
	  * @return  末级车型ID
	  {"status":true,"data": [],"code":""}
	  {"status":false,"data":'失败原因',"code":''}
	  */
	public function onlyCheckMonitor()
	{
		$PjltjMain = new PjltjMain();
		$res = $PjltjMain->onlyCheckMonitor($_POST['act'], $_POST['msg']);
		LibFc::EchoJson($res);
	}

	/**
	  * @method 获取监控规则
	  * @http	post
	  * @param  token              string [必填] 调用接口凭证 (post|get)
	  * @author soul
	  * @copyright 2017/10/31
	  * @return  末级车型ID
	  {"status":true,"data": [],"code":""}
	  {"status":false,"data":'失败原因',"code":''}
	  */
	public function getTjReg()
	{
		$PjltjMain = new PjltjMain();
		$res = $PjltjMain->getTjReg();
		LibFc::EchoJson($res);
	}
}