本文整理匯總了PHP中CacheManager::synProgramCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP CacheManager::synProgramCache方法的具體用法?PHP CacheManager::synProgramCache怎麽用?PHP CacheManager::synProgramCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CacheManager
的用法示例。
在下文中一共展示了CacheManager::synProgramCache方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionShare
function actionShare()
{
header('Content-type: application/json');
if (!Yii::app()->request->isPostRequest) {
IjoyPlusServiceUtils::exportServiceError(Constants::METHOD_NOT_SUPPORT);
return;
}
if (!IjoyPlusServiceUtils::validateAPPKey()) {
IjoyPlusServiceUtils::exportServiceError(Constants::APP_KEY_INVALID);
return;
}
if (IjoyPlusServiceUtils::validateUserID()) {
IjoyPlusServiceUtils::exportServiceError(Constants::USER_ID_INVALID);
return;
}
$prod_id = Yii::app()->request->getParam("prod_id");
if (!isset($prod_id) || is_null($prod_id)) {
IjoyPlusServiceUtils::exportServiceError(Constants::PARAM_IS_INVALID);
return;
}
$program = Program::model()->findByPk($prod_id);
if ($program !== null) {
$owner_id = Yii::app()->user->id;
$transaction = Yii::app()->db->beginTransaction();
try {
$favority = Dynamic::model()->getDynamicByProd($owner_id, $prod_id, Constants::DYNAMIC_TYPE_SHARE);
if (!(isset($favority) && !is_null($favority))) {
$dynamic = new Dynamic();
$dynamic->author_id = $owner_id;
$dynamic->content_id = $program->d_id;
$dynamic->status = Constants::OBJECT_APPROVAL;
$dynamic->create_date = new CDbExpression('NOW()');
$dynamic->content_type = $program->d_type;
$dynamic->content_name = $program->d_name;
$dynamic->dynamic_type = Constants::DYNAMIC_TYPE_SHARE;
$dynamic->content_pic_url = $program->d_pic;
// $dynamic->content_desc=$share_to_where;
$dynamic->save();
User::model()->updateShareCount($owner_id, 1);
Program::model()->incShareCount($prod_id);
$program->share_number = $program->share_number + 1;
CacheManager::synProgramCache($program);
}
// if(isset($program->publish_owner_id) && !is_null($program->publish_owner_id) && $program->publish_owner_id !== $owner_id){
// // add notify msg
// $msg = new NotifyMsg();
// $msg->author_id=$program->publish_owner_id;
// $msg->nofity_user_id=Yii::app()->user->id;
// $msg->notify_user_name=Yii::app()->user->getState("username");
// $msg->notify_user_pic_url=Yii::app()->user->getState("pic_url");
// $msg->content_id=$program->d_id;
// $msg->content_info=$program->d_name;
// $msg->content_type=$program->d_type;
// $msg->created_date=new CDbExpression('NOW()');
// $msg->status=Constants::OBJECT_APPROVAL;
// $msg->notify_type=Constants::NOTIFY_TYPE_SHARE;
// $msg->content_desc=$share_to_where;
// $msg->save();
// }
$transaction->commit();
IjoyPlusServiceUtils::exportServiceError(Constants::SUCC);
} catch (Exception $e) {
$transaction->rollback();
IjoyPlusServiceUtils::exportServiceError(Constants::SYSTEM_ERROR);
}
} else {
IjoyPlusServiceUtils::exportServiceError(Constants::OBJECT_NOT_FOUND);
}
}