本文整理汇总了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));
}
示例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'));
}
示例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);
}
}
示例4: afterDelete
/**
* afterDelete
*
* Reset cache
*/
protected function afterDelete()
{
UserCache::model()->updateAll(array('status' => 0));
}
示例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;
}
}