作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -153,9 +153,12 @@ class HtmlCollect extends Command @@ -153,9 +153,12 @@ class HtmlCollect extends Command
153 case 'blog': 153 case 'blog':
154 $source = RouteMap::SOURCE_BLOG; 154 $source = RouteMap::SOURCE_BLOG;
155 break; 155 break;
156 - default: 156 + case 'post':
157 $source = RouteMap::SOURCE_PRODUCT; 157 $source = RouteMap::SOURCE_PRODUCT;
158 break; 158 break;
  159 + default:
  160 + $source = RouteMap::SOURCE_MODULE;
  161 + break;
159 } 162 }
160 163
161 $complete = false; 164 $complete = false;
@@ -260,6 +263,7 @@ class HtmlCollect extends Command @@ -260,6 +263,7 @@ class HtmlCollect extends Command
260 //判断资源是否需要下载 263 //判断资源是否需要下载
261 protected function url_check($url, $project_id, $domain, $web_url_domain, $home_url) 264 protected function url_check($url, $project_id, $domain, $web_url_domain, $home_url)
262 { 265 {
  266 + $url = trim($url);
263 if ($url) { 267 if ($url) {
264 $url = str_replace('"', '', $url); 268 $url = str_replace('"', '', $url);
265 $arr = parse_url($url); 269 $arr = parse_url($url);
@@ -155,9 +155,12 @@ class HtmlLanguageCollect extends Command @@ -155,9 +155,12 @@ class HtmlLanguageCollect extends Command
155 case 'blog': 155 case 'blog':
156 $source = RouteMap::SOURCE_BLOG; 156 $source = RouteMap::SOURCE_BLOG;
157 break; 157 break;
158 - default: 158 + case 'post':
159 $source = RouteMap::SOURCE_PRODUCT; 159 $source = RouteMap::SOURCE_PRODUCT;
160 break; 160 break;
  161 + default:
  162 + $source = RouteMap::SOURCE_MODULE;
  163 + break;
161 } 164 }
162 165
163 $complete = false; 166 $complete = false;
@@ -276,6 +279,7 @@ class HtmlLanguageCollect extends Command @@ -276,6 +279,7 @@ class HtmlLanguageCollect extends Command
276 //判断资源是否需要下载 279 //判断资源是否需要下载
277 protected function url_check($url, $project_id, $domain, $web_url_domain, $home_url) 280 protected function url_check($url, $project_id, $domain, $web_url_domain, $home_url)
278 { 281 {
  282 + $url = trim($url);
279 if ($url) { 283 if ($url) {
280 $url = str_replace('"', '', $url); 284 $url = str_replace('"', '', $url);
281 $arr = parse_url($url); 285 $arr = parse_url($url);
@@ -10,6 +10,9 @@ use App\Models\Collect\CollectSource; @@ -10,6 +10,9 @@ use App\Models\Collect\CollectSource;
10 use App\Models\Collect\CollectTask; 10 use App\Models\Collect\CollectTask;
11 use App\Models\Com\UpdateLog; 11 use App\Models\Com\UpdateLog;
12 use App\Models\Com\UpdateOldInfo; 12 use App\Models\Com\UpdateOldInfo;
  13 +use App\Models\CustomModule\CustomModule;
  14 +use App\Models\CustomModule\CustomModuleCategory;
  15 +use App\Models\CustomModule\CustomModuleContent;
13 use App\Models\News\News; 16 use App\Models\News\News;
14 use App\Models\News\NewsCategory; 17 use App\Models\News\NewsCategory;
15 use App\Models\Product\Category; 18 use App\Models\Product\Category;
@@ -187,6 +190,7 @@ class ProjectUpdate extends Command @@ -187,6 +190,7 @@ class ProjectUpdate extends Command
187 if (isset($data['code']) && $data['code'] == 200) { 190 if (isset($data['code']) && $data['code'] == 200) {
188 $phones = $data['data']['phones'] ?? ''; 191 $phones = $data['data']['phones'] ?? '';
189 $emails = $data['data']['emails'] ?? ''; 192 $emails = $data['data']['emails'] ?? '';
  193 + $custom_types = $data['data']['customposttypes'] ?? '';
190 194
191 $model = new WebSettingReceiving(); 195 $model = new WebSettingReceiving();
192 if ($phones) { 196 if ($phones) {
@@ -229,6 +233,25 @@ class ProjectUpdate extends Command @@ -229,6 +233,25 @@ class ProjectUpdate extends Command
229 } 233 }
230 } 234 }
231 } 235 }
  236 + if ($custom_types) {
  237 + $custom_model = new CustomModule();
  238 + foreach ($custom_types as $v_custom) {
  239 + try {
  240 + $custom_info = $custom_model->read(['route' => $v_custom]);
  241 + if (!$custom_info) {
  242 + $custom_model->add([
  243 + 'name' => $v_custom,
  244 + 'project_id' => $project_id,
  245 + 'route' => $v_custom
  246 + ]);
  247 + }
  248 + UpdateLog::createLog($project_id, $v_custom, $task->api_url);
  249 + } catch (\Exception $e) {
  250 + echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
  251 + continue;
  252 + }
  253 + }
  254 + }
232 } else { 255 } else {
233 return true; 256 return true;
234 } 257 }
@@ -392,7 +415,7 @@ class ProjectUpdate extends Command @@ -392,7 +415,7 @@ class ProjectUpdate extends Command
392 $category_id = $logic->getCategory(array_column($category_arr, 'id')); 415 $category_id = $logic->getCategory(array_column($category_arr, 'id'));
393 } 416 }
394 //图片 417 //图片
395 - if (is_array($item['images'])) { 418 + if (is_array($item['images'] ?? '')) {
396 $image = $item['images'][0] ?? ''; 419 $image = $item['images'][0] ?? '';
397 } else { 420 } else {
398 $image = $item['images'] ?? ''; 421 $image = $item['images'] ?? '';
@@ -448,7 +471,7 @@ class ProjectUpdate extends Command @@ -448,7 +471,7 @@ class ProjectUpdate extends Command
448 } else { 471 } else {
449 return true; 472 return true;
450 } 473 }
451 - } else { 474 + } elseif ($api_type == 'page') {
452 //单页 475 //单页
453 $url = $api_url . '?' . http_build_query(['w' => 'page', 'page' => 1, 'pagesize' => 0]); 476 $url = $api_url . '?' . http_build_query(['w' => 'page', 'page' => 1, 'pagesize' => 0]);
454 $data = curl_c($url); 477 $data = curl_c($url);
@@ -510,6 +533,79 @@ class ProjectUpdate extends Command @@ -510,6 +533,79 @@ class ProjectUpdate extends Command
510 } else { 533 } else {
511 return true; 534 return true;
512 } 535 }
  536 + } else {
  537 + //自定义模块
  538 + $custom_model = new CustomModule();
  539 + $custom_info = $custom_model->read(['route' => $api_type]);
  540 + if ($custom_info) {
  541 + $url = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => 1, 'pagesize' => 0]);
  542 + $data = curl_c($url);
  543 + if (isset($data['code']) && $data['code'] == 200) {
  544 + $category = $data['data']['category'] ?? [];
  545 + $this->category_custom_insert($project_id, $custom_info['id'], $category, 0);
  546 +
  547 + $count = $data['data']['count'] ?? 0;
  548 +
  549 + $total_page = ceil($count / $page_size);
  550 + for ($page = 1; $page <= $total_page; $page++) {
  551 + $url_page = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => $page, 'pagesize' => $page_size]);
  552 + $data_page = curl_c($url_page);
  553 + if (isset($data_page['code']) && $data_page['code'] == 200) {
  554 + $items = $data_page['data']['data'] ?? [];
  555 +
  556 + $model = new CustomModuleContent();
  557 + $category_model = new CustomModuleCategory();
  558 +
  559 + foreach ($items as $item) {
  560 + $route = $this->get_url_route($item['url'] ?? '');
  561 + if ($route) {
  562 + //分类
  563 + $category_id = '';
  564 + if ($item['category'] ?? []) {
  565 + $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]);
  566 + $category_id = implode(',', array_column($category_arr, 'id'));
  567 + }
  568 + //名称去掉特殊符号
  569 + $item['title'] = $this->special2str($item['title'] ?? '');
  570 +
  571 + try {
  572 + $custom_content = $model->read(['route' => $route], 'id');
  573 + if (!$custom_content) {
  574 + $id = $model->insertGetId([
  575 + 'project_id' => $project_id,
  576 + 'name' => $item['title'],
  577 + 'module_id' => $custom_info['id'],
  578 + 'category_id' => $category_id,
  579 + 'content' => $item['content'] ?? '',
  580 + 'created_at' => $item['post_time'] ?? date('Y-m-d H:i:s'),
  581 + 'updated_at' => $item['post_time'] ?? date('Y-m-d H:i:s'),
  582 + 'is_upgrade' => 1,
  583 + 'six_read' => 1,
  584 + 'route' => $route
  585 + ]);
  586 + $this->set_map($route, RouteMap::SOURCE_MODULE, $id, $project_id);
  587 +
  588 + CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_MODULE, $id, $domain_arr['host'], $link_type, $language_list, $page_list);
  589 + } else {
  590 + $id = $custom_content['id'];
  591 + $model->edit([
  592 + 'name' => $item['title'],
  593 + 'category_id' => $category_id,
  594 + 'content' => $item['content'] ?? '',
  595 + ], ['id' => $id]);
  596 + }
  597 + } catch (\Exception $e) {
  598 + echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
  599 + continue;
  600 + }
  601 + }
  602 + }
  603 + }
  604 + }
  605 + } else {
  606 + return true;
  607 + }
  608 + }
513 } 609 }
514 } 610 }
515 //关闭数据库 611 //关闭数据库
@@ -595,7 +691,7 @@ class ProjectUpdate extends Command @@ -595,7 +691,7 @@ class ProjectUpdate extends Command
595 $parent_id = $parent['id']; 691 $parent_id = $parent['id'];
596 } 692 }
597 693
598 - if (!empty($item['children'])) { 694 + if (!empty($item['children'] ?? [])) {
599 $this->category_insert($project_id, $item['children'], $parent_id); 695 $this->category_insert($project_id, $item['children'], $parent_id);
600 } 696 }
601 } 697 }
@@ -629,13 +725,48 @@ class ProjectUpdate extends Command @@ -629,13 +725,48 @@ class ProjectUpdate extends Command
629 $parent_id = $parent['id']; 725 $parent_id = $parent['id'];
630 } 726 }
631 727
632 - if (!empty($item['children'])) { 728 + if (!empty($item['children'] ?? [])) {
633 $this->category_news_insert($project_id, $item['children'], $parent_id); 729 $this->category_news_insert($project_id, $item['children'], $parent_id);
634 } 730 }
635 } 731 }
636 } 732 }
637 } 733 }
638 734
  735 + //扩展模块多级分类入库
  736 + protected function category_custom_insert($project_id, $module_id, $items, $pid = 0)
  737 + {
  738 + $model = new CustomModuleCategory();
  739 + foreach ($items as $item) {
  740 + $route = $this->get_url_route($item['url'] ?? '');
  741 + if ($route) {
  742 + $parent = $model->read(['pid' => $pid, 'route' => $route], 'id');
  743 + if (!$parent) {
  744 + try {
  745 + $item['name'] = $this->special2str($item['name'] ?? '');
  746 + $parent_id = $model->addReturnId([
  747 + 'project_id' => $project_id,
  748 + 'module_id' => $module_id,
  749 + 'name' => $item['name'],
  750 + 'pid' => $pid,
  751 + 'original_id' => $item['id'],
  752 + 'route' => $route
  753 + ]);
  754 + $this->set_map($route, RouteMap::SOURCE_MODULE_CATE, $parent_id, $project_id);
  755 + } catch (\Exception $e) {
  756 + echo 'date:' . date('Y-m-d H:i:s') . ', category_custom_insert error: ' . $e->getMessage() . PHP_EOL;
  757 + continue;
  758 + }
  759 + } else {
  760 + $parent_id = $parent['id'];
  761 + }
  762 +
  763 + if (!empty($item['children'] ?? [])) {
  764 + $this->category_custom_insert($project_id, $module_id, $item['children'], $parent_id);
  765 + }
  766 + }
  767 + }
  768 + }
  769 +
639 //特殊字符转换 770 //特殊字符转换
640 protected function special2str($str) 771 protected function special2str($str)
641 { 772 {
@@ -3,10 +3,11 @@ @@ -3,10 +3,11 @@
3 namespace App\Console\Commands; 3 namespace App\Console\Commands;
4 4
5 use App\Helper\Arr; 5 use App\Helper\Arr;
6 -use App\Models\Domain\DomainInfo;  
7 -use App\Models\Project\DeployOptimize; 6 +use App\Models\Product\Category;
  7 +use App\Models\Product\Product;
  8 +use App\Models\Project\OnlineCheck;
8 use App\Models\Project\Project; 9 use App\Models\Project\Project;
9 -use App\Models\RouteMap\RouteMap; 10 +use App\Models\Template\BCustomTemplate;
10 use App\Services\ProjectServer; 11 use App\Services\ProjectServer;
11 use Carbon\Carbon; 12 use Carbon\Carbon;
12 use GuzzleHttp\Client; 13 use GuzzleHttp\Client;
@@ -190,13 +191,13 @@ class WebTraffic extends Command @@ -190,13 +191,13 @@ class WebTraffic extends Command
190 191
191 $data = [ 192 $data = [
192 'ip' => $ips[$project_key]['ip'], 193 'ip' => $ips[$project_key]['ip'],
193 - 'referrer_url' => $this->getReferer($ips[$project_key]['ip_area']),  
194 'url' => $project['visit_urls'][$j], 194 'url' => $project['visit_urls'][$j],
195 'device_port' => $project['device_port'], 195 'device_port' => $project['device_port'],
196 - 'domain' => $project['domain'], 196 + 'referrer_url' => $this->getReferer($ips[$project_key]['ip_area']),
  197 + 'user_agent' => $project['user_agent'],
197 ]; 198 ];
198 Log::channel('traffic')->info('traffic project_id:' . $project['project_id'], $data); 199 Log::channel('traffic')->info('traffic project_id:' . $project['project_id'], $data);
199 - $promises[] = $client->postAsync($project['domain'] . 'api/customerVisit', ['form_params' => $data]); 200 + $promises[] = $client->postAsync($project['domain'] . 'api/traffic_visit', ['form_params' => $data]);
200 } 201 }
201 202
202 if($promises){ 203 if($promises){
@@ -233,28 +234,29 @@ class WebTraffic extends Command @@ -233,28 +234,29 @@ class WebTraffic extends Command
233 protected function getProjectList($type, $page){ 234 protected function getProjectList($type, $page){
234 //推广项目 235 //推广项目
235 $list = Project::with('domainInfo') 236 $list = Project::with('domainInfo')
236 - ->leftJoin('gl_project_deploy_optimize', 'gl_project_deploy_optimize.project_id', '=', 'gl_project.id')  
237 - ->where('gl_project_deploy_optimize.domain', '>', 0) 237 + ->leftJoin('gl_project_deploy_optimize as pdo', 'pdo.project_id', '=', 'gl_project.id')
  238 + ->leftJoin('gl_project_online_check as poc', 'poc.project_id', '=', 'gl_project.id')
  239 + ->where('pdo.domain', '>', 0)
  240 + ->where('poc.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)
238 ->whereIn('gl_project.type', [Project::TYPE_TWO, Project::TYPE_FOUR]) 241 ->whereIn('gl_project.type', [Project::TYPE_TWO, Project::TYPE_FOUR])
239 - ->whereIn('gl_project_deploy_optimize.project_id', [6,25]) //todo 测试两个项目 后面删掉  
240 - ->where(function ($query) use ($type){ 242 + ->whereIn('pdo.project_id', [6, 25]) //todo 测试两个项目 后面删掉
  243 + ->where(function ($query) use ($type) {
241 if($type == 1){ 244 if($type == 1){
242 //1-3个月项目 245 //1-3个月项目
243 $startTime = Carbon::now()->addMonths(-4)->toDateString(); 246 $startTime = Carbon::now()->addMonths(-4)->toDateString();
244 $endTime = Carbon::now()->addMonths(-1)->toDateString(); 247 $endTime = Carbon::now()->addMonths(-1)->toDateString();
245 - $query->whereBetween('gl_project_deploy_optimize.start_date', [$startTime,$endTime]); 248 + $query->whereBetween('pdo.start_date', [$startTime,$endTime]);
246 }elseif($type == 2){ 249 }elseif($type == 2){
247 //4-8个月项目 250 //4-8个月项目
248 $startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString(); 251 $startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();
249 $endTime = Carbon::now()->addMonths(-4)->endOfDay()->toDateTimeString(); 252 $endTime = Carbon::now()->addMonths(-4)->endOfDay()->toDateTimeString();
250 - $query->whereBetween('gl_project_deploy_optimize.start_date', [$startTime,$endTime]); 253 + $query->whereBetween('pdo.start_date', [$startTime,$endTime]);
251 }else{ 254 }else{
252 //大于9个月项目 255 //大于9个月项目
253 $startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString(); 256 $startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();
254 - $query->whereBetween('gl_project_deploy_optimize.start_date', '<', $startTime); 257 + $query->whereBetween('pdo.start_date', '<', $startTime);
255 } 258 }
256 - })->select('gl_project_deploy_optimize.project_id')->forPage($page, 500)->get();  
257 - 259 + })->select('pdo.project_id')->forPage($page, 500)->get();
258 //其他地方在引流的域名 260 //其他地方在引流的域名
259 $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray(); 261 $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
260 262
@@ -278,28 +280,17 @@ class WebTraffic extends Command @@ -278,28 +280,17 @@ class WebTraffic extends Command
278 */ 280 */
279 protected function getProductUrls($project_id){ 281 protected function getProductUrls($project_id){
280 ProjectServer::useProject($project_id); 282 ProjectServer::useProject($project_id);
281 - //产品分类页面  
282 - $product_cate_ids = DB::connection('custom_mysql')->table('gl_product_category')  
283 - ->where('project_id', $project_id)->where('status', 1)->pluck('id')->toArray();  
284 - //只查发布的分类路由  
285 - $data['urls_cats'] = DB::connection('custom_mysql')->table('gl_route_map')  
286 - ->where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT_CATE)  
287 - ->whereIn('source_id', $product_cate_ids)->get()->toArray();  
288 -  
289 - //单页面  
290 - $page_ids = DB::connection('custom_mysql')->table('gl_web_custom_template')  
291 - ->where('project_id', $project_id)->where('status', 1)->pluck('id')->toArray();  
292 - //只查发布的单页面  
293 - $data['urls_page'] = DB::connection('custom_mysql')->table('gl_route_map')  
294 - ->where('project_id', $project_id)->where('source', RouteMap::SOURCE_PAGE)  
295 - ->whereIn('source_id', $page_ids)->get()->toArray();  
296 -  
297 - //产品详情页  
298 - $product_ids = DB::connection('custom_mysql')->table('gl_product')  
299 - ->where('project_id', $project_id)->where('status', 1)->pluck('id')->toArray();  
300 - $data['urls_details'] = DB::connection('custom_mysql')->table('gl_route_map')  
301 - ->where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT)  
302 - ->whereIn('source_id', $product_ids)->get()->toArray(); 283 + //已发布产品分类页面
  284 + $data['urls_cats'] = DB::connection('custom_mysql')->table('gl_product_category')
  285 + ->where('project_id', $project_id)->where('status', Category::STATUS_ACTIVE)->pluck('route','id')->toArray();
  286 +
  287 + //已发布单页面
  288 + $data['urls_page'] = DB::connection('custom_mysql')->table('gl_web_custom_template')
  289 + ->where('project_id', $project_id)->where('status', BCustomTemplate::STATUS_ACTIVE)->pluck('url', 'id')->toArray();
  290 +
  291 + //已发布产品详情页
  292 + $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product')
  293 + ->where('project_id', $project_id)->where('status', Product::STATUS_ON)->pluck('route', 'id')->toArray();
303 294
304 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']); 295 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']);
305 if(empty($data['urls_cats'])){ 296 if(empty($data['urls_cats'])){
@@ -374,21 +365,24 @@ class WebTraffic extends Command @@ -374,21 +365,24 @@ class WebTraffic extends Command
374 365
375 $url = []; 366 $url = [];
376 if($res_sdzb == 0){//深度一页 367 if($res_sdzb == 0){//深度一页
377 - $url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb])->route : ''; 368 + $url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb]) : '';
378 }elseif($res_sdzb == 1){//深度两页 369 }elseif($res_sdzb == 1){//深度两页
379 $url[] = $project_urls['home']; 370 $url[] = $project_urls['home'];
380 - $url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb])->route : ''; 371 + $url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb]) : '';
381 }elseif($res_sdzb == 2){//深度3-6页 372 }elseif($res_sdzb == 2){//深度3-6页
382 $yms = rand(2,5); //随机页面数 373 $yms = rand(2,5); //随机页面数
383 - $url = Arr::pluck(Arr::random($all_url, $yms), 'route'); 374 + $url = Arr::random($all_url, $yms);
384 $url = Arr::prepend($url, $project_urls['home']);//首页加到最前面去 375 $url = Arr::prepend($url, $project_urls['home']);//首页加到最前面去
385 }elseif($res_sdzb == 3){//深度7-11页 376 }elseif($res_sdzb == 3){//深度7-11页
386 $yms = rand(6,10); //随机页面数 377 $yms = rand(6,10); //随机页面数
387 - $url = Arr::pluck(Arr::random($all_url, $yms), 'route'); 378 + $url = Arr::random($all_url, $yms);
388 $url = Arr::prepend($url, $project_urls['home']);//首页加到最前面去 379 $url = Arr::prepend($url, $project_urls['home']);//首页加到最前面去
389 } 380 }
390 foreach ($url as &$v){ 381 foreach ($url as &$v){
391 if(!Str::contains($v, $project_urls['home'])){ 382 if(!Str::contains($v, $project_urls['home'])){
  383 + if (FALSE === strpos($v, '.htm')) {
  384 + $v .= '/';
  385 + }
392 $v = $project_urls['home'] . $v; 386 $v = $project_urls['home'] . $v;
393 } 387 }
394 } 388 }
@@ -26,9 +26,9 @@ class Kernel extends ConsoleKernel @@ -26,9 +26,9 @@ class Kernel extends ConsoleKernel
26 $schedule->command('rank_data_week')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次 26 $schedule->command('rank_data_week')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次
27 // $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次 27 // $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次
28 $schedule->command('count')->dailyAt('01:00')->withoutOverlapping(1); //每天凌晨1点执行一次 28 $schedule->command('count')->dailyAt('01:00')->withoutOverlapping(1); //每天凌晨1点执行一次
29 -// $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次  
30 -// $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次  
31 -// $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次 29 + $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
  30 + $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
  31 + $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次
32 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次 32 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次
33 $schedule->command('month_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计记录 33 $schedule->command('month_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计记录
34 $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录 34 $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录
@@ -52,16 +52,8 @@ class Category extends Base @@ -52,16 +52,8 @@ class Category extends Base
52 */ 52 */
53 public static function getProductNum($cate_id){ 53 public static function getProductNum($cate_id){
54 $cate_ids = self::getChildIdsArr($cate_id); 54 $cate_ids = self::getChildIdsArr($cate_id);
55 - $str = 0;  
56 - foreach ($cate_ids as $v){  
57 - $info = self::where('pid',$v)->first();  
58 - if($info){  
59 - continue;  
60 - }else{  
61 - $count = Product::where('category_id','like','%,'.$v.',%')->count();  
62 - $str = $str+$count;  
63 - }  
64 - }  
65 - return $str; 55 + $count = CategoryRelated::whereIn('cate_id',$cate_ids)->count();
  56 +// $str = 0;
  57 + return $count;
66 } 58 }
67 } 59 }
@@ -11,4 +11,6 @@ class BCustomTemplate extends Base @@ -11,4 +11,6 @@ class BCustomTemplate extends Base
11 protected $connection = 'custom_mysql'; 11 protected $connection = 'custom_mysql';
12 12
13 const NOT_FOUND_PAGE_URL = '404'; 13 const NOT_FOUND_PAGE_URL = '404';
  14 +
  15 + const STATUS_ACTIVE = 1;
14 } 16 }