Esempio n. 1
0
 public function indexAction()
 {
     /*
             $tBMO = new BannerModel;
     		$tImgUrl = Yaf_Registry::get("config")->web->url->img;
             $tDatas = $tBMO->field('aid,concat(\''.$tImgUrl.'\',img) img')->order(' id asc ')->fList();
             Tool_Fnc::ajaxMsg('',1,$tDatas);
     */
     $tAMO = new ArticleModel();
     $tImgUrl = Yaf_Registry::get("config")->web->url->img;
     $tDatas = $tAMO->field('id aid,concat(\'' . $tImgUrl . '\',head_img) img')->where(' cate_id = 18')->order('id asc')->fList();
     Tool_Fnc::ajaxMsg('', 1, $tDatas);
 }
Esempio n. 2
0
 public function detailAction()
 {
     $p = $_REQUEST;
     $pAid = empty($p['aid']) ? 0 : intval($p['aid']);
     if (empty($pAid)) {
         echo 'error aid';
         exit;
     }
     $tMO = new ArticleModel();
     $tImgUrl = Yaf_Registry::get("config")->web->url->img;
     $tRow = $tMO->field('id aid, concat(\'' . $tImgUrl . '\', head_img)  head_img,content,(view+initview) viewtotal,title,description,created,source')->where(' id = ' . $pAid)->fRow();
     if (empty($tRow['aid'])) {
         die('该文章不存在');
     }
     $tData = array('id' => $pAid, 'view' => $tRow['viewtotal'] + 1);
     $tMO->update($tData);
     $this->assign('tRow', $tRow);
 }
Esempio n. 3
0
 public function indexAction()
 {
     $tTime = time();
     $tMO = new ArticleModel();
     $tDatas = $tMO->field('title,id,description')->where('is_tui = 0 and status = 1 and push_time <= ' . $tTime)->fList();
     print_R($tDatas);
     if (!count($tDatas)) {
         exit;
     }
     $tGMO = new GetuiModel();
     $tGDatas = $tGMO->field('devicetoken,cid')->fList();
     $tRedis = Cache_Redis::instance();
     foreach ($tDatas as $tRow) {
         foreach ($tGDatas as $tR) {
             $tRes = serialize(array_merge($tRow, $tR, array('type' => 'article', 'content' => '')));
             $tRedis->lpush('dakang_getui', $tRes);
         }
         $tData = array('is_tui' => 1, 'id' => $tRow['id']);
         $tMO->update($tData);
     }
     exit;
 }
Esempio n. 4
0
 public function delAction()
 {
     $p = $_REQUEST;
     $pId = empty($p['id']) ? die('error') : intval($p['id']);
     $tMO = new ArticleModel();
     $tRow = $tMO->field('head_img')->where('id = ' . $pId)->fRow();
     if (!empty($tRow['head_img'])) {
         unlink(APPLICATION_PATH . '/public' . $tRow['head_img']);
     }
     $tSql = 'delete from ' . $tMO->table . ' where id = ' . $pId;
     if (!$tMO->exec($tSql)) {
         Tool_Fnc::ajaxMsg('删除失败');
     }
     Tool_Fnc::ajaxMsg('删除成功', 1);
 }
Esempio n. 5
0
 /**
 +----------------------------------------------------------
 * 首页
 +----------------------------------------------------------
 */
 public function index()
 {
     //读取前台配置文章
     $front_config = F('frontstage.inc', '', './Config/');
     //得到动态缓存时间
     $dynamic_cache_time = $front_config['DYNAMIC_CACHE_TIME'];
     //实例化
     $blocks = new BlockViewModel();
     $artis = new ArticleModel();
     //得到所有发布的菜单列表
     $where_list = array('m_i_published' => array('eq', 1));
     $data = $blocks->where($where_list)->order('m_i_id desc')->select();
     //动态缓存数据,如果没有则缓存,有则直接读取
     if (!S('list')) {
         $list = $data;
         S('list', $data, $dynamic_cache_time);
     } else {
         $list = S('list');
     }
     //循环所有的block区块里面的内容,得到相应的内容分配到不同的菜单数组中
     foreach ($list as $key => $value) {
         switch ($value['blockname']) {
             //头部导航
             case 'menu_top_nav':
                 $menu_top_nav[$key] = $value;
                 break;
                 //幻灯片
             //幻灯片
             case 'menu_img_slide':
                 $menu_img_slide[$key] = $value;
                 break;
                 //热点置顶内容
             //热点置顶内容
             case 'menu_hot_content':
                 $menu_hot_content[$key] = $value;
                 break;
                 //最新图文内容
             //最新图文内容
             case 'menu_img_content':
                 $menu_img_content[$key] = $value;
                 break;
                 //中间内容
             //中间内容
             case 'menu_middle_content':
                 $menu_middle_content[$key] = $value;
                 break;
                 //左侧内容
             //左侧内容
             case 'menu_side_bar':
                 $menu_side_bar[$key] = $value;
                 break;
         }
     }
     //因为热点内容区块需要一部分内容,所以得到description
     foreach ($menu_hot_content as $key1 => $value1) {
         $where_hot = array('id' => array('eq', $value1['m_i_type_id']));
         $description = $artis->field('description')->where($where_hot)->find();
         $menu_hot_content[$key1]['description'] = $description;
     }
     //中间内容区块需要得到其下的文章列表
     foreach ($menu_middle_content as $key2 => $value2) {
         $where_mid = array('catid' => array('eq', $value2['m_i_type_id']), 'published' => array('eq', 1));
         $art_info = $artis->field('title,id')->order('id desc')->where($where_mid)->select();
         $menu_middle_content[$key2]['art_info'] = $art_info;
     }
     //左侧内容区块需要得到其下的文章列表
     foreach ($menu_side_bar as $key3 => $value3) {
         $art_info = $artis->field('title,id')->order('id desc')->where('catid=' . $value3['m_i_type_id'])->select();
         $menu_side_bar[$key3]['art_info'] = $art_info;
     }
     $this->assign('menu_top_nav', $menu_top_nav);
     $this->assign('menu_img_slide', $menu_img_slide);
     $this->assign('menu_hot_content', $menu_hot_content);
     $this->assign('menu_img_content', $menu_img_content);
     $this->assign('menu_middle_content', $menu_middle_content);
     $this->assign('menu_side_bar', $menu_side_bar);
     //调用head方法
     $this->head();
     //得到友情链接
     $this->get_link();
     $this->display();
 }