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


PHP CUserCounter::Increment方法代码示例

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


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

示例1: delegateTask

 public static function delegateTask($taskId, $fromUserId, $toUserId)
 {
     global $DB;
     $taskId = (int) $taskId;
     $fromUserId = (int) $fromUserId;
     $toUserId = (int) $toUserId;
     if (!$taskId || !$fromUserId || !$toUserId) {
         return false;
     }
     $originalUserId = 0;
     //check ORIGINAL_USER_ID
     $iterator = $DB->Query('SELECT ORIGINAL_USER_ID' . ' FROM b_bp_task_user' . ' WHERE TASK_ID = ' . $taskId . ' AND USER_ID = ' . $fromUserId);
     $row = $iterator->fetch();
     if (!empty($row['ORIGINAL_USER_ID'])) {
         $originalUserId = $row['ORIGINAL_USER_ID'];
     }
     // check USER_ID (USER_ID must be unique for task)
     $iterator = $DB->Query('SELECT USER_ID' . ' FROM b_bp_task_user' . ' WHERE TASK_ID = ' . $taskId . ' AND USER_ID = ' . $toUserId);
     $row = $iterator->fetch();
     if (!empty($row['USER_ID'])) {
         return false;
     }
     $DB->Query("UPDATE b_bp_task_user SET USER_ID = " . $toUserId . (!$originalUserId ? ', ORIGINAL_USER_ID = ' . $fromUserId : '') . " WHERE TASK_ID = " . $taskId . " AND USER_ID = " . $fromUserId, true);
     CUserCounter::Decrement($fromUserId, 'bp_tasks', '**');
     CUserCounter::Increment($toUserId, 'bp_tasks', '**');
     self::onTaskChange($taskId, array('USERS' => array($toUserId), 'USERS_REMOVED' => array($fromUserId)), CBPTaskChangedStatus::Delegate);
     return true;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:28,代码来源:taskservice.php

示例2: Update

 public static function Update($id, $arFields)
 {
     global $DB;
     $id = intval($id);
     if ($id <= 0) {
         throw new Exception("id");
     }
     self::ParseFields($arFields, $id);
     $strUpdate = $DB->PrepareUpdate("b_bp_task", $arFields);
     $strSql = "UPDATE b_bp_task SET " . "\t" . $strUpdate . ", " . "\tMODIFIED = " . $DB->CurrentTimeFunction() . " " . "WHERE ID = " . intval($id) . " ";
     $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if (is_set($arFields, "USERS")) {
         $DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
         CUserCounter::ClearByTag($id, 'bp_tasks', '**');
         $ar = array();
         foreach ($arFields["USERS"] as $userId) {
             $userId = intval($userId);
             if (in_array($userId, $ar)) {
                 continue;
             }
             $DB->Query("INSERT INTO b_bp_task_user (USER_ID, TASK_ID) " . "VALUES (" . intval($userId) . ", " . intval($id) . ") ");
             CUserCounter::Increment($userId, 'bp_tasks', '**');
             $ar[] = $userId;
         }
     }
     $events = GetModuleEvents("bizproc", "OnTaskUpdate");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($id, $arFields));
     }
     return $id;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:taskservice.php

示例3: Update

 public static function Update($id, $arFields)
 {
     global $DB;
     $id = intval($id);
     if ($id <= 0) {
         throw new Exception("id");
     }
     self::ParseFields($arFields, $id);
     $strUpdate = $DB->PrepareUpdate("b_bp_task", $arFields);
     $strSql = "UPDATE b_bp_task SET " . "\t" . $strUpdate . ", " . "\tMODIFIED = " . $DB->CurrentTimeFunction() . " " . "WHERE ID = " . intval($id) . " ";
     $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $removedUsers = array();
     if (is_set($arFields, "USERS")) {
         $dbResUser = $DB->Query("SELECT USER_ID FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
         while ($arResUser = $dbResUser->Fetch()) {
             CUserCounter::Decrement($arResUser["USER_ID"], 'bp_tasks', '**');
             $removedUsers[] = $arResUser["USER_ID"];
         }
         $DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
         $ar = array();
         foreach ($arFields["USERS"] as $userId) {
             $userId = intval($userId);
             if (in_array($userId, $ar)) {
                 continue;
             }
             $DB->Query("INSERT INTO b_bp_task_user (USER_ID, TASK_ID, ORIGINAL_USER_ID) " . "VALUES (" . intval($userId) . ", " . intval($id) . ", " . intval($userId) . ") ");
             CUserCounter::Increment($userId, 'bp_tasks', '**');
             $ar[] = $userId;
         }
     }
     $userStatuses = array();
     if (isset($arFields['STATUS']) && $arFields['STATUS'] > CBPTaskStatus::Running) {
         $dbResUser = $DB->Query("SELECT USER_ID FROM b_bp_task_user WHERE TASK_ID = " . $id . " AND STATUS = " . CBPTaskUserStatus::Waiting);
         while ($arResUser = $dbResUser->Fetch()) {
             CUserCounter::Decrement($arResUser["USER_ID"], 'bp_tasks', '**');
             if ($arFields['STATUS'] == CBPTaskStatus::Timeout) {
                 $userStatuses[$arResUser["USER_ID"]] = CBPTaskUserStatus::No;
             } else {
                 $removedUsers[] = $arResUser["USER_ID"];
             }
         }
         if ($arFields['STATUS'] == CBPTaskStatus::Timeout) {
             $DB->Query("UPDATE b_bp_task_user SET STATUS = " . CBPTaskUserStatus::No . ", DATE_UPDATE = " . $DB->CurrentTimeFunction() . " WHERE TASK_ID = " . $id . " AND STATUS = " . CBPTaskUserStatus::Waiting);
         } else {
             $DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . $id . " AND STATUS = " . CBPTaskUserStatus::Waiting);
         }
     }
     foreach (GetModuleEvents("bizproc", "OnTaskUpdate", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($id, $arFields));
     }
     if ($removedUsers) {
         $arFields['USERS_REMOVED'] = $removedUsers;
     }
     if ($userStatuses) {
         $arFields['USERS_STATUSES'] = $userStatuses;
     }
     self::onTaskChange($id, $arFields, CBPTaskChangedStatus::Update);
     return $id;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:59,代码来源:taskservice.php

示例4: Increment

 public static function Increment($code, $site_id = SITE_ID, $sendPull = true, $increment = 1)
 {
     return CUserCounter::Increment(CUserCounter::SYSTEM_USER_ID, $code, $site_id, $sendPull, $increment);
 }
开发者ID:Satariall,项目名称:izurit,代码行数:4,代码来源:global_counter.php

示例5: processUsersCounters

 private static function processUsersCounters($counterId, $operation, $arUsers, $delta)
 {
     if (!is_array($arUsers)) {
         CTaskAssert::logError('[0x9418f293] ');
         return;
     }
     $arUsers = array_unique($arUsers);
     if ($operation === self::OP_DECREMENT) {
         foreach ($arUsers as $userId) {
             $userId = (int) $userId;
             if ($userId < 1) {
                 CTaskAssert::logError('[0x8886cc18] ');
                 continue;
             }
             //$x = '[USER_ID= ' . $userId . '] ' . $counterId . '--';
             //soundex($x);
             CUserCounter::Decrement($userId, $counterId, '**', false, $delta);
         }
     } elseif ($operation === self::OP_INCREMENT) {
         foreach ($arUsers as $userId) {
             $userId = (int) $userId;
             if ($userId < 1) {
                 CTaskAssert::logError('[0x01f722e7] ');
                 continue;
             }
             //$x = '[USER_ID= ' . $userId . '] ' . $counterId . '+=' . $delta;
             //soundex($x);
             CUserCounter::Increment((int) $userId, $counterId, '**', false, $delta);
         }
     } else {
         CTaskAssert::logError('[0x0a5999d4] Invalid operation: ' . $operation);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:33,代码来源:countersprocessor.php


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