Exemple #1
0
 /**
  * @param null $args
  */
 public function render($args = NULL)
 {
     parent::render($args);
     // TODO: Change the autogenerated stub
     $articles = $this->articles->where('published < NOW()')->order('created DESC')->limit(10)->fetchPairs('created');
     $venues = $this->venues->fetchVisible()->order('created DESC')->limit(10)->fetchPairs('created');
     $competitions = $this->competitions->order('created DESC')->limit(10)->fetchPairs('created');
     $output = $articles + $venues + $competitions;
     krsort($output);
     $this->template->items = $output;
     $this->template->setFile(__DIR__ . "/StreamControl.basic.latte");
     $this->template->render();
 }
 /**
  * 文章列表JSON
  */
 public function actionJsonlist()
 {
     $Articles = new Articles();
     $start = (int) $_GET['iDisplayStart'];
     $pagesize = (int) $_GET['iDisplayLength'];
     $where = array();
     $this->cid = isset($_GET['cid']) ? (int) $_GET['cid'] : 1;
     if ($this->cid) {
         $where['cid'] = $this->cid;
     }
     $list = $Articles->where($where)->limit($start, $pagesize)->order('aid')->getAll();
     $iTotal = $Articles->getCount('*', $where);
     $output = array("sEcho" => $_GET['sEcho'], "iTotalRecords" => $iTotal, "iTotalDisplayRecords" => $iTotal, "aaData" => array());
     $homeUrl = Wave::app()->homeUrl . 'articles/modify/';
     foreach ($list as $key => $value) {
         $list[$key]['operation'] = '<button type="button" class="btn btn-info btn-xs m-right20" onclick="javascript:location.href=\'' . $homeUrl . $value['aid'] . '\'">修改</button>';
         $list[$key]['operation'] .= '<button type="button" class="btn btn-danger btn-xs" onclick="mdelete(' . $value['aid'] . ')">删除</button>';
     }
     $output['aaData'] = $list;
     echo json_encode($output);
     die;
 }
Exemple #3
0
 public function articleSort()
 {
     $cus_id = Auth::id();
     $id = Input::get('id');
     $s_type = Input::get('s_type');
     if ($s_type == 'up') {
         $now_article = Articles::find($id);
         $now_sort = $now_article->sort;
         $search_article = Articles::where('sort', '<', $now_sort)->where('cus_id', '=', $cus_id)->orderBy('sort', 'desc')->first()->toArray();
         if ($search_article === NULL) {
             $return_msg = array('err' => 3001, 'msg' => '已是最小序号');
         } else {
             $now_article->sort = $search_article['sort'];
             $up_rst = $now_article->save();
             if ($up_rst) {
                 $up_rst = Articles::where('id', '=', $search_article['id'])->update(array('sort' => $now_sort));
                 if ($up_rst) {
                     $return_msg = array('err' => 0, 'msg' => '');
                 } else {
                     $now_article->sort = $now_sort;
                     $up_rst = $now_article->save();
                     $i = 1;
                     while (!$up_rst && $i <= 3) {
                         $up_rst = $now_article->save();
                         $i++;
                     }
                     $return_msg = array('err' => 3001, 'msg' => '排序失败');
                 }
             }
         }
     } else {
         $now_article = Articles::find($id);
         $now_sort = $now_article->sort;
         $search_article = Articles::where('sort', '>', $now_sort)->where('cus_id', '=', $cus_id)->first()->toArray();
         if ($search_article === NULL) {
             $return_msg = array('err' => 3001, 'msg' => '已是最大序号');
         } else {
             $now_article->sort = $search_article['sort'];
             $up_rst = $now_article->save();
             if ($up_rst) {
                 $up_rst = Articles::where('id', '=', $search_article['id'])->update(array('sort' => $now_sort));
                 if ($up_rst) {
                     $return_msg = array('err' => 0, 'msg' => '');
                 } else {
                     $now_article->sort = $now_sort;
                     $up_rst = $now_article->save();
                     $i = 1;
                     while (!$up_rst && $i <= 3) {
                         $up_rst = $now_article->save();
                         $i++;
                     }
                     $return_msg = array('err' => 3001, 'msg' => '排序失败');
                 }
             }
         }
     }
     return Response::json($return_msg);
 }
Exemple #4
0
 public function __construct(\Nette\DI\Container $context)
 {
     parent::__construct($context);
     $this->articles = $this->context->createServiceArticles();
     $this->articles->where('ad', '1');
 }
 /**
  * 用户修改设置
  */
 public function customerSetting()
 {
     $cus_id = Auth::id();
     $data['company'] = Input::get('company_name');
     $pc_domain = Input::get('domain_pc');
     $data['pc_domain'] = strstr($pc_domain, 'http') ? $pc_domain : 'http://' . $pc_domain;
     $mobile_domain = Input::get('domain_m');
     $data['mobile_domain'] = strstr($mobile_domain, 'http') ? $mobile_domain : 'http://' . $mobile_domain;
     $data['favicon'] = basename(Input::get('favicon'));
     $data['logo'] = basename(Input::get('logo_large'));
     $data['logo_small'] = basename(Input::get('logo_small'));
     $data['pc_header_script'] = Input::get('pc_header_script');
     $data['mobile_header_script'] = Input::get('mobile_header_script');
     $data['title'] = Input::get('title');
     $data['keywords'] = Input::get('keywords');
     $data['description'] = Input::get('description');
     $data['footer'] = Input::get('footer');
     $data['mobile_footer'] = Input::get('mobile_footer');
     $data['pc_footer_script'] = Input::get('pc_footer_script');
     $data['mobile_footer_script'] = Input::get('mobile_footer_script');
     $data['pc_page_count'] = Input::get('pc_num_per_page') ? Input::get('pc_num_per_page') : 12;
     $data['pc_page_links'] = Input::get('pc_num_pagenav') ? Input::get('pc_num_pagenav') : 8;
     $data['mobile_page_count'] = Input::get('m_num_per_page') ? Input::get('m_num_per_page') : 12;
     $data['mobile_page_links'] = Input::get('m_num_pagenav') ? Input::get('m_num_pagenav') : 3;
     $data['contact_name'] = Input::get('contactor');
     $data['telephone'] = Input::get('telephone');
     $data['mobile'] = Input::get('mobile');
     $data['fax'] = Input::get('fax');
     $data['email'] = Input::get('mail');
     $data['qq'] = Input::get('qq');
     $data['address'] = Input::get('address');
     $update = CustomerInfo::where('cus_id', $cus_id)->update($data);
     if ($update) {
         Articles::where('cus_id', $cus_id)->where('pushed', 0)->update(array('pushed' => 1));
         Classify::where('cus_id', $cus_id)->where('pushed', 0)->update(array('pushed' => 1));
         $result = ['err' => 0, 'msg' => '', 'data' => ''];
     } else {
         $result = ['err' => 1002, 'msg' => '无法保存数据', 'data' => ''];
     }
     return Response::json($result);
 }
 private function delChildClassify($c_id)
 {
     $cus_id = Auth::id();
     $child_ids = Classify::where('p_id', $c_id)->where('cus_id', $cus_id)->lists('id');
     if (count($child_ids)) {
         foreach ($child_ids as $id) {
             Classify::where('id', $id)->where('cus_id', $cus_id)->delete();
             Articles::where('c_id', $id)->where('cus_id', $cus_id)->delete();
             $this->delMobileHomepage($id);
             $this->delChildClassify($id);
         }
     }
 }
Exemple #7
0
 /**
  * 判断一个用户是否需要推送并返回修改的次数
  */
 public function isNeedPush()
 {
     $count = Classify::where('cus_id', $this->cus_id)->where('pushed', 1)->count();
     $count += Articles::where('cus_id', $this->cus_id)->where('pushed', 1)->count();
     $data_final = ['err' => 0, 'msg' => '', 'data' => ['cache_num' => $count]];
     return Response::json($data_final);
 }
Exemple #8
0
 /**
  * pushtest搜索页面数据
  * 
  * @param type $publicdata
  * @return type
  */
 public function searchPush($publicdata)
 {
     error_reporting(E_ALL ^ E_NOTICE);
     $result = $publicdata['result'];
     $result['navs'] = $publicdata['navs'];
     $customer_info = CustomerInfo::where('cus_id', $this->cus_id)->first();
     $result['title'] = $customer_info->title;
     $result['keywords'] = $customer_info->keywords;
     $result['description'] = $customer_info->description;
     $c_id = Classify::where('type', 4)->where($this->type . '_show', 1)->where('cus_id', $this->cus_id)->pluck('id');
     if ($c_id) {
         $current_arr = $this->currentCidArray($c_id);
         $result['navs'] = $this->addCurrent($result['navs'], $current_arr);
     }
     if (is_array($result['navs'])) {
         foreach ($result['navs'] as $nav) {
             if ($nav['current'] == 1) {
                 $pagenavs = $nav['childmenu'];
                 break;
             } else {
                 $pagenavs = [];
             }
         }
     }
     $result['pagenavs'] = $pagenavs;
     $result['posnavs'] = array(0 => array('en_name' => 'Search', 'name' => '搜索', 'link' => 'javascript:;', 'icon' => ''));
     //搜索数据替换
     if (!is_file(app_path('views/templates/' . $this->themename . '/searchresult_do.html'))) {
         //搜索数据标记与替换
         if (is_file(app_path('views/templates/' . $this->themename . '/searchresult.html'))) {
             $file_content = file_get_contents(app_path('views/templates/' . $this->themename . '/searchresult.html'));
         } else {
             $file_content = file_get_contents(public_path("packages/searchresult.html"));
         }
         //匹配搜索循环
         preg_match('/(\\{foreach[^\\}]*from[\\s]*=[\\s]*\\$search\\.data[^\\}]*\\})([\\s\\S]*?)\\{\\/foreach\\}/', $file_content, $search_foreach);
         $search_content = str_replace($search_foreach[2], '<!--search_content_start-->' . $search_foreach[2] . '<!--search_content_end-->', $file_content);
         //匹配foreach中的item值
         preg_match('/item[\\s]*=[\\s]*([\\S]*)/', $search_foreach[1], $search_view);
         $search_view = $search_view[1];
         //匹配所有查询中循环的值
         preg_match_all('/{[\\s]*\\$' . $search_view . '[.|\\[]([a-z]*)[\\]]*}/', $search_foreach[2], $date_replace);
         $search_view = array('title' => '$title', 'image' => '$image', 'link' => '$link', 'description' => '$description', 'pubdate' => '$pubdate', 'pubtimestamp' => '$pubtimestamp', 'pubymd' => '$pubymd');
         foreach ((array) $date_replace[0] as $k => $v) {
             $search_content = str_replace($v, 'search_' . $search_view[$date_replace[1][$k]], $search_content);
         }
         //分页匹配
         $page_content = $search_content;
         $page_link_array = array('100-8_search' => '100-9_search');
         preg_match('/(\\{foreach[^\\}]*from[\\s]*=[\\s]*\\$page_links\\.nears_link[^\\}]*\\})[\\s\\S]*?(\\{if[^\\}]*==[\\s]*\\$page_links\\.current_page[^\\}]*\\})([\\s\\S]*?)\\{else\\}([\\s\\S]*?)\\{\\/if\\}[\\s\\S]*?\\{\\/foreach\\}/', $page_content, $page_foreach);
         if ($page_foreach) {
             $page_content = str_replace($page_foreach[3], '<!--page_corrent_link_start-->' . $page_foreach[3] . '<!--page_corrent_link_end-->', $page_content);
             $page_content = str_replace($page_foreach[4], '<!--page_uncorrent_link_start-->' . $page_foreach[4] . '<!--page_uncorrent_link_end-->', $page_content);
             $page_link_array = array('100-8_search' => '100-9_search', '100-1_search' => 'javascript::');
         } else {
             preg_match('/(\\{foreach[^\\}]*from[\\s]*=[\\s]*\\$page_links\\.nears_link[^\\}]*\\})([\\s\\S]*?)\\{\\/foreach\\}/', $page_content, $page_foreach);
             if ($page_foreach) {
                 $page_content = str_replace($page_foreach[2], '<!--page_uncorrent_link_start-->' . $page_foreach[2] . '<!--page_uncorrent_link_end-->', $page_content);
             }
         }
         //分页结束
         file_put_contents(app_path('views/templates/' . $this->themename . '/searchresult_do.html'), $page_content);
         $publicdata['repleace']['searchresult_do.html'] = $page_content;
     }
     $result['search'] = array('total' => '-1000_search', 'keyword' => 'search_$keyword', 'data' => array(0 => array('link' => '', 'title' => '', 'pubdate' => '', 'description' => '')));
     $result['page_links'] = array('current_page' => '100-1_search', 'per_page' => '100-2_search', 'page_count' => '100-3_search', 'first_link' => '100-4_search', 'prev_link' => '100-5_search', 'next_link' => '100-6_search', 'last_link' => '100-7_search', 'nears_link' => $page_link_array);
     //替换结束
     if ($this->type != 'mobile') {
         if (is_file(app_path('views/templates/' . $this->themename . '/searchresult.html'))) {
             $json_keys = $this->getJsonKey('searchresult.html');
             if (count($json_keys)) {
                 foreach ($json_keys as $key) {
                     $result[$key] = $this->detailList($this->pagedata($key));
                 }
             }
         }
     }
     if ($this->type == 'pc') {
         $page_count = $customer_info->pc_page_count;
         $page_link_count = $customer_info->pc_page_links;
     } else {
         $page_count = $customer_info->mobile_page_count;
         $page_link_count = $customer_info->mobile_page_links;
     }
     //文章数据json保存
     $article_data = Articles::where('cus_id', $this->cus_id)->where($this->type . '_show', '1')->orderBy('is_top', 'desc')->orderBy('created_at', 'desc')->select('id', 'title', 'img', 'introduction', 'created_at', 'use_url', 'url')->get()->toArray();
     $article = array();
     foreach ((array) $article_data as $article_img) {
         $article[$article_img['id']]['id'] = $article_img['id'];
         $article[$article_img['id']]['title'] = $article_img['title'];
         $article[$article_img['id']]['img'] = $article_img['img'] ? $this->source_dir . 'l/articles/' . $article_img['img'] : '';
         $article[$article_img['id']]['introduction'] = $article_img['introduction'];
         $article[$article_img['id']]['created_at'] = strtotime($article_img['created_at']);
         $article[$article_img['id']]['link'] = $this->domain . '/detail/' . $article_img['id'] . '.html';
         if ($article_img['use_url']) {
             $article[$article_img['id']]['link'] = $article_img['url'];
         }
     }
     $article['count'] = $page_count;
     $article['page_link'] = $page_link_count;
     $article_json = json_encode($article);
     if ($this->type == 'pc') {
         file_put_contents(public_path('customers/' . $this->customer . '/article_data.json'), $article_json);
     } else {
         file_put_contents(public_path('customers/' . $this->customer . '/mobile/article_data.json'), $article_json);
     }
     $content = $publicdata['repleace']['searchresult_do.html'];
     $content = preg_replace($publicdata['pattern'], $publicdata['repleace'], $content);
     $smarty = new Smarty();
     $smarty->setCompileDir(app_path('storage/views/compile'));
     $smarty->setTemplateDir(app_path('views/templates/' . $this->themename));
     $smarty->registerPlugin('function', 'mapExt', array('PrintController', 'createMap'));
     $smarty->registerPlugin('function', 'shareExt', array('PrintController', 'createShare'));
     $smarty->assign($result);
     ob_start();
     $smarty->display('string:' . $content);
     $output = ob_get_contents();
     ob_end_clean();
     if (!count($result['footer_navs'])) {
         $output = preg_replace('/<a href="' . str_replace("/", "\\/", $result['site_url']) . '"( target="_blank")?( )?>首页<\\/a>( )?\\|([\\s]+)?(<br \\/>)?(<br>)?/is', "", $output);
     }
     return $output;
 }
Exemple #9
0
 /**
  * 判断一个用户是否需要推送并返回修改的次数
  */
 public function isNeedPush()
 {
     $count = Classify::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->count();
     $count += Articles::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->count();
     $count += WebsiteConfig::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->count();
     $count += WebsiteInfo::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->count();
     $count += MobileHomepage::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->count();
     $count += CustomerInfo::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->count();
     $data_final = ['err' => 0, 'msg' => '', 'data' => ['cache_num' => $count]];
     return Response::json($data_final);
 }
Exemple #10
0
 /**
  * 显示文章页
  *
  * @param int $id 文章id
  */
 public function articlePreview($id)
 {
     $article = Articles::find($id);
     $a_moreimg = Moreimg::where('a_id', $id)->get()->toArray();
     array_unshift($a_moreimg, array('title' => $article->title, 'img' => $article->img));
     $images = array();
     if (count($a_moreimg)) {
         $i = 0;
         foreach ($a_moreimg as $a_img) {
             $images[$i]['title'] = $a_img['title'];
             $images[$i]['image'] = $this->source_dir . 'l/articles/' . $a_img['img'];
             $i++;
         }
     }
     $list_id = Articles::where('c_id', $article->c_id)->where($this->type . '_show', '1')->orderBy('is_top', 'desc')->orderBy('created_at', 'desc')->select('id', 'title', 'img', 'introduction', 'created_at')->lists('id');
     foreach ($list_id as $key => $val) {
         $article_prev = NULL;
         $article_next = NULL;
         if ($val == $id) {
             if ($key != 0) {
                 $prev_id = $list_id[$key - 1];
                 $article_prev = Articles::find($prev_id);
             }
             if ($key < count($list_id) - 1) {
                 $next_id = $list_id[$key + 1];
                 $article_next = Articles::find($next_id);
             }
             break;
         }
     }
     $result = $this->pagePublic($article->c_id);
     foreach ($result['navs'] as $nav) {
         if ($nav['current'] == 1) {
             $pagenavs = $nav['childmenu'];
             break;
         } else {
             $pagenavs = [];
         }
     }
     $result['pagenavs'] = $pagenavs;
     $result['posnavs'] = $this->getPosNavs($article->c_id);
     $result['title'] = $article->title;
     $result['keywords'] = $article->keywords;
     $result['description'] = $article->introduction;
     $result['article']['title'] = $article->title;
     $result['article']['keywords'] = $article->keywords;
     $result['article']['description'] = $article->introduction;
     $result['article']['viewcount'] = '<em id="article-viewcount">0</em>';
     $article_type = Articles::leftJoin('classify', 'classify.id', '=', 'article.c_id')->where('article.id', $id)->pluck('article_type');
     if ($article_type == 1) {
         //新闻内容
         $viewname = 'content-news';
     } elseif ($article_type == 2) {
         //产品内容
         $viewname = 'content-product';
     } else {
         //跳转404
     }
     //关联文章查询
     $pa = new PhpAnalysis();
     $pa->SetSource($article->title);
     //设置分词属性
     $pa->resultType = 2;
     $pa->differMax = true;
     $pa->StartAnalysis();
     //获取你想要的结果
     $keywords = $pa->GetFinallyIndex();
     if (count($keywords)) {
         $relation_where = "";
         foreach ($keywords as $key => $word) {
             $relation_where .= "or title like '%{$key}%' ";
         }
         $relation_where = ltrim($relation_where, 'or');
         $prefix = Config::get('database.connections.mysql.prefix');
         $related_data = DB::select("select id,title,img as image,introduction,created_at,c_id from {$prefix}article where cus_id={$this->cus_id} and ({$relation_where})");
         $related = array();
         if (count($related_data)) {
             foreach ($related_data as $val) {
                 $temp_arr = [];
                 $temp_arr['title'] = $val->title;
                 $temp_arr['description'] = $val->introduction;
                 $temp_arr['image'] = $this->source_dir . 'l/articles/' . $val->image;
                 if ($this->showtype == 'preview') {
                     $temp_arr['link'] = $this->domain . '/detail/' . $val->id;
                     $temp_arr['category']['link'] = $this->domain . '/category/' . $val->id . '.html';
                 } else {
                     $temp_arr['link'] = $this->domain . '/detail/' . $val->id . '.html';
                     $temp_arr['category']['link'] = $this->domain . '/category/' . $val->id . '.html';
                 }
                 $temp_arr['pubdate'] = $val->created_at;
                 $temp_arr['pubtimestamp'] = strtotime($val->created_at);
                 $a_c_info = Classify::where('id', $val->c_id)->first();
                 $temp_arr['category']['name'] = $a_c_info->name;
                 $temp_arr['category']['en_name'] = $a_c_info->en_name;
                 $temp_arr['category']['icon'] = '<i class="iconfont">' . $a_c_info->icon . '</i>';
                 $related[] = $temp_arr;
             }
         }
     }
     //dd($article_prev);
     if ($this->showtype == 'preview') {
         if ($article_next === NULL) {
             $result['article']['next']['title'] = '已经是最后一篇';
             $result['article']['next']['link'] = '';
         } else {
             $result['article']['next']['title'] = $article_next->title;
             $result['article']['next']['link'] = $this->domain . '/detail/' . $article_next->id;
         }
         if ($article_prev === NULL) {
             $result['article']['prev']['title'] = '已经是第一篇';
             $result['article']['prev']['link'] = '';
         } else {
             $result['article']['prev']['title'] = $article_prev->title;
             $result['article']['prev']['link'] = $this->domain . '/detail/' . $article_prev->id;
         }
         $result['article']['image'] = $this->source_dir . 'l/articles/' . $article->img;
         $result['article']['images'] = $images;
         $result['article']['content'] = $article->content;
     } else {
         if ($article_next === NULL) {
             $result['article']['next']['title'] = '已经是最后一篇';
             $result['article']['next']['link'] = '';
         } else {
             $result['article']['next']['title'] = $article_next->title;
             $result['article']['next']['link'] = $this->domain . '/detail/' . $article_next->id . '.html';
         }
         if ($article_prev === NULL) {
             $result['article']['prev']['title'] = '已经是第一篇';
             $result['article']['prev']['link'] = '';
         } else {
             $result['article']['prev']['title'] = $article_prev->title;
             $result['article']['prev']['link'] = $this->domain . '/detail/' . $article_prev->id . '.html';
         }
         $result['article']['image'] = $this->source_dir . 'l/articles/' . $article->img;
         $result['article']['images'] = $images;
         $result['article']['content'] = preg_replace('/\\/customers\\/' . $this->customer . '/i', '', $article->content);
     }
     $result['article']['description'] = $article->introduction;
     $result['article']['pubdate'] = $article->created_at;
     $result['article']['pubtimestamp'] = strtotime($article->created_at);
     $result['article']['category'] = $result['posnavs'][count($result['posnavs']) - 1];
     $result['related'] = $related;
     $json_keys = $this->getJsonKey($viewname . '.html');
     if (count($json_keys)) {
         foreach ($json_keys as $key) {
             $result[$key] = $this->detailList($this->pagedata($key));
         }
     }
     $smarty = new Smarty();
     $smarty->setTemplateDir(app_path('views/templates/' . $this->themename));
     $smarty->setCompileDir(app_path('storage/views/compile'));
     $smarty->registerPlugin('function', 'mapExt', array('PrintController', 'createMap'));
     $smarty->registerPlugin('function', 'shareExt', array('PrintController', 'createShare'));
     $smarty->assign($result);
     $smarty->display($viewname . '.html');
     //return View::make('templates.'.$this->themename.'.'.$viewname,$result);
 }
Exemple #11
0
 private function delChildClassify($c_id)
 {
     $cus_id = Auth::id();
     $del_imgs = array();
     $child_ids = Classify::where('p_id', $c_id)->where('cus_id', $cus_id)->lists('id');
     if (count($child_ids)) {
         foreach ($child_ids as $id) {
             $classify = Classify::find($id);
             $c_del_img = $classify->img;
             $ids = Articles::where('c_id', $id)->lists('id');
             $a_del_imgs = Articles::where('c_id', $id)->lists('img');
             if (count($ids)) {
                 $m_del_imgs = MoreImg::whereIn('a_id', (array) $ids)->lists('img');
             } else {
                 $m_del_imgs = array();
             }
             $del_imgs = array_merge((array) $a_del_imgs, (array) $m_del_imgs);
             Classify::where('id', $id)->where('cus_id', $cus_id)->delete();
             Articles::where('c_id', $id)->where('cus_id', $cus_id)->delete();
             foreach ((array) $del_imgs as $val) {
                 $imgdel = new ImgDel();
                 $imgdel->mysave($val);
             }
             $imgdel = new ImgDel();
             $imgdel->mysave($c_del_img, 'category');
             $this->delMobileHomepage($id);
             $this->delChildClassify($id);
         }
     }
 }
Exemple #12
0
 public function pushFile()
 {
     $cus_id = Auth::id();
     $customerinfo = CustomerInfo::where('cus_id', $cus_id)->first();
     $pushed_at = strtotime($customerinfo->pushed_at);
     $updated_at = strtotime($customerinfo->updated_at);
     if ($pushed_at == NULL || $pushed_at < $updated_at) {
         //整站重新生成html
         //只需推送$customer.'.zip',不生成$customer.'_update.zip'
     } else {
         $pc_classify_updated = FALSE;
         $mobile_classify_updated = FALSE;
         $pc_classify_updated_at = Classify::where('cus_id', $cus_id)->where('pc_show', 1)->lists('updated_at');
         $mobile_classify_updated_at = Classify::where('cus_id', $cus_id)->where('mobile_show', 1)->lists('updated_at');
         foreach ($pc_classify_updated_at as $v) {
             if ($pushed_at < strtotime($v)) {
                 $pc_classify_updated = TRUE;
                 break;
             }
         }
         foreach ($mobile_classify_updated_at as $v) {
             if ($pushed_at < strtotime($v)) {
                 $mobile_classify_updated = TRUE;
                 break;
             }
         }
         /*
          /*找出PC生成html的部分
         */
         if ($pc_classify_updated || 'PC模版更换') {
             //PC所有页面重新生成html
         } else {
             $pc_article_updated_at = Articles::where('cus_id', $cus_id)->where('pc_show', 1)->lists('updated_at');
             $cids = explode(',', $this->getChirldenCid($v['value']['id']));
             //取得所有栏目id
             //PC文章修改--->其栏目、父级及长辈级栏目、文章页重新生成html
             //PC模版颜色更换
         }
         /*
          /*找出手机生成html的部分
         */
         if ($pc_classify_updated) {
             //手机所有页面重新生成html
         } else {
             //手机文章修改--->其栏目、父级及长辈级栏目、文章页重新生成html
             //手机模版颜色更换
         }
         //更新$customer.'.zip',创建$customer.'_update.zip',推送$customer.'_update.zip',删除$customer.'_update.zip'
     }
 }
Exemple #13
0
 public function renderArticles($args = NULL)
 {
     $this->template->setFile(dirname(__FILE__) . '/articles.latte');
     $this->articles->where('ad', '1');
     $this->render();
 }