Пример #1
0
 public function articleDelete()
 {
     $del_imgs = array();
     $cus_id = Auth::id();
     $ids = explode(',', Input::get('id'));
     if (count($ids) > 1) {
         //执行批量删除
         $failed = 0;
         foreach ($ids as $id) {
             $article = Articles::find($id);
             Classify::where('cus_id', $cus_id)->where('id', $article->c_id)->update(['pushed' => 1]);
             $data = MoreImg::where('a_id', $id)->get()->toArray();
             $result = Articles::where('id', '=', $id)->delete();
             if (!$result) {
                 $failed++;
             } else {
                 foreach ((array) $data as $v) {
                     $del_imgs[] = $v["img"];
                 }
                 $del_imgs[] = $article->img;
             }
         }
         foreach ((array) $del_imgs as $v) {
             $imgdel = new ImgDel();
             $imgdel->mysave($v, 'articles');
         }
         if ($failed) {
             $return_msg = array('err' => 3001, 'msg' => $failed . '条记录删除失败');
         } else {
             $return_msg = array('err' => 0, 'msg' => '');
         }
     } else {
         //单条删除
         $article = Articles::find($ids[0]);
         Classify::where('cus_id', $cus_id)->where('id', $article->c_id)->update(['pushed' => 1]);
         $data = MoreImg::where('a_id', $ids[0])->get()->toArray();
         $result = Articles::where('id', '=', $ids[0])->delete();
         if ($result) {
             foreach ((array) $data as $v) {
                 $del_imgs[] = $v["img"];
             }
             $del_imgs[] = $article->img;
             foreach ((array) $del_imgs as $v) {
                 $imgdel = new ImgDel();
                 $imgdel->mysave($v, 'articles');
             }
             $return_msg = array('err' => 0, 'msg' => '');
         } else {
             $return_msg = array('err' => 3001, 'msg' => '文章删除失败');
         }
     }
     return Response::json($return_msg);
 }
Пример #2
0
 /**
  * 用户修改设置
  */
 public function customerSetting()
 {
     $cus_id = Auth::id();
     $logo = CustomerInfo::where('cus_id', $cus_id)->pluck('logo');
     $logo_small = CustomerInfo::where('cus_id', $cus_id)->pluck('logo_small');
     $org_floatadv = CustomerInfo::where('cus_id', $cus_id)->pluck('floatadv');
     $org_floatadv = json_decode($org_floatadv);
     $org_imgs = array();
     foreach ((array) $org_floatadv as $v) {
         if (!isset($v->type) || $v->type == 'adv') {
             $org_imgs[] = $v->adv;
         }
     }
     $data['background_music'] = Input::get('background_music');
     $data['talent_support'] = Input::get('talent_support');
     $data['company'] = strtolower(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');
     $data['pc_page_imgtxt_count'] = Input::get('pc_imgtxt_per_page') > 0 ? Input::get('pc_imgtxt_per_page') : 3;
     $data['pc_page_txt_count'] = Input::get('pc_txt_per_page') > 0 ? Input::get('pc_txt_per_page') : 3;
     $data['pc_page_img_count'] = Input::get('pc_img_per_page') > 0 ? Input::get('pc_img_per_page') : 3;
     $data['pc_page_count_switch'] = Input::get('pc_page_count_switch');
     $data['enlarge'] = Input::get('enlargev');
     $data['lang'] = Input::get('lang');
     $data['copyright'] = Input::get('copyright');
     $data['pushed'] = 1;
     $float_adv = Input::get('float_adv') ? Input::get('float_adv') : array();
     $float_type = Input::get('float_type') ? Input::get('float_type') : array();
     $posx = Input::get('posx') ? Input::get('posx') : array();
     $posy = Input::get('posy') ? Input::get('posy') : array();
     $posw = Input::get('posw') ? Input::get('posw') : array();
     $href = Input::get('href') ? Input::get('href') : array();
     $position = Input::get('position') ? Input::get('position') : array();
     $floatadv = array();
     $num = 0;
     foreach ((array) $float_adv as $key => $val) {
         $floatadv[$num]['adv'] = $val;
         $floatadv[$num]['type'] = $float_type[$key];
         $floatadv[$num]['posx'] = $posx[$key];
         $floatadv[$num]['posy'] = $posy[$key];
         $floatadv[$num]['posw'] = $posw[$key];
         $floatadv[$num]['href'] = !empty($href[$key]) ? $href[$key] : '';
         $floatadv[$num]['position'] = $position[$key];
         $num++;
     }
     $data['floatadv'] = json_encode($floatadv);
     $update = CustomerInfo::where('cus_id', $cus_id)->update($data);
     if ($update) {
         if ($logo != $data['logo']) {
             $imgdel = new ImgDel();
             $imgdel->mysave($logo, 'common');
         }
         if ($logo_small != $data['logo_small']) {
             $imgdel = new ImgDel();
             $imgdel->mysave($logo_small, 'common');
         }
         foreach ((array) $org_imgs as $v) {
             if (!in_array($v, $float_adv)) {
                 $imgdel = new ImgDel();
                 $imgdel->mysave($v, 'common');
             }
         }
         $result = ['err' => 0, 'msg' => '', 'data' => ''];
     } else {
         $result = ['err' => 1002, 'msg' => '无法保存数据', 'data' => ''];
     }
     return Response::json($result);
 }
Пример #3
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);
         }
     }
 }
Пример #4
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();
         }
     }
 }
Пример #5
0
 public function quickBarJsonModify()
 {
     $cus_id = Auth::id();
     $org_img = '';
     $vx_bar_img = '';
     $data = Input::get('QuickBar');
     $QuickBar = serialize($data);
     foreach ((array) $data as $v) {
         if ($v['for'] === 'vx_barcode') {
             $vx_bar_img = basename($v['data']);
         }
     }
     $websiteconfig = WebsiteConfig::where('cus_id', $cus_id)->where('type', 2)->where('template_id', '0')->where('key', 'quickbar')->pluck('value');
     foreach ((array) unserialize($websiteconfig) as $v) {
         if ($v['for'] === 'vx_barcode') {
             $org_img = basename($v['data']);
         }
     }
     $id = WebsiteConfig::where('cus_id', $cus_id)->where('type', 2)->where('template_id', '0')->where('key', 'quickbar')->pluck('id');
     if ($id) {
         $QuickData = WebsiteConfig::find($id);
     } else {
         $QuickData = new WebsiteConfig();
         $QuickData->cus_id = $cus_id;
         $QuickData->type = 2;
         $QuickData->template_id = 0;
         $QuickData->key = 'quickbar';
     }
     $QuickData->pushed = 1;
     $QuickData->value = $QuickBar;
     $result = $QuickData->save();
     if ($result) {
         if ($org_img != $vx_bar_img) {
             $imgdel = new ImgDel();
             $imgdel->mysave($org_img, 'common');
         }
         $json_result = ['err' => 0, 'msg' => '保存成功'];
     } else {
         $json_result = ['err' => 1001, 'msg' => '该栏目存在文章,需转移才能创建子栏目', 'data' => []];
     }
     return Response::Json($json_result);
 }