正在显示
1 个修改的文件
包含
13 行增加
和
6 行删除
| @@ -6,6 +6,7 @@ use App\Helper\Arr; | @@ -6,6 +6,7 @@ use App\Helper\Arr; | ||
| 6 | use App\Models\Product\Category; | 6 | use App\Models\Product\Category; |
| 7 | use App\Models\Product\Product; | 7 | use App\Models\Product\Product; |
| 8 | use App\Models\RouteMap\RouteMap; | 8 | use App\Models\RouteMap\RouteMap; |
| 9 | +use App\Services\ProjectServer; | ||
| 9 | use GuzzleHttp\Client; | 10 | use GuzzleHttp\Client; |
| 10 | use GuzzleHttp\Promise\Utils; | 11 | use GuzzleHttp\Promise\Utils; |
| 11 | use Illuminate\Console\Command; | 12 | use Illuminate\Console\Command; |
| @@ -230,20 +231,26 @@ class WebTraffic extends Command | @@ -230,20 +231,26 @@ class WebTraffic extends Command | ||
| 230 | */ | 231 | */ |
| 231 | protected function getProductUrls($project_id){ | 232 | protected function getProductUrls($project_id){ |
| 232 | //产品分类页面 | 233 | //产品分类页面 |
| 233 | - $product_cate_ids = Category::where('project_id', $project_id)->where('status', Category::STATUS_ACTIVE)->pluck('id')->toArray(); | ||
| 234 | - $data['urls_cats'] = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT_CATE)->whereIn('source_id', $product_cate_ids)->get()->toArray(); | 234 | + ProjectServer::useProject($project_id); |
| 235 | + $product_cate_ids = DB::connection('custom_mysql')->table('gl_product_category') | ||
| 236 | + ->where('project_id', $project_id)->where('status', 1)->pluck('id')->toArray(); | ||
| 237 | + $data['urls_cats'] = DB::connection('custom_mysql')->table('gl_route_map') | ||
| 238 | + ->where('project_id', $project_id)->where('source', 'product_category')->whereIn('source_id', $product_cate_ids)->get()->toArray(); | ||
| 235 | //单页面 | 239 | //单页面 |
| 236 | //todo 发布状态的单页面id | 240 | //todo 发布状态的单页面id |
| 237 | - $data['urls_page'] = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PAGE)->get()->toArray(); | 241 | + $data['urls_page'] = DB::connection('custom_mysql')->table('gl_route_map') |
| 242 | + ->where('project_id', $project_id)->where('source', 'page')->get()->toArray(); | ||
| 238 | //产品详情页 | 243 | //产品详情页 |
| 239 | - $product_ids = Product::where('project_id', $project_id)->where('status', Product::STATUS_ON)->pluck('id')->toArray(); | ||
| 240 | - $data['urls_details'] = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT)->whereIn('source_id', $product_ids)->get()->toArray(); | 244 | + $product_ids = DB::connection('custom_mysql')->table('gl_product_category') |
| 245 | + ->where('project_id', $project_id)->where('status', 1)->pluck('id')->toArray(); | ||
| 246 | + $data['urls_details'] = DB::connection('custom_mysql')->table('gl_route_map') | ||
| 247 | + ->where('project_id', $project_id)->where('source', 'product')->whereIn('source_id', $product_ids)->get()->toArray(); | ||
| 241 | 248 | ||
| 242 | $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']); | 249 | $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']); |
| 243 | if(empty($data['urls_cats'])){ | 250 | if(empty($data['urls_cats'])){ |
| 244 | $data['urls_cats'] = $data['urls_details']; | 251 | $data['urls_cats'] = $data['urls_details']; |
| 245 | } | 252 | } |
| 246 | - | 253 | + DB::disconnect('custom_mysql'); |
| 247 | return $data; | 254 | return $data; |
| 248 | } | 255 | } |
| 249 | 256 |
-
请 注册 或 登录 后发表评论