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


PHP zmf::getFCache方法代码示例

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


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

示例1: getColImgs

 public static function getColImgs($colid, $order = 'hits', $limit = 10)
 {
     if (!$colid) {
         return false;
     }
     $_info = zmf::getFCache("getColImgs{$colid}-{$order}-{$limit}");
     if ($_info) {
         //return $_info;
     }
     $sql = "SELECT id FROM {{posts}} WHERE colid={$colid} AND status=" . Posts::STATUS_PASSED;
     $info = Yii::app()->db->createCommand($sql)->queryAll();
     if (empty($info)) {
         return false;
     }
     $idsArr = array();
     foreach ($info as $i) {
         $idsArr[] = $i['id'];
     }
     $ids = join(',', $idsArr);
     if ($ids == '') {
         return false;
     }
     $_sql = "SELECT logid,filePath,classify FROM {{attachments}} WHERE logid IN({$ids}) AND status=" . Posts::STATUS_PASSED . " ORDER BY {$order} LIMIT 0,{$limit}";
     $_info = Yii::app()->db->createCommand($_sql)->queryAll();
     zmf::setFCache("getColImgs{$colid}-{$order}-{$limit}", $_info, 3600);
     return $_info;
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:27,代码来源:Attachments.php

示例2: tops

 public static function tops()
 {
     $tops = zmf::getFCache("top-searchs");
     if (!$tops) {
         $sql = "SELECT * FROM {{search_records}} ORDER BY times DESC LIMIT 10";
         $tops = Yii::app()->db->createCommand($sql)->queryAll();
         zmf::setFCache("top-searchs", $tops, 360);
     }
     return $tops;
 }
开发者ID:ph7pal,项目名称:mei,代码行数:10,代码来源:SearchRecords.php

示例3: actionLogin

 public function actionLogin()
 {
     $this->onlyOnPc();
     $this->layout = 'common';
     if (!Yii::app()->user->isGuest) {
         $this->message(0, '您已登录,请勿重复操作');
     }
     $canLogin = true;
     $ip = Yii::app()->request->getUserHostAddress();
     $cacheKey = 'loginErrors-' . $ip;
     $errorTimes = zmf::getFCache($cacheKey);
     if ($errorTimes >= 5) {
         $canLogin = false;
     }
     if ($canLogin) {
         $model = new FrontLogin();
         if (isset($_POST['FrontLogin'])) {
             $model->attributes = $_POST['FrontLogin'];
             if ($model->validate() && $model->login()) {
                 $arr = array('latestLoginTime' => zmf::now());
                 $uid = Yii::app()->user->id;
                 //                    User::model()->updateByPk($uid, $arr);
                 zmf::delCookie('checkWithCaptcha');
                 zmf::delFCache($cacheKey);
                 if ($this->referer) {
                     $this->redirect($this->referer);
                 } else {
                     $this->redirect(zmf::config('baseurl'));
                 }
             } else {
                 zmf::updateFCacheCounter($cacheKey, 1, 3600);
                 zmf::setCookie('checkWithCaptcha', 1, 86400);
             }
         }
     }
     $this->pageTitle = '登录';
     $this->render('login', array('model' => $model));
 }
开发者ID:ph7pal,项目名称:momo,代码行数:38,代码来源:SiteController.php

示例4: checkRegTimes

 public static function checkRegTimes()
 {
     if (!zmf::config('limitReg')) {
         return false;
     }
     $ip = ip2long(Yii::app()->request->userHostAddress);
     $times = zmf::getFCache("regTimes-{$ip}");
     if ($times >= zmf::config('limitRegTimes')) {
         return true;
     } else {
         zmf::setFCache("regTimes-{$ip}", intval($times) + 1, 86400);
         return false;
     }
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:14,代码来源:UserAction.php

示例5: getTopPostsByTags

 /**
  * 根据文章的标签获取与此最类似的文章
  * @param type $id 文章id
  * @param type $tagids 文章的标签id串
  * @return boolean
  */
 public static function getTopPostsByTags($id, $tagids)
 {
     if (!$tagids || !$id) {
         return false;
     }
     $key = "getTopPostsByTags-{$id}";
     $posts = zmf::getFCache($key);
     if (!empty($posts)) {
         return $posts;
     }
     $sqlTagRel = "SELECT p.id,p.title,p.faceimg,p.uid,p.hits,p.comments,p.cTime,p.updateTime,p.favors,count(tr.id) AS total FROM {{tag_relation}} tr,{{posts}} p WHERE tr.logid!='{$id}' AND tagid IN({$tagids}) AND tr.logid=p.id AND p.status=" . Posts::STATUS_PASSED . " AND p.classify=" . Posts::CLASSIFY_WEDDING . " GROUP BY tr.logid ORDER BY total DESC limit 5";
     $posts = Yii::app()->db->createCommand($sqlTagRel)->queryAll();
     zmf::setFCache($key, $posts, 3600);
     return $posts;
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:21,代码来源:Posts.php

示例6: add

 private function add($type = '')
 {
     $uid = zmf::filterInput(Yii::app()->request->getParam('uid'), 't', 1);
     if (!$uid) {
         $uid = zmf::uid();
     }
     if (zmf::config('fbLoginOnly')) {
         if (!$uid) {
             $this->jsonOutPut(0, Yii::t('default', 'fbLoginOnly'));
         }
     }
     $url = zmf::filterInput(Yii::app()->request->getParam('url'), 't', 1);
     $email = zmf::filterInput(Yii::app()->request->getParam('email'), 't', 1);
     $content = zmf::filterInput(Yii::app()->request->getParam('content'), 't', 1);
     $ip = zmf::filterInput(Yii::app()->request->getParam('ip'), 't', 1);
     $appversion = zmf::filterInput(Yii::app()->request->getParam('appversion'), 't', 1);
     $os = zmf::filterInput(Yii::app()->request->getParam('os'), 't', 1);
     $platform = zmf::filterInput(Yii::app()->request->getParam('platform'), 't', 1);
     $time = zmf::filterInput(Yii::app()->request->getParam('time'), 't', 1);
     if (!$ip) {
         $ip = ip2long(Yii::app()->request->userHostAddress);
     }
     if (!$platform) {
         $platform = Yii::app()->request->getUserAgent();
     }
     if ($type == '' || !in_array($type, array('pc', 'mobile', 'ios', 'android'))) {
         $type = 'pc';
     }
     if (!$time) {
         $time = zmf::now();
     }
     $cacheKey = 'feedback_' . $ip;
     if ($content == '') {
         $this->jsonOutPut(0, Yii::t('default', 'fbNoEmpty'));
     }
     if (zmf::config('fbTimesLimit')) {
         $times = intval(zmf::getFCache($cacheKey));
         $_time = $times + 1;
         //fbLimitTimes
         zmf::setFCache($cacheKey, $_time, 60);
         if ($_time >= zmf::config('fbLimitTimes')) {
             $this->jsonOutPut(0, Yii::t('default', 'fbTimesLimit'));
         }
     }
     $data = array('uid' => $uid, 'url' => $url, 'email' => $email, 'content' => $content, 'ip' => $ip, 'cTime' => $time, 'status' => Posts::STATUS_STAYCHECK, 'classify' => $type, 'appversion' => $appversion, 'os' => $os, 'platform' => $platform);
     $model = new Feedback();
     $model->attributes = $data;
     if ($model->validate()) {
         if ($model->save()) {
             if (zmf::config("defaultNoticeUid")) {
                 $_data = array('uid' => zmf::config("defaultNoticeUid"), 'content' => ($email != '' ? $email . '反馈:' : '新反馈:') . $content, 'type' => 'feedback', 'from_id' => rand(1, 100000), 'from_idtype' => 'feedback');
                 Notification::add($_data);
             }
             $this->jsonOutPut(1, Yii::t('default', 'fbThanking'));
         } else {
             $this->jsonOutPut(0, Yii::t('default', 'fbThanking'));
         }
     } else {
         $this->jsonOutPut(0, Yii::t('default', 'notvalidate'));
     }
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:61,代码来源:FeedController.php

示例7: getUserInfo

 /**
  * 获取用户信息
  * @param type $uid
  * @param type $type
  * @return boolean
  */
 public static function getUserInfo($uid, $type = '', $avatarSize = 170)
 {
     if (!$uid) {
         return false;
     }
     $cacheKey = "userInfo-{$uid}";
     $info = zmf::getFCache($cacheKey);
     if (!$info) {
         $info = Users::model()->findByPk($uid);
         if (!$info) {
             return false;
         }
         $info->areaName = $info->avatarImg = '';
         unset($info->password);
         unset($info->username);
         $info->desc = $info->content;
         //获取地区名
         if ($info['areaid']) {
             $areaInfo = Area::model()->findByPk($info['areaid']);
             $info->areaName = $areaInfo ? $areaInfo['title'] : '';
         }
         $info->avatarImg = self::getAvatar($info['avatar'], 'origin');
         zmf::setFCache($cacheKey, $info, 86400);
     }
     if (!$info) {
         return false;
     }
     $info->avatarImg = str_replace('origin', $avatarSize, $info->avatarImg);
     if (!empty($type)) {
         return $info->{$type};
     } else {
         return $info;
     }
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:40,代码来源:Users.php


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