Beispiel #1
0
 /**
  * 推送文章页
  *
  * @param int $id 文章id
  */
 public function articlepush($c_id, $publicdata, $last_html_precent, $html_precent)
 {
     set_time_limit(0);
     $paths = [];
     $result = $publicdata['result'];
     $result['navs'] = $this->publicnavs($c_id);
     $result['index_navs'] = $result['navs'];
     $customer_info = CustomerInfo::where('cus_id', $this->cus_id)->first();
     if ($customer_info->lang == 'en') {
         $lang['the_last'] = 'The last one';
         $lang['the_first'] = 'The first one';
     } else {
         $lang['the_last'] = '已经是最后一篇';
         $lang['the_first'] = '已经是第一篇';
     }
     if (is_array($result['navs']) && !empty($result['navs'])) {
         foreach ($result['navs'] as $nav) {
             if ($nav['current'] == 1) {
                 $pagenavs = $nav['childmenu'];
                 break;
             } else {
                 $pagenavs = array();
             }
         }
     }
     if (empty($pagenavs)) {
         $pagenavs = array();
     }
     $result['pagenavs'] = $pagenavs;
     $result['posnavs'] = $this->getPosNavs($c_id);
     $result['enlarge'] = 0;
     $article_type = Classify::where('id', $c_id)->pluck('article_type');
     if ($article_type == 1) {
         //新闻内容
         $viewname = 'content-news';
     } elseif ($article_type == 2) {
         //产品内容
         $viewname = 'content-product';
         $result['enlarge'] = $customer_info->enlarge;
         if ($result['enlarge'] && $this->type == 'pc') {
             $result['footscript'] .= '<script type="text/javascript" src="http://swap.5067.org/js/img.js"></script>';
         }
     } else {
         //跳转404
     }
     $result['article']['category'] = $result['posnavs'][count($result['posnavs']) - 1];
     $json_keys = $this->getJsonKey($viewname . '.html');
     if (count($json_keys)) {
         foreach ((array) $json_keys as $key) {
             $result[$key] = $this->detailList($this->pagedata($key, $publicdata['pagedata']));
         }
     }
     $articles = Articles::where($this->type . '_show', '1')->where('c_id', $c_id)->where('use_url', '0')->orderBy('is_top', 'desc')->orderBy('sort', 'asc')->orderBy('created_at', 'desc')->get()->toArray();
     $content = $publicdata['repleace'][$viewname . '.html'];
     $content = preg_replace($publicdata['pattern'], $publicdata['repleace'], $content);
     foreach ((array) $articles as $key => $article) {
         $the_result = array();
         $the_result = $result;
         $a_moreimg = Moreimg::where('a_id', $article['id'])->get()->toArray();
         array_unshift($a_moreimg, array('title' => $article['title'], 'img' => $article['img']));
         $images = array();
         if (count($a_moreimg)) {
             $i = 0;
             foreach ((array) $a_moreimg as $a_img) {
                 $images[$i]['title'] = $a_img['title'];
                 $images[$i]['image'] = $a_img['img'] ? $this->source_dir . 'l/articles/' . $a_img['img'] : '';
                 $i++;
             }
         }
         $the_result['title'] = $customer_info->title != "" ? $customer_info->title . '-' . $article['title'] : $article['title'];
         $the_result['keywords'] = $article['keywords'] != "" ? $article['keywords'] : $customer_info->keywords;
         $the_result['description'] = $article['introduction'] != "" ? $article['introduction'] : $customer_info->description;
         $the_result['article']['title'] = $article['title'];
         $the_result['article']['keywords'] = $article['keywords'];
         $the_result['article']['description'] = $article['introduction'];
         $the_result['article']['viewcount'] = '<em id="article-viewcount">0</em>';
         if (!isset($articles[$key + 1])) {
             $the_result['article']['next']['title'] = $lang['the_last'];
             $the_result['article']['next']['link'] = '';
         } else {
             $the_result['article']['next']['title'] = $articles[$key + 1]['title'];
             $the_result['article']['next']['link'] = $this->domain . '/detail/' . $articles[$key + 1]['id'] . '.html';
         }
         if (!isset($articles[$key - 1])) {
             $the_result['article']['prev']['title'] = $lang['the_first'];
             $the_result['article']['prev']['link'] = '';
         } else {
             $the_result['article']['prev']['title'] = $articles[$key - 1]['title'];
             $the_result['article']['prev']['link'] = $this->domain . '/detail/' . $articles[$key - 1]['id'] . '.html';
         }
         $the_result['article']['image'] = $article['img'] ? $this->source_dir . 'l/articles/' . $article['img'] : '';
         $the_result['article']['images'] = $images;
         $the_result['article']['content'] = preg_replace('/\\/customers\\/' . $this->customer . '/i', '', $article['content']);
         $the_result['article']['description'] = $article['introduction'];
         $the_result['article']['pubdate'] = $article['created_at'];
         $the_result['article']['pubtimestamp'] = strtotime($article['created_at']);
         //关联文章查询
         //                    $pa = new PhpAnalysis();
         //
         //                    $pa->SetSource($article['title']);
         //
         //                    //设置分词属性
         //                    $pa->resultType = 2;
         //                    $pa->differMax = true;
         //                    $pa->StartAnalysis();
         //
         //                    //获取你想要的结果
         //                    $keywords = $pa->GetFinallyIndex();
         //                    if (count($keywords)) {
         //                        $relation_where = "";
         //                        foreach ((array) $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 ((array) $related_data as $val) {
         //                                $temp_arr = array();
         //                                $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;
         //                            }
         //                        }
         //                    }
         $related = array();
         for (; count($related) < 6 && count($related) < count($articles);) {
             $k = rand(0, count($articles) - 1);
             $related[$k]['link'] = $this->domain . '/detail/' . $articles[$k]['id'] . '.html';
             $related[$k]['category']['link'] = $this->domain . '/category/' . $articles[$k]['id'] . '.html';
             $related[$k]['title'] = $articles[$k]['title'];
             $related[$k]['description'] = $articles[$k]['introduction'];
             $related[$k]['image'] = $articles[$k]['img'] ? $this->source_dir . 'l/articles/' . $articles[$k]['img'] : '';
             $related[$k]['pubdate'] = $articles[$k]['created_at'];
             $related[$k]['pubtimestamp'] = strtotime($articles[$k]['created_at']);
             $a_c_info = Classify::where('id', $articles[$k]['c_id'])->first();
             $related[$k]['category']['name'] = $a_c_info->name;
             $related[$k]['category']['en_name'] = $a_c_info->en_name;
             $related[$k]['category']['icon'] = '<i class="iconfont">' . $a_c_info->icon . '</i>';
         }
         $the_result['related'] = $related;
         $output = $this->pushdisplay($the_result, $content);
         if (!count($result['footer_navs'])) {
             $output = preg_replace('/<a href="' . str_replace("/", "\\/", $result['site_url']) . '"( target="_blank")?( )?>首页<\\/a>( )?\\|([\\s]+)?(<br \\/>)?(<br>)?/is', "", $output);
             $output = preg_replace('/<a href="' . str_replace("/", "\\/", $result['site_url']) . '"( target="_blank")?( )?>Home<\\/a>( )?\\|([\\s]+)?(<br \\/>)?(<br>)?/is', "", $output);
         }
         $path = $this->type == 'pc' ? public_path('customers/' . $this->customer . '/detail/' . $article['id'] . '.html') : public_path('customers/' . $this->customer . '/mobile/detail/' . $article['id'] . '.html');
         file_put_contents($path, $output);
         $paths[] = $path;
         $nowpercent = $last_html_precent + $html_precent;
         if (floor($nowpercent) !== floor($last_html_precent)) {
             echo '<div class="prompt">' . floor($nowpercent) . '%</div><script type="text/javascript">refresh(' . floor($nowpercent) . ');</script>';
             ob_flush();
             flush();
             PushQueue::where('pushtime', '<', time() - 60)->delete();
             PushQueue::where('cus_id', $this->cus_id)->update(['pushtime' => time()]);
         }
         $last_html_precent += $html_precent;
     }
     return $paths;
 }
Beispiel #2
0
 /**
  * 推送
  * 
  * 
  */
 public function pushPrecent()
 {
     set_time_limit(0);
     if (Input::has("pushgrad") == 1) {
         echo '<script type="text/javascript">function refresh(str){parent.refresh(str);};</script>';
         if (Input::has("push_c_id")) {
             $pushcid = Input::get("push_c_id");
         }
         if (Input::has("end")) {
             $end = Input::get("end");
         }
         //            $pushcid = $this->pushcid;
         //            $end = $this->end;
         //            $this->percent=0;
         //            $this->lastpercent=0;
         //            $this->html_precent=0;
         //            $this->last_html_precent=0;
         //            $this->pcpush=0;
         //            $this->mobilepush=0;
         //            $this->quickbarpush=0;
         //            $this->mobilehomepagepush=0;
     } else {
         if (!Input::has("name")) {
             echo '<script type="text/javascript">function refresh(str){parent.refresh(str);};</script>';
         }
         if (Input::has("push_c_id")) {
             $pushcid = Input::get("push_c_id");
         }
         if (Input::has("end")) {
             $end = Input::get("end");
         }
     }
     $have_article = Articles::where('cus_id', $this->cus_id)->count();
     if (!$have_article) {
         echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
         echo '<div class="prompt">没有文章不可推送</div><script type="text/javascript">alert("没有文章不可推送");refresh("没有文章不可推送");</script>';
         ob_flush();
         flush();
         exit;
     }
     if (!isset($_GET['gradpush'])) {
         $this->needpush();
     } else {
         $pc_domain = CustomerInfo::where('cus_id', $this->cus_id)->pluck('pc_domain');
         $mobile_domain = CustomerInfo::where('cus_id', $this->cus_id)->pluck('mobile_domain');
         $pc = str_replace('http://', '', $pc_domain);
         $mobile = str_replace('http://', '', $mobile_domain);
         if ($pc != '') {
             $this->pcpush = 1;
         }
         if ($mobile != '') {
             $this->mobilepush = 1;
         }
         $this->quickbarpush = 1;
         $this->mobilehomepagepush = 0;
     }
     echo '<div class="prompt">';
     var_dump('pcpush:' . $this->pcpush);
     var_dump('mobilepush:' . $this->mobilepush);
     var_dump('quickbarpush:' . $this->quickbarpush);
     var_dump('mobilehomepagepush:' . $this->mobilehomepagepush);
     echo '</div>';
     ob_flush();
     flush();
     $this->pushinit();
     if (!isset($end) || $end == 1) {
         if ($this->quickbarpush) {
             $this->pushQuickbar();
         }
         if (!$this->mobilepush) {
             if ($this->mobilehomepagepush) {
                 $this->mobilehomepage_push();
             }
         }
     }
     if ($this->pcpush || $this->mobilepush) {
         if (!$this->pcpush && $this->mobilepush) {
             $this->mobile_push();
             return true;
         }
         if (ob_get_level() == 0) {
             ob_start();
         }
         $pc_classify_ids = array();
         $mobile_classify_ids = array();
         $pc_article_ids = array();
         $mobile_article_ids = array();
         if ($this->mobilepush) {
             if (isset($pushcid)) {
                 if (!isset($end) || $end == 1) {
                     $mindexhtml = $this->homgepagehtml('mobile');
                     $msearchhtml = $this->sendData('mobile');
                 }
                 $mobile_classify_ids = array();
                 $mobile_article_ids = array();
                 $mobile_show = Classify::where('cus_id', $this->cus_id)->where("id", $pushcid)->pluck("mobile_show");
                 if ($mobile_show) {
                     $mobile_classify_ids[] = $pushcid;
                     $mobile_article_ids = Articles::where('cus_id', $this->cus_id)->where('mobile_show', 1)->where("c_id", $pushcid)->lists('id');
                 }
             } else {
                 $mindexhtml = $this->homgepagehtml('mobile');
                 $msearchhtml = $this->sendData('mobile');
                 $mobile_classify_ids = Classify::where('cus_id', $this->cus_id)->where('mobile_show', 1)->lists('id');
                 $mobile_article_ids = Articles::where('cus_id', $this->cus_id)->where('mobile_show', 1)->lists('id');
             }
         }
         if ($this->pcpush) {
             if (isset($pushcid)) {
                 if (!isset($end) || $end == 1) {
                     $indexhtml = $this->homgepagehtml('pc');
                     $searchhtml = $this->sendData('pc');
                 }
                 $pc_classify_ids = array();
                 $pc_article_ids = array();
                 $pc_show = Classify::where('cus_id', $this->cus_id)->where("id", $pushcid)->pluck("pc_show");
                 if ($pc_show) {
                     $pc_classify_ids[] = $pushcid;
                     $pc_article_ids = Articles::where('cus_id', $this->cus_id)->where('pc_show', 1)->where("c_id", $pushcid)->lists('id');
                 }
             } else {
                 $indexhtml = $this->homgepagehtml('pc');
                 $searchhtml = $this->sendData('pc');
                 $pc_classify_ids = Classify::where('cus_id', $this->cus_id)->where('pc_show', 1)->lists('id');
                 $pc_article_ids = Articles::where('cus_id', $this->cus_id)->where('pc_show', 1)->lists('id');
             }
         }
         $count = $this->htmlPagecount($pc_classify_ids, $mobile_classify_ids, $pc_article_ids, $mobile_article_ids);
         $this->html_precent = 70 / $count;
         if ($this->pcpush) {
             $categoryhtml = $this->categoryhtml($pc_classify_ids, 'pc');
             $articlehtml = $this->articlehtml($pc_classify_ids, 'pc');
         }
         if ($this->mobilepush) {
             $mcategoryhtml = $this->categoryhtml($mobile_classify_ids, 'mobile');
             $marticlehtml = $this->articlehtml($mobile_classify_ids, 'mobile');
         }
         $this->percent = 20 / $count;
         $path = public_path('customers/' . $this->customer . '/' . $this->customer . '.zip');
         if (file_exists($path)) {
             @unlink($path);
         }
         $zip = new ZipArchive();
         if ((!isset($end) || $end == 1) && $zip->open($path, ZipArchive::CREATE) === TRUE) {
             if ($this->pcpush) {
                 $this->addFileToZip(public_path("quickbar/"), $zip, "quickbar");
                 $zip->addFile($indexhtml, 'index.html');
                 $zip->addFile($searchhtml, 'search.html');
                 $zip->addFile(public_path('customers/' . $this->customer . '/article_data.json'), 'article_data.json');
                 $nowpercent = $this->percent + $this->lastpercent;
                 if (floor($nowpercent) != $this->lastpercent) {
                     echo '<div class="prompt">' . floor($nowpercent) . '%</div><script type="text/javascript">refresh(' . floor($nowpercent) . ');</script>';
                     ob_flush();
                     flush();
                     $this->clearpushqueue();
                 }
             }
             $this->lastpercent += 70 + $this->percent;
             if ($this->mobilepush) {
                 $this->addFileToZip(public_path("quickbar/"), $zip, "mobile/quickbar");
                 $zip->addFile($mindexhtml, 'mobile/index.html');
                 $zip->addFile($msearchhtml, 'mobile/search.html');
                 $zip->addFile(public_path('customers/' . $this->customer . '/mobile/article_data.json'), 'mobile/article_data.json');
                 $nowpercent = $this->percent + $this->lastpercent;
                 if (floor($nowpercent) != floor($this->lastpercent)) {
                     echo '<div class="prompt">' . floor($nowpercent) . '%</div><script type="text/javascript">refresh(' . floor($nowpercent) . ');</script>';
                     ob_flush();
                     flush();
                     $this->clearpushqueue();
                 }
             }
             $this->lastpercent += $this->percent;
             $zip->close();
         } else {
             $this->lastpercent += 70 + $this->percent;
         }
         if ($this->pcpush) {
             $this->compareZip($categoryhtml, 'category', $path);
             $this->compareZip($articlehtml, 'detail', $path);
         }
         if ($this->mobilepush) {
             $this->compareZip($mcategoryhtml, 'mobile/category', $path);
             $this->compareZip($marticlehtml, 'mobile/detail', $path);
         }
         if (90 > floor($this->lastpercent)) {
             echo '<div class="prompt">' . '90%</div><script type="text/javascript">refresh(90);</script>';
             ob_flush();
             flush();
             $this->clearpushqueue();
         }
         PushQueue::where('cus_id', $this->cus_id)->delete();
         $nextpush = PushQueue::where('push', 0)->first();
         if ($nextpush) {
             PushQueue::where('id', $nextpush->id)->update(['push' => 1]);
         }
         if ($zip->open($path, ZipArchive::CREATE) === TRUE) {
             if ((!isset($end) || $end == 1) && $this->pcpush) {
                 $pc_dir = Template::where('website_info.cus_id', $this->cus_id)->Leftjoin('website_info', 'website_info.pc_tpl_id', '=', 'template.id')->pluck('name');
                 $aim_dir = public_path("templates/{$pc_dir}/");
                 $this->addDir($aim_dir, $zip);
             }
             if ((!isset($end) || $end == 1) && $this->mobilepush) {
                 $mobile_dir = Template::where('website_info.cus_id', $this->cus_id)->Leftjoin('website_info', 'template.id', '=', 'website_info.mobile_tpl_id')->pluck('name');
                 $maim_dir = public_path("templates/{$mobile_dir}/");
                 $this->addDir($maim_dir, $zip, 'mobile/');
             }
             $zip->close();
             $customerinfo = Customer::find($this->cus_id);
             $ftp_array = explode(':', $customerinfo->ftp_address);
             $port = $customerinfo->ftp_port;
             $ftpdir = $customerinfo->ftp_dir;
             $ftp = $customerinfo->ftp;
             $ftp_array[1] = isset($ftp_array[1]) ? $ftp_array[1] : $port;
             $conn = ftp_connect($ftp_array[0], $ftp_array[1]);
             $del_imgs = ImgDel::where('cus_id', $this->cus_id)->get()->toArray();
             if (trim($ftp) == '1') {
                 if ($conn) {
                     ftp_login($conn, $customerinfo->ftp_user, $customerinfo->ftp_pwd);
                     ftp_pasv($conn, 1);
                     if (@ftp_chdir($conn, $this->customer) == FALSE) {
                         ftp_mkdir($conn, $this->customer);
                     }
                     foreach ((array) $del_imgs as $v) {
                         $this->delimg($v);
                         @ftp_delete($conn, "/" . $this->customer . '/images/l/' . $v['target'] . '/' . $v['img']);
                         @ftp_delete($conn, "/" . $this->customer . '/images/s/' . $v['target'] . '/' . $v['img']);
                         @ftp_delete($conn, "/" . $this->customer . '/mobile/images/l/' . $v['target'] . '/' . $v['img']);
                         @ftp_delete($conn, "/" . $this->customer . '/mobile/images/s/' . $v['target'] . '/' . $v['img']);
                     }
                     ImgDel::where('cus_id', $this->cus_id)->delete();
                     if ($this->pcpush) {
                         @ftp_put($conn, "/" . $this->customer . "/search.php", public_path("packages/search.php"), FTP_ASCII);
                         //@ftp_put($conn,"/".$this->customer."/quickbar.json",public_path('customers/'.$this->customer.'/quickbar.json'),FTP_ASCII);
                     }
                     if (file_exists($path)) {
                         ftp_put($conn, "/" . $this->customer . "/site.zip", $path, FTP_BINARY);
                     }
                     ftp_put($conn, "/" . $this->customer . "/unzip.php", public_path("packages/unzip.php"), FTP_ASCII);
                     if ($this->mobilepush) {
                         ftp_put($conn, "/" . $this->customer . "/mobile/search.php", public_path("packages/search.php"), FTP_ASCII);
                         if (@ftp_chdir($conn, "/" . $this->customer . "/mobile") == FALSE) {
                             ftp_mkdir($conn, "/" . $this->customer . "/mobile");
                         }
                         //ftp_put($conn,"/".$this->customer."/mobile/quickbar.json",public_path('customers/'.$this->customer.'/mobile/quickbar.json'),FTP_ASCII);
                     }
                     ftp_close($conn);
                 }
             } else {
                 if ($conn) {
                     ftp_login($conn, $customerinfo->ftp_user, $customerinfo->ftp_pwd);
                     ftp_pasv($conn, 1);
                     foreach ((array) $del_imgs as $v) {
                         $this->delimg($v);
                         @ftp_delete($conn, $ftpdir . '/images/l/' . $v['target'] . '/' . $v['img']);
                         @ftp_delete($conn, $ftpdir . '/images/s/' . $v['target'] . '/' . $v['img']);
                         @ftp_delete($conn, $ftpdir . '/mobile/images/l/' . $v['target'] . '/' . $v['img']);
                         @ftp_delete($conn, $ftpdir . '/mobile/images/s/' . $v['target'] . '/' . $v['img']);
                     }
                     ImgDel::where('cus_id', $this->cus_id)->delete();
                     if ($this->pcpush) {
                         ftp_put($conn, $ftpdir . "/search.php", public_path("packages/search.php"), FTP_ASCII);
                         //ftp_put($conn,$ftpdir."/quickbar.json",public_path('customers/'.$this->customer.'/quickbar.json'),FTP_ASCII);
                     }
                     ftp_put($conn, $ftpdir . "/unzip.php", public_path("packages/unzip.php"), FTP_ASCII);
                     if (file_exists($path)) {
                         ftp_put($conn, $ftpdir . "/site.zip", $path, FTP_BINARY);
                     }
                     if ($this->mobilepush) {
                         ftp_put($conn, $ftpdir . "/mobile/search.php", public_path("packages/search.php"), FTP_ASCII);
                         //ftp_put($conn,$ftpdir."/mobile/quickbar.json",public_path('customers/'.$this->customer.'/mobile/quickbar.json'),FTP_ASCII);
                     }
                     ftp_close($conn);
                 }
             }
             $this->folderClear();
             echo '<div class="prompt">' . '100%</div><script type="text/javascript">refresh(100);</script>';
             if (!isset($end) || $end == 1) {
                 Classify::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->update(['pushed' => 0]);
                 Articles::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->update(['pushed' => 0]);
                 WebsiteConfig::where('cus_id', $this->cus_id)->update(['pushed' => 0]);
                 WebsiteInfo::where('cus_id', $this->cus_id)->update(['pushed' => 0]);
                 MobileHomepage::where('cus_id', $this->cus_id)->update(['pushed' => 0]);
                 CustomerInfo::where('cus_id', $this->cus_id)->update(['pushed' => 0, 'lastpushtime' => date('Y-m-d H:i:s', time())]);
                 //date('Y-m-d H:i:s',time())
             }
             /**
              * pc使用本服务器自带域名推送,后期需要改进!
              */
             $weburl = Customer::where('id', $this->cus_id)->pluck('weburl');
             $suf_url = str_replace('http://c', '', $weburl);
             $cus_name = strtolower(Customer::where('id', $this->cus_id)->pluck('name'));
             if (trim($ftp) == '1') {
                 $ftp_pcdomain = "http://" . $cus_name . $suf_url;
             } else {
                 $ftp_pcdomain = $customerinfo->pc_domain;
             }
             @file_get_contents("{$ftp_pcdomain}/unzip.php");
         } else {
             echo '打包失败';
         }
         ob_end_flush();
     } else {
         echo '<div class="prompt">' . '100%</div><script type="text/javascript">refresh(100);</script>';
         if (!isset($end) || $end == 1) {
             Classify::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->update(['pushed' => 0]);
             Articles::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->update(['pushed' => 0]);
             WebsiteConfig::where('cus_id', $this->cus_id)->update(['pushed' => 0]);
             WebsiteInfo::where('cus_id', $this->cus_id)->update(['pushed' => 0]);
             MobileHomepage::where('cus_id', $this->cus_id)->update(['pushed' => 0]);
             CustomerInfo::where('cus_id', $this->cus_id)->update(['pushed' => 0, 'lastpushtime' => date('Y-m-d H:i:s', time())]);
             //date('Y-m-d H:i:s',time())
             ob_end_flush();
         }
     }
 }