/** * 写入通知信息 * 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; }
public function updateLog(WindidNotifyLogDm $dm) { if (($result = $dm->beforeUpdate()) !== true) { return $result; } return $this->_getDao()->update($dm->logid, $dm->getData(), $dm->getIncreaseData()); }
/** * 写入通知信息 * * @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; }
protected function updateLog() { $logDs = $this->_getNotifyLogDs(); foreach ($this->logId as $k => $v) { $dm = new WindidNotifyLogDm($k); if ($v == 'seccess') { $dm->setComplete(1)->setIncreaseSendNum(1); } else { $dm->setComplete(0)->setIncreaseSendNum(1)->setReason('fail'); } $logDs->updateLog($dm); } return true; }