当前位置: 首页>>代码示例>>PHP>>正文


PHP CPullStack::AddShared方法代码示例

本文整理汇总了PHP中CPullStack::AddShared方法的典型用法代码示例。如果您正苦于以下问题:PHP CPullStack::AddShared方法的具体用法?PHP CPullStack::AddShared怎么用?PHP CPullStack::AddShared使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CPullStack的用法示例。


在下文中一共展示了CPullStack::AddShared方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Set

 public static function Set($userId, $params)
 {
     $userId = intval($userId);
     if ($userId <= 0) {
         return false;
     }
     if (isset($params['STATUS'])) {
         $params['IDLE'] = null;
     }
     $needToUpdate = false;
     $params = self::PrepereFields($params);
     $res = IM\StatusTable::getById($userId);
     if ($status = $res->fetch()) {
         foreach ($params as $key => $value) {
             $oldValue = is_object($status[$key]) ? $status[$key]->toString() : $status[$key];
             $newValue = is_object($value) ? $value->toString() : $value;
             if ($oldValue != $newValue) {
                 $status[$key] = $value;
                 $needToUpdate = true;
             }
         }
         if ($needToUpdate) {
             IM\StatusTable::update($userId, $params);
         }
     } else {
         $params['USER_ID'] = $userId;
         IM\StatusTable::add($params);
         $needToUpdate = true;
         $status = $params;
     }
     if ($needToUpdate && self::Enable()) {
         CPullStack::AddShared(array('module_id' => 'online', 'command' => 'user_status', 'params' => self::PrepereToPush($status)));
     }
     return true;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:35,代码来源:im_status.php

示例2: afterUpdateTrigger

 /**
  * Method will be invoked after an database record updated.
  *
  * @param array $oldRecord All fields before update.
  * @param array $newRecord All fields after update.
  *
  * @return void
  */
 public function afterUpdateTrigger(array $oldRecord, array $newRecord)
 {
     if ($oldRecord["STATUS"] !== $newRecord["STATUS"]) {
         if (\CIMStatus::Enable()) {
             \CPullStack::AddShared(array('module_id' => 'online', 'command' => 'user_status', 'expiry' => 120, 'params' => array("USER_ID" => $newRecord["USER_ID"], "STATUS" => $newRecord["STATUS"])));
         }
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:16,代码来源:statushandler.php

示例3: CancelRatingVote

 public static function CancelRatingVote($arParam)
 {
     global $DB, $CACHE_MANAGER;
     $err_mess = CRatings::err_mess() . "<br>Function: CancelRatingVote<br>Line: ";
     $sqlStr = "\n\t\t\tSELECT\n\t\t\t\tRVG.ID,\n\t\t\t\tRV.ID AS VOTE_ID,\n\t\t\t\tRV.VALUE AS VOTE_VALUE,\n\t\t\t\tRVG.TOTAL_POSITIVE_VOTES\n\t\t\tFROM\n\t\t\t\tb_rating_voting RVG,\n\t\t\t\tb_rating_vote RV\n\t\t\tWHERE\n\t\t\t\tRVG.ENTITY_TYPE_ID = '" . $DB->ForSql($arParam['ENTITY_TYPE_ID']) . "'\n\t\t\tand RVG.ENTITY_ID = " . intval($arParam['ENTITY_ID']) . "\n\t\t\tand RVG.ID = RV.RATING_VOTING_ID\n\t\t\tand RV.USER_ID = " . intval($arParam['USER_ID']);
     $res = $DB->Query($sqlStr, false, $err_mess . __LINE__);
     if ($arVote = $res->Fetch()) {
         $votePlus = $arVote['VOTE_VALUE'] >= 0 ? true : false;
         $arFields = array('TOTAL_VOTES' => "TOTAL_VOTES-1", 'TOTAL_VALUE' => "TOTAL_VALUE" . ($votePlus ? '-' . floatval($arVote['VOTE_VALUE']) : '+' . floatval(-1 * $arVote['VOTE_VALUE'])), 'LAST_CALCULATED' => $DB->GetNowFunction());
         $arFields[$votePlus ? 'TOTAL_POSITIVE_VOTES' : 'TOTAL_NEGATIVE_VOTES'] = $votePlus ? 'TOTAL_POSITIVE_VOTES-1' : 'TOTAL_NEGATIVE_VOTES-1';
         $DB->Update("b_rating_voting", $arFields, "WHERE ID=" . intval($arVote['ID']), $err_mess . __LINE__);
         $DB->Query("DELETE FROM b_rating_vote WHERE ID=" . intval($arVote['VOTE_ID']), false, $err_mess . __LINE__);
         foreach (GetModuleEvents("main", "OnCancelRatingVote", true) as $arEvent) {
             ExecuteModuleEventEx($arEvent, array(intval($arVote['VOTE_ID']), $arParam));
         }
         if (CModule::IncludeModule('pull')) {
             CPullStack::AddShared(array('module_id' => 'main', 'command' => 'rating_vote', 'params' => array("TYPE" => "CANCEL", "USER_ID" => intval($arParam['USER_ID']), "ENTITY_TYPE_ID" => $arParam["ENTITY_TYPE_ID"], "ENTITY_ID" => intval($arParam['ENTITY_ID']), "TOTAL_POSITIVE_VOTES" => intval($arVote['TOTAL_POSITIVE_VOTES'] + ($votePlus ? -1 : 1)), "RESULT" => $votePlus ? 'PLUS' : 'MINUS')));
         }
         if (CACHED_b_rating_vote !== false) {
             $bucket_size = intval(CACHED_b_rating_bucket_size);
             if ($bucket_size <= 0) {
                 $bucket_size = 100;
             }
             $bucket = intval(intval($arParam['ENTITY_ID']) / $bucket_size);
             $CACHE_MANAGER->Clean("b_rvg_" . $DB->ForSql($arParam["ENTITY_TYPE_ID"]) . $bucket, "b_rating_voting");
         }
         return true;
     }
     return false;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:30,代码来源:ratings.php

示例4: OnAfterUserLogout

	public static function OnAfterUserLogout($arParams)
	{
		if (!CPullOptions::GetQueueServerStatus())
			return false;

		if ($arParams['USER_ID'] <= 0)
			return false;

		$arParams['USER_ID'] = intval($arParams['USER_ID']);

		if (isset($_SESSION['USER_LAST_LOGOUT_'.$arParams['USER_ID']])
			&& intval($_SESSION['USER_LAST_LOGOUT_'.$arParams['USER_ID']])+100 > time())
			return false;

		$_SESSION['USER_LAST_LOGOUT_'.$arParams['USER_ID']] = time();
		unset($_SESSION['USER_LAST_AUTH_'.$arParams['USER_ID']]);

		$arChannel = CPullChannel::GetChannel($arParams['USER_ID']);
		$result = CPullChannel::Send($arChannel['CHANNEL_ID'], 'ping', 'GET', 5, false);
		if (is_object($result) && isset($result->infos[0]))
		{
			$sendOffline = $result->infos[0]->subscribers > 0? false: true;
		}
		else
		{
			$sendOffline = true;
		}

		if ($sendOffline)
		{
			CPullStack::AddShared(Array(
				'module_id' => 'online',
				'command' => 'user_offline',
				'params' => Array(
					'USER_ID' => $arParams['USER_ID']
				),
			));
		}

		return true;
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:41,代码来源:pull_channel.php

示例5: UnlinkGeneralChatId

 public static function UnlinkGeneralChatId()
 {
     COption::RemoveOption("im", "general_chat_id");
     if (CModule::IncludeModule('pull')) {
         CPullStack::AddShared(array('module_id' => 'im', 'command' => 'generalChatId', 'params' => array("ID" => 0)));
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:8,代码来源:im_chat.php

示例6: OnAfterUserLogout

	public static function OnAfterUserLogout($arParams)
	{
		if ($arParams['USER_ID'] <= 0)
			return false;

		$arParams['USER_ID'] = intval($arParams['USER_ID']);

		if (isset($_SESSION['USER_LAST_LOGOUT_'.$arParams['USER_ID']])
			&& intval($_SESSION['USER_LAST_LOGOUT_'.$arParams['USER_ID']])+100 > time())
			return false;

		$_SESSION['USER_LAST_LOGOUT_'.$arParams['USER_ID']] = time();
		unset($_SESSION['USER_LAST_AUTH_'.$arParams['USER_ID']]);

		CPullStack::AddShared(Array(
			'module_id' => 'main',
			'command' => 'user_logout',
			'params' => Array(
				'USER_ID' => $arParams['USER_ID']
			),
		));
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:22,代码来源:pull_channel.php


注:本文中的CPullStack::AddShared方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。