|
...
|
...
|
@@ -6,6 +6,7 @@ use App\Helper\Arr; |
|
|
|
use App\Models\Product\Category;
|
|
|
|
use App\Models\Product\Product;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use GuzzleHttp\Client;
|
|
|
|
use GuzzleHttp\Promise\Utils;
|
|
|
|
use Illuminate\Console\Command;
|
|
...
|
...
|
@@ -230,20 +231,26 @@ class WebTraffic extends Command |
|
|
|
*/
|
|
|
|
protected function getProductUrls($project_id){
|
|
|
|
//产品分类页面
|
|
|
|
$product_cate_ids = Category::where('project_id', $project_id)->where('status', Category::STATUS_ACTIVE)->pluck('id')->toArray();
|
|
|
|
$data['urls_cats'] = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT_CATE)->whereIn('source_id', $product_cate_ids)->get()->toArray();
|
|
|
|
ProjectServer::useProject($project_id);
|
|
|
|
$product_cate_ids = DB::connection('custom_mysql')->table('gl_product_category')
|
|
|
|
->where('project_id', $project_id)->where('status', 1)->pluck('id')->toArray();
|
|
|
|
$data['urls_cats'] = DB::connection('custom_mysql')->table('gl_route_map')
|
|
|
|
->where('project_id', $project_id)->where('source', 'product_category')->whereIn('source_id', $product_cate_ids)->get()->toArray();
|
|
|
|
//单页面
|
|
|
|
//todo 发布状态的单页面id
|
|
|
|
$data['urls_page'] = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PAGE)->get()->toArray();
|
|
|
|
$data['urls_page'] = DB::connection('custom_mysql')->table('gl_route_map')
|
|
|
|
->where('project_id', $project_id)->where('source', 'page')->get()->toArray();
|
|
|
|
//产品详情页
|
|
|
|
$product_ids = Product::where('project_id', $project_id)->where('status', Product::STATUS_ON)->pluck('id')->toArray();
|
|
|
|
$data['urls_details'] = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT)->whereIn('source_id', $product_ids)->get()->toArray();
|
|
|
|
$product_ids = DB::connection('custom_mysql')->table('gl_product_category')
|
|
|
|
->where('project_id', $project_id)->where('status', 1)->pluck('id')->toArray();
|
|
|
|
$data['urls_details'] = DB::connection('custom_mysql')->table('gl_route_map')
|
|
|
|
->where('project_id', $project_id)->where('source', 'product')->whereIn('source_id', $product_ids)->get()->toArray();
|
|
|
|
|
|
|
|
$data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']);
|
|
|
|
if(empty($data['urls_cats'])){
|
|
|
|
$data['urls_cats'] = $data['urls_details'];
|
|
|
|
}
|
|
|
|
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|