Exemple #1
0
 /**
  * 新闻列表
  */
 public function indexAction()
 {
     $keyword = reqstr('keyword', '');
     if ($keyword == '请输入关建词!') {
         $keyword = '';
     }
     $news_type = reqstr('news_type', '');
     $indate = reqstr('indate', '');
     $todate = reqstr('todate', '');
     $cache = XMemCache::GetInstance();
     $key = 'selectkeyword';
     $where = array('keyword' => $keyword, 'news_type' => $news_type, 'indate' => $indate, 'todate' => $todate);
     if (!empty($keyword) or $news_type or isset($news_type) or $indate or $todate) {
         $cache->Set($key, $where, 600);
     }
     $select = $cache->Get($key);
     $page = reqnum("page", 1);
     $pagesize = reqnum("pagesize", 20);
     $obj = new Psys_NewsModel();
     $data = $obj->GetNewsList($select, 'id DESC', $page, $pagesize, "*");
     self::inidate($data['allnum'], $page, $pagesize, count($data['allrow']));
     $types = $this->getNewsType();
     foreach ($data['allrow'] as &$v) {
         $v['newstype'] = $types[$v['newstype']];
     }
     $this->smarty->assign('select', $select);
     $this->smarty->assign('list', $data['allrow']);
     $this->smarty->assign('newstype', $types);
     $this->smarty->assign("active_menu", "news");
     $this->smarty->assign("active", "news/index");
     $this->forward = "index";
 }
Exemple #2
0
 public static function GetInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Exemple #3
0
 public function getMenuTree($pid = 0, $cach = false)
 {
     $tree = array();
     $treemenukey = 'treemenukey';
     $cache = XMemCache::GetInstance();
     $tree = $cache->Get($treemenukey);
     if (empty($tree) or $cach) {
         $tree = $this->getMeTree($pid);
         $cache->Set($treemenukey, $tree);
     }
     return $tree;
 }
 /**
  * 用户登录
  * @param string $username 用户名
  * @param string $passwd 明文密码
  * @param array $result 错误信息
  * @return multitype:Array|NULL 用户信息
  */
 public function Login($username, $passwd, array &$result)
 {
     $passwd = $this->EncrptPasswd($passwd);
     $w = array('username' => $username, 'passwd' => $passwd, 'flag' => 1);
     $one = $this->GetOne($w);
     if (!$one) {
         //不存在此用户
         MsgInfoConst::GetMsg(1001, $result);
         return array();
     }
     $result['result'] = 'SUCCESS';
     $one['passwd'] = null;
     //缓存判别登录状态
     $memcache = XMemCache::GetInstance();
     $memcache->Set('Cur_X_User', 'isLogin');
     $this->SetSessionInfo($one);
     return $one;
 }