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); } }
public function actionGateway() { //var_dump( Yii::app()->request->baseUrl.'/protected/components/Config/Store.php');exit; var_dump(Gateway::getOnlineStatus()); $store = Store::instance('wymenu'); $printData = $store->get('0000000012'); var_dump($printData); exit; $ret = $store->set('0000000012', '上海滩的愛している222'); echo "ddd"; //Gateway::sendToAll(json_encode(array(a=>"上海滩的愛している",b=>"ddddd11111:"))); Gateway::sendToAll('{"a":"上海滩的愛している","b":"ddddd11111:"}'); echo "eee"; }