public function pushMessage($toUids, $data)
{
$clients = $this->getClientByUser($toUids);
if ($clients) {
if (!class_exists('Gateway', false)) {
require ADDON_PATH . '/library/GatewayClient/Gateway.php';
}
foreach ($data as &$rs) {
$rs['message_id'] = (int) $rs['message_id'];
$rs['from_uid'] = (int) $rs['from_uid'];
$rs['room_id'] = (int) $rs['list_id'];
$rs['mtime'] = (int) $rs['mtime'];
$rs['from_uname'] = (string) getUserName($rs['from_uid']);
if (isset($rs['attach_id'])) {
$rs['attach_id'] = @desencrypt($rs['attach_id'], C('SECURE_CODE'));
}
$rs['content'] = $this->htmlDecode($rs['content']);
if (isset($rs['location'])) {
$rs['location'] = $this->htmlDecode($rs['location']);
}
if (isset($rs['title'])) {
$rs['title'] = $this->htmlDecode($rs['title']);
}
unset($rs['list_id']);
}
$data = json_encode(array('type' => 'push_message', 'result' => array('from' => 'web', 'length' => count($data), 'list' => $data), 'status' => 0, 'msg' => ''));
Gateway::sendToAll($data, $clients);
}
}