當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserCache::model方法代碼示例

本文整理匯總了PHP中UserCache::model方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserCache::model方法的具體用法?PHP UserCache::model怎麽用?PHP UserCache::model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserCache的用法示例。


在下文中一共展示了UserCache::model方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionRefreshOperations

 /**
  * actionRefreshOperations 
  * 
  * @param int $id - task id
  */
 public function actionRefreshOperations($id)
 {
     UserOperation::updateData();
     // Reset cache
     UserCache::model()->updateAll(array('status' => 0));
     $this->redirect(array('view', 'id' => $id));
 }
開發者ID:shakyapranin,項目名稱:IMS,代碼行數:12,代碼來源:UserTaskController.php

示例2: actionView

 /**
  * actionView 
  * 
  * @param int $id 
  */
 public function actionView($id)
 {
     $model = $this->loadModel($id);
     // Fill taskIds for checkBoxList
     foreach ($model->tasks as $task) {
         $model->taskIds[] = $task->id;
     }
     if (isset($_POST['UserRole']['taskIds'])) {
         UserRoleHasUserTask::model()->deleteAllByAttributes(array('user_role_id' => $id));
         // Reset cache
         UserCache::model()->updateAll(array('status' => 0));
         if (is_array($_POST['UserRole']['taskIds'])) {
             foreach ($_POST['UserRole']['taskIds'] as $taskId) {
                 $newTask = new UserRoleHasUserTask();
                 $newTask->user_role_id = $id;
                 $newTask->user_task_id = $taskId;
                 $newTask->save(false);
             }
         }
         Yii::app()->user->setFlash('taskSaved', 'aga');
         $this->redirect(array('view', 'id' => $id));
     }
     $this->render('view', compact('model'));
 }
開發者ID:shakyapranin,項目名稱:IMS,代碼行數:29,代碼來源:UserRoleController.php

示例3: _checkCache

 /**
  * _checkCache 
  *
  * Get agailiable routes from cache (or UserCache model)
  * 
  * @param boolean $forGuest
  *
  * @return array / CActiveRecord
  */
 private function _checkCache($forGuest = false)
 {
     if ($forGuest) {
         $userCache = UserCache::model()->find('is_guest = 1');
     } else {
         $user = User::model()->active()->with('cache')->findByPk((int) Yii::app()->user->id);
         // If no user (let's say he's been banned during session)
         // then return empty array - no allowed routes
         if (!$user) {
             return array();
         }
         $userCache = $user->cache;
     }
     // No cache
     if (!$userCache) {
         $cache = new UserCache();
         if (!$forGuest) {
             $cache->user_id = $user->id;
         }
         return $cache;
     } elseif ($userCache->status == 0) {
         return $userCache;
     } elseif ($userCache->update_time < time() - Yii::app()->getModule('UserAdmin')->cache_time) {
         return $userCache;
     } else {
         return unserialize($userCache->routes);
     }
 }
開發者ID:shakyapranin,項目名稱:IMS,代碼行數:37,代碼來源:UAccessController.php

示例4: afterDelete

 /**
  * afterDelete 
  * 
  * Reset cache
  */
 protected function afterDelete()
 {
     UserCache::model()->updateAll(array('status' => 0));
 }
開發者ID:shakyapranin,項目名稱:IMS,代碼行數:9,代碼來源:UserRole.php

示例5: faFastBiao

 /**
  * 
  * @param type $data
  * @return string
  * 參數傳入user用戶實體,keyword關鍵字
  */
 public static function faFastBiao($data = array())
 {
     $user = $data['user'];
     #沒有綁定的帳號
     if (!$user) {
         return '沒有綁定帳號,請先綁定帳號.';
     }
     #已經綁定的帳號
     $keyword = $data['keyword'];
     $fitkeyword = substr($keyword, 2);
     $thefitkeyword = strtolower($fitkeyword);
     $thefitkeyword = trim($thefitkeyword);
     $fastfabiaostatus = UserCache::model()->find("user_id=:user_id", array(":user_id" => $user->user_id));
     switch ($thefitkeyword) {
         case 'ed':
             #發標頻率限製
             $timelimit = Yii::app()->cache->get("userfastfabiaolimit_" . $user->user_id);
             #$timelimit=false;
             if (!empty($timelimit)) {
                 return '查詢過於頻率,請在5秒鍾後再次查詢。';
             } else {
                 Yii::app()->cache->set("userfastfabiaolimit_" . $user->user_id, 1, 5);
             }
             $credits = FastSettingService::checkUserEd($user->user_id);
             $returnstring = "淨值額度為:" . $credits['newworth'] . "\n";
             $returnstring .= "信用額度為:" . $credits['credit_use'] . "\n";
             $returnstring .= "大額股標額度為:" . $credits['stock_credit_use'] . "\n";
             return $returnstring;
             break;
         case 'k':
             if ($fastfabiaostatus->fabiao_status == 1) {
                 return '快速發標已經開啟,請直接回複F#編號發布對應借款標.';
             } else {
                 $result = UserCache::model()->updateByPk($fastfabiaostatus->id, array("fabiao_status" => 1));
                 if ($result) {
                     #記錄開啟操作
                     $newfastsettinglog = new BorrowFastsettingLog();
                     $newfastsettinglog->setAttributes(array('user_id' => $fastfabiaostatus->user_id, 'borrow_setting_id' => 0, 'borrow_id' => 0, 'operate_status' => 4, 'remark' => '在微信端開啟快速發標功能', 'content' => '開啟發標功能', 'setting_end' => 2, 'addtime' => time(), 'addip' => Yii::app()->request->userHostAddress));
                     $newfastsettinglog->save();
                     return '快速發標已經開啟,請直接回複F#編號發布對應借款標.';
                 } else {
                     return '功能開啟出錯,請聯係客服。';
                 }
             }
             break;
         case 'g':
             if ($fastfabiaostatus->fabiao_status == 0) {
                 return '快速發標已經關閉。';
             }
             $result = UserCache::model()->updateByPk($fastfabiaostatus->id, array("fabiao_status" => 0));
             if ($result) {
                 #記錄開啟操作
                 $newfastsettinglog = new BorrowFastsettingLog();
                 $newfastsettinglog->setAttributes(array('user_id' => $fastfabiaostatus->user_id, 'borrow_setting_id' => 0, 'borrow_id' => 0, 'operate_status' => 5, 'remark' => '在微信端關閉快速發標功能', 'content' => '關閉發標功能', 'setting_end' => 2, 'addtime' => time(), 'addip' => Yii::app()->request->userHostAddress));
                 $newfastsettinglog->save();
                 return '快速發標功能已關閉。';
             } else {
                 return '快速功能關閉失敗。';
             }
             break;
         default:
             #發標頻率限製
             $timelimit = Yii::app()->cache->get("userfastfabiaolimit_" . $user->user_id);
             #$timelimit=false;
             if (!empty($timelimit)) {
                 return '發標過於頻率,請在5秒鍾後再次發標。';
             } else {
                 Yii::app()->cache->set("userfastfabiaolimit_" . $user->user_id, 1, 5);
             }
             $fastsetting = BorrowFastsetting::model()->find("user_id=:user_id and order_number=:order_number", array(':user_id' => $user->user_id, ':order_number' => $thefitkeyword));
             if ($fastsetting) {
                 $fabiaomsg = FastSettingService::faBiaoByFastSetting($user->user_id, $fastsetting->id, $thefitkeyword);
                 return $fabiaomsg['msg'];
             } else {
                 return '沒有此命令或者發標編號,請確認操作。';
             }
             break;
     }
 }
開發者ID:uqiauto,項目名稱:wxzuan,代碼行數:85,代碼來源:WeixinKeyWordService.php


注:本文中的UserCache::model方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。