/** * 写入通知信息 * Enter description here ... * @param int $method * @param multi $data * @param bool $iswindid */ public function send($method, $data, $iswindid = false) { $client = Windid::client(); if ($client->windid == 'local' && !$iswindid) { return true; } $operation = array_search($method, $this->notify); if (!$operation) { return false; } $clientid = $iswindid ? 0 : $client->clientId; $time = Windid::getTime(); $nid = $this->_getNotifyDs()->addNotify($clientid, $operation, $data, $time); if (!$nid) { return false; } $apps = $this->_getAppDs()->getList(); $dms = array(); foreach ($apps as $val) { if (!$val['isnotify'] || $val['id'] == $clientid) { continue; } $dm = new WindidNotifyLogDm(); $dm->setAppid($val['id'])->setNid($nid); $dms[] = $dm; } $this->_getNotifyLogDs()->multiAddLog($dms); register_shutdown_function(array($this, 'shutdownSend')); return true; }
/** * 写入通知信息 * * @param int $method * @param array $data * @param bool $iswindid */ public function send($method, $data, $appid = 0) { if (!($operation = $this->getOperation($method))) { return false; } if (!($nid = $this->_getNotifyDs()->addNotify($appid, $operation, serialize($data), Pw::getTime()))) { return false; } $apps = $this->_getAppDs()->getList(); $dms = array(); foreach ($apps as $val) { if (!$val['isnotify'] || $val['id'] == $appid) { continue; } $dm = new WindidNotifyLogDm(); $dm->setAppid($val['id'])->setNid($nid); $dms[] = $dm; } $this->_getNotifyLogDs()->multiAddLog($dms); register_shutdown_function(array(&$this, 'shutdownSend'), $nid); return true; }