Example #1
0
 public function actionIndex()
 {
     /* 永不超时 */
     ini_set('max_execution_time', 0);
     //生成的crond
     $this->_conf = XXcache::get('_config');
     if (empty($this->_conf['is_cron'])) {
         exit;
     }
     $crond_json_file = SITE_BACKEND_PATH . 'protected/data/crond/crond.json';
     $arr = json_decode(file_get_contents($crond_json_file), TRUE);
     //为1则为完全删除
     $old = empty($arr['old']) ? 0 : 1;
     unset($arr['key'], $arr['old']);
     $arr = array_keys($arr);
     //        XUtils::ppr($arr,1);
     foreach ($arr as $v) {
         switch ($v) {
             case 'header':
                 $min = 1000;
                 $max = 1999;
                 break;
             case 'left':
                 $min = 2000;
                 $max = 2999;
                 break;
             case 'main':
                 $min = 3000;
                 $max = 3999;
                 break;
             case 'shop':
                 $min = 4000;
                 $max = 4999;
                 break;
             case 'fun':
                 $min = 5000;
                 $max = 5999;
                 break;
             case 'tools':
                 $min = 6000;
                 $max = 6999;
                 break;
             case 'games':
                 $min = 7000;
                 $max = 7999;
                 break;
         }
         if (!empty($max) && !empty($min)) {
             $catalog_arr = Catalog::model()->findAll(array('select' => 'id,tb_id', 'condition' => "t.tb_id>:min AND t.tb_id<:max", 'params' => array(':min' => $min, ':max' => $max)));
         }
         if (!empty($catalog_arr)) {
             foreach ($catalog_arr as $info) {
                 $re[$info->tb_id . ',' . $info->id] = $this->doTb($info->tb_id, $info->id, $old);
             }
         }
         //XUtils::ppr($re,1);
     }
     exit('执行完毕');
 }
Example #2
0
 protected function _getCatalogLinksNum($cid = null)
 {
     if (empty($cid)) {
         return XXcache::get('_catalogAllNum');
     } else {
         $cid = (int) $cid;
         return Links::model()->count("`catalog_id` = '{$cid}'");
     }
 }
Example #3
0
 public function init()
 {
     //初始化
     parent::init();
     //更新session
     if (isset($_POST['sessionId'])) {
         $session = Yii::app()->getSession();
         $session->close();
         $session->sessionID = $_POST['sessionId'];
         $session->open();
     }
     //从初始化的内容里面取的userid,若存在则证明有登录
     $this->_backendUserId = parent::_sessionGet('uid');
     $this->_backendUserName = parent::_sessionGet('uname');
     $this->_backendGroupId = parent::_sessionGet('_backendGroupId');
     /* 检测判断是否登陆,否则跳到login页面 */
     empty($this->_backendUserId) && $this->redirect(array('public/login'));
     empty($this->_backendGroupId) && $this->redirect(array('public/login'));
     $this->_backendGroupName = parent::_sessionGet('_backendGroupName');
     $this->_backendPermission = parent::_sessionGet('_backendPermission');
     $this->_backendAcl = parent::_sessionGet('_backendAcl');
     if (empty($this->_backendAcl) || empty($this->_backendGroupName)) {
         $groupArr = AdminGroup::model()->findByPk($this->_backendGroupId);
         //当前组权限
         $this->_backendAcl = $groupArr->acl;
         parent::_sessionSet('_backendAcl', $this->_backendAcl);
         //当前组id
         $this->_backendGroupId = $groupArr->id;
         parent::_sessionSet('_backendGroupId', $this->_backendGroupId);
         //当前组名
         $this->_backendGroupName = $groupArr->group_name;
         parent::_sessionSet('_backendGroupName', $this->_backendGroupName);
         unset($groupArr);
     }
     //栏目,后端在此获得全分类数组,前端在system里面获得
     $this->_catalog = XXcache::get('_catalog');
     $this->_catalogAll = XXcache::get('_catalogAll');
     //系统配置
     $this->_conf = XXcache::get('_config');
     $this->_theme = empty($this->_conf['theme']) ? 'default' : $this->_conf['theme'];
     //        $this->_conf = self::_config();
     //站点前台主题静态目录url
     !defined('STATIC_THEME_URL') && define('STATIC_THEME_URL', SITE_URL . 'static/themes/' . $this->_theme . '/');
 }
Example #4
0
 /**
  * 管理员组删除
  *
  * @param  $id
  */
 public function actionGroupDelete($id)
 {
     parent::_acl();
     //        ppr($_REQUEST,1);
     if (!empty($id)) {
         $id = intval($id);
         $model = Admin::model()->deleteAll('group_id=:gid', array(':gid' => $id));
         //group_id
         $groupInfo = AdminGroup::model()->findByPk($id);
         $name = $groupInfo->group_name;
         $model = AdminGroup::model()->deleteByPk($id);
         //            ppr($groupInfo,1);
         parent::_backendLogger(array('catalog' => 'delete', 'intro' => '删除用户组 ' . $name . '(' . $id . ') 及该用户组所有用户'));
         $result = XXcache::get('_adminGroup');
         XUtils::message('success', '已删除分类 ' . $name . ' 及该分类所有链接');
     }
     $this->redirect(Yii::app()->request->urlReferrer);
 }