Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
6 个修改的文件
包含
93 行增加
和
7 行删除
| @@ -106,11 +106,11 @@ class HtmlCustomCollect extends Command | @@ -106,11 +106,11 @@ class HtmlCustomCollect extends Command | ||
| 106 | // 'https://www.citymax-group.com/case/field-experiment-crop-lettuce/', | 106 | // 'https://www.citymax-group.com/case/field-experiment-crop-lettuce/', |
| 107 | // ]; | 107 | // ]; |
| 108 | 108 | ||
| 109 | - $project_id = 626; | ||
| 110 | - $project_site = 'v6-m342g.globalso.site'; | ||
| 111 | - $pages = [ | ||
| 112 | - 'https://a574.goodao.net/project_catalog/project/', | ||
| 113 | - 'https://a574.goodao.net/project_catalog/project/page/2/', | 109 | +// $project_id = 626; |
| 110 | +// $project_site = 'v6-m342g.globalso.site'; | ||
| 111 | +// $pages = [ | ||
| 112 | +// 'https://a574.goodao.net/project_catalog/project/', | ||
| 113 | +// 'https://a574.goodao.net/project_catalog/project/page/2/', | ||
| 114 | // 'https://www.lecusostreetlight.com/project/560pcs-250w-smart-led-street-light-in-manila-city-philippines/', | 114 | // 'https://www.lecusostreetlight.com/project/560pcs-250w-smart-led-street-light-in-manila-city-philippines/', |
| 115 | // 'https://www.lecusostreetlight.com/project/3200pcs-8m-150w-solar-street-light-in-cebu-philippines/', | 115 | // 'https://www.lecusostreetlight.com/project/3200pcs-8m-150w-solar-street-light-in-cebu-philippines/', |
| 116 | // 'https://lecusostreetlight.com/project/170pcs-100w-split-lithium-battery-solar-street-light-in-tanzania/', | 116 | // 'https://lecusostreetlight.com/project/170pcs-100w-split-lithium-battery-solar-street-light-in-tanzania/', |
| @@ -134,7 +134,7 @@ class HtmlCustomCollect extends Command | @@ -134,7 +134,7 @@ class HtmlCustomCollect extends Command | ||
| 134 | // 'https://www.lecusostreetlight.com/project/198pcs-8m-80w-zc-series-all-in-two-solar-light-in-philippines/', | 134 | // 'https://www.lecusostreetlight.com/project/198pcs-8m-80w-zc-series-all-in-two-solar-light-in-philippines/', |
| 135 | // 'https://www.lecusostreetlight.com/project/5m-30w-morden-led-garden-light-in-russian/', | 135 | // 'https://www.lecusostreetlight.com/project/5m-30w-morden-led-garden-light-in-russian/', |
| 136 | // 'https://www.lecusostreetlight.com/project/135pcs-all-in-one-solar-street-light-in-uae-dubai-park/' | 136 | // 'https://www.lecusostreetlight.com/project/135pcs-all-in-one-solar-street-light-in-uae-dubai-park/' |
| 137 | - ]; | 137 | +// ]; |
| 138 | 138 | ||
| 139 | // $project_id = 633; | 139 | // $project_id = 633; |
| 140 | // $project_site = 'v6-ke5nz.globalso.site'; | 140 | // $project_site = 'v6-ke5nz.globalso.site'; |
| @@ -175,6 +175,19 @@ class HtmlCustomCollect extends Command | @@ -175,6 +175,19 @@ class HtmlCustomCollect extends Command | ||
| 175 | // 'https://www.mach-sales.com/case/cooperation-win-win-and-starting-anew-sumec-creates-a-new-sample-of-strong-enterprise-cooperation/' | 175 | // 'https://www.mach-sales.com/case/cooperation-win-win-and-starting-anew-sumec-creates-a-new-sample-of-strong-enterprise-cooperation/' |
| 176 | // ]; | 176 | // ]; |
| 177 | 177 | ||
| 178 | + $project_id = 549; | ||
| 179 | + $project_site = 'v6-myz64.globalso.site'; | ||
| 180 | + $pages = [ | ||
| 181 | + 'https://sryled.goodao.net/event-staging/page/2/', | ||
| 182 | + 'https://sryled.goodao.net/event-staging/page/3/', | ||
| 183 | + 'https://sryled.goodao.net/event-staging/page/4/', | ||
| 184 | + 'https://sryled.goodao.net/advertising-3/page/2/', | ||
| 185 | + 'https://sryled.goodao.net/advertising-3/page/3/', | ||
| 186 | + 'https://sryled.goodao.net/advertising-3/page/4/', | ||
| 187 | + 'https://sryled.goodao.net/indoor/page/2/', | ||
| 188 | + 'https://sryled.goodao.net/indoor/page/3/', | ||
| 189 | + ]; | ||
| 190 | + | ||
| 178 | foreach ($pages as $page) { | 191 | foreach ($pages as $page) { |
| 179 | $this->start_collect(urldecode($page), $project_id, $project_site); | 192 | $this->start_collect(urldecode($page), $project_id, $project_site); |
| 180 | } | 193 | } |
| @@ -314,6 +327,14 @@ class HtmlCustomCollect extends Command | @@ -314,6 +327,14 @@ class HtmlCustomCollect extends Command | ||
| 314 | $source[] = $check_vv2; | 327 | $source[] = $check_vv2; |
| 315 | } | 328 | } |
| 316 | } | 329 | } |
| 330 | + preg_match_all('/<iframe\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_video_3); | ||
| 331 | + $video_3 = $result_video_3[2] ?? []; | ||
| 332 | + foreach ($video_3 as $vv3) { | ||
| 333 | + $check_vv3 = $this->url_check($vv3, $project_id, $domain, $web_url_domain, $home_url); | ||
| 334 | + if ($check_vv3 && (!in_array($check_vv3, $source))) { | ||
| 335 | + $source[] = $check_vv3; | ||
| 336 | + } | ||
| 337 | + } | ||
| 317 | 338 | ||
| 318 | //css | 339 | //css |
| 319 | preg_match_all('/<link\s+[^>]*?href\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_css); | 340 | preg_match_all('/<link\s+[^>]*?href\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_css); |
| @@ -401,7 +422,12 @@ class HtmlCustomCollect extends Command | @@ -401,7 +422,12 @@ class HtmlCustomCollect extends Command | ||
| 401 | foreach ($source as $vs) { | 422 | foreach ($source as $vs) { |
| 402 | 423 | ||
| 403 | if ($vs['download']) { | 424 | if ($vs['download']) { |
| 425 | + if (in_array(substr($vs['url_complete'], -3), ['pdf', 'zip', 'rar', '.gz'])) { | ||
| 426 | + //可下载类资源要保持原名称 | ||
| 427 | + $new_source = CosService::uploadRemote($project_id, 'source', $vs['url_complete'], '', '', 1); | ||
| 428 | + } else { | ||
| 404 | $new_source = CosService::uploadRemote($project_id, 'source', $vs['url_complete']); | 429 | $new_source = CosService::uploadRemote($project_id, 'source', $vs['url_complete']); |
| 430 | + } | ||
| 405 | if ($new_source) { | 431 | if ($new_source) { |
| 406 | CollectSource::insert([ | 432 | CollectSource::insert([ |
| 407 | 'project_id' => $project_id, | 433 | 'project_id' => $project_id, |
| @@ -257,4 +257,23 @@ class KeywordController extends BaseController | @@ -257,4 +257,23 @@ class KeywordController extends BaseController | ||
| 257 | $id = $keywordPageModel->addReturnId($this->param); | 257 | $id = $keywordPageModel->addReturnId($this->param); |
| 258 | $this->response('success',Code::SUCCESS,['id'=>$id]); | 258 | $this->response('success',Code::SUCCESS,['id'=>$id]); |
| 259 | } | 259 | } |
| 260 | + | ||
| 261 | + /** | ||
| 262 | + * @remark :删除关联关系 | ||
| 263 | + * @name :delRelated | ||
| 264 | + * @author :lyh | ||
| 265 | + * @method :post | ||
| 266 | + * @time :2024/11/28 10:30 | ||
| 267 | + */ | ||
| 268 | + public function delRelated(KeywordLogic $logic){ | ||
| 269 | + $this->request->validate([ | ||
| 270 | + 'keyword_id'=>'required', | ||
| 271 | + 'product_id'=>'required', | ||
| 272 | + ],[ | ||
| 273 | + 'keyword_id.required' => '关键词id不能为空', | ||
| 274 | + 'product_id.required' => '产品id不为空', | ||
| 275 | + ]); | ||
| 276 | + $logic->delRelated($this->param['keyword'],$this->param['product_id']); | ||
| 277 | + $this->response('success'); | ||
| 278 | + } | ||
| 260 | } | 279 | } |
| @@ -42,6 +42,7 @@ class KeywordLogic extends BaseLogic | @@ -42,6 +42,7 @@ class KeywordLogic extends BaseLogic | ||
| 42 | if($info !== false){ | 42 | if($info !== false){ |
| 43 | $info['url'] = $this->user['domain'] . $info['route']; | 43 | $info['url'] = $this->user['domain'] . $info['route']; |
| 44 | $info['related_news_info'] = News::whereIn('id', $info['related_news_ids'])->select(['id', 'name'])->get(); | 44 | $info['related_news_info'] = News::whereIn('id', $info['related_news_ids'])->select(['id', 'name'])->get(); |
| 45 | + $info['product_list'] = $this->getProduct($info['id']); | ||
| 45 | } | 46 | } |
| 46 | return $this->success($info); | 47 | return $this->success($info); |
| 47 | } | 48 | } |
| @@ -298,4 +299,41 @@ class KeywordLogic extends BaseLogic | @@ -298,4 +299,41 @@ class KeywordLogic extends BaseLogic | ||
| 298 | } | 299 | } |
| 299 | return $this->success(); | 300 | return $this->success(); |
| 300 | } | 301 | } |
| 302 | + | ||
| 303 | + /** | ||
| 304 | + * @remark :根据关键字获取产品 | ||
| 305 | + * @name :getProduct | ||
| 306 | + * @author :lyh | ||
| 307 | + * @method :post | ||
| 308 | + * @time :2024/11/28 9:26 | ||
| 309 | + */ | ||
| 310 | + public function getProduct($keyword_id){ | ||
| 311 | + $productList = []; | ||
| 312 | + $keywordRelatedModel = new KeywordRelated(); | ||
| 313 | + $productIdArr = $keywordRelatedModel->selectField(['keyword_id'=>$keyword_id],'product_id'); | ||
| 314 | + if(!empty($productIdArr)){ | ||
| 315 | + $productModel = new Product(); | ||
| 316 | + $productList = $productModel->list(['id'=>['in',$productIdArr]],['id','title']); | ||
| 317 | + } | ||
| 318 | + return $this->success($productList); | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + /** | ||
| 322 | + * @remark :对应删除关联关系 | ||
| 323 | + * @name :delRelated | ||
| 324 | + * @author :lyh | ||
| 325 | + * @method :post | ||
| 326 | + * @time :2024/11/28 9:46 | ||
| 327 | + */ | ||
| 328 | + public function delRelated($keyword_id,$product_id){ | ||
| 329 | + $productModel = new Product(); | ||
| 330 | + $productModel->where('id', $product_id) | ||
| 331 | + ->update(['keyword_id' => DB::raw("REPLACE(keyword_id, ',$keyword_id,' , ',')"),'keyword_video_id' => DB::raw("REPLACE(keyword_video_id, ',$keyword_id,' , ',')")]); | ||
| 332 | + $productModel->where('id', $product_id)->where('keyword_id',',')->orWhere('keyword_video_id',',') | ||
| 333 | + ->update(['keyword_id' => DB::raw("REPLACE(keyword_id, ',' , '')"),'keyword_video_id' => DB::raw("REPLACE(keyword_video_id, ',' , '')")]); | ||
| 334 | + $keywordRelatedModel = new KeywordRelated(); | ||
| 335 | + $keywordRelatedModel->del(['product_id'=>$product_id,'keyword_id'=>$keyword_id]); | ||
| 336 | + return $this->success(); | ||
| 337 | + } | ||
| 338 | + | ||
| 301 | } | 339 | } |
| @@ -43,6 +43,7 @@ class ProductLogic extends BaseLogic | @@ -43,6 +43,7 @@ class ProductLogic extends BaseLogic | ||
| 43 | $extend = $this->handleExtent(); | 43 | $extend = $this->handleExtent(); |
| 44 | //单独处理分类 | 44 | //单独处理分类 |
| 45 | $category_ids = $this->handleCategory(); | 45 | $category_ids = $this->handleCategory(); |
| 46 | + $keyword_arr = $this->param['keyword_id'] ?? []; | ||
| 46 | //处理其他字段 | 47 | //处理其他字段 |
| 47 | $this->param = $this->handleSaveParam($this->param); | 48 | $this->param = $this->handleSaveParam($this->param); |
| 48 | try { | 49 | try { |
| @@ -66,7 +67,7 @@ class ProductLogic extends BaseLogic | @@ -66,7 +67,7 @@ class ProductLogic extends BaseLogic | ||
| 66 | } | 67 | } |
| 67 | //产品分类关联 | 68 | //产品分类关联 |
| 68 | CategoryRelated::saveRelated($id, $category_ids); | 69 | CategoryRelated::saveRelated($id, $category_ids); |
| 69 | - KeywordRelated::saveRelated($id,$category_ids); | 70 | + KeywordRelated::saveRelated($id,$keyword_arr); |
| 70 | //更新产品新描述 | 71 | //更新产品新描述 |
| 71 | $detailLogic = new DetailLogic(); | 72 | $detailLogic = new DetailLogic(); |
| 72 | $detailLogic->saveDetail($id,$this->param['data'] ?? []); | 73 | $detailLogic->saveDetail($id,$this->param['data'] ?? []); |
| @@ -296,4 +296,5 @@ class Base extends Model | @@ -296,4 +296,5 @@ class Base extends Model | ||
| 296 | $data = $this->filterRequestData($data); | 296 | $data = $this->filterRequestData($data); |
| 297 | return $this->formatQuery($data)->pluck($filed)->toArray(); | 297 | return $this->formatQuery($data)->pluck($filed)->toArray(); |
| 298 | } | 298 | } |
| 299 | + | ||
| 299 | } | 300 | } |
| @@ -281,6 +281,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -281,6 +281,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 281 | Route::post('keyword/batchAdd', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchAdd'])->name('product_keyword_batchAdd'); | 281 | Route::post('keyword/batchAdd', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchAdd'])->name('product_keyword_batchAdd'); |
| 282 | Route::post('keyword/batchDel', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchDel'])->name('product_keyword_batchDel'); | 282 | Route::post('keyword/batchDel', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchDel'])->name('product_keyword_batchDel'); |
| 283 | Route::any('keyword/delete', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delete'])->name('product_keyword_delete'); | 283 | Route::any('keyword/delete', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delete'])->name('product_keyword_delete'); |
| 284 | + Route::any('keyword/delRelated', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delRelated'])->name('product_keyword_delRelated'); | ||
| 284 | Route::any('keyword/batchUpdateKeyword', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchUpdateKeyword'])->name('product_keyword_batchUpdateKeyword'); | 285 | Route::any('keyword/batchUpdateKeyword', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchUpdateKeyword'])->name('product_keyword_batchUpdateKeyword'); |
| 285 | Route::any('keyword/batchKeywordIsVideo', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordIsVideo'])->name('product_keyword_batchKeywordIsVideo'); | 286 | Route::any('keyword/batchKeywordIsVideo', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordIsVideo'])->name('product_keyword_batchKeywordIsVideo'); |
| 286 | Route::any('keyword/batchKeywordFiled', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordFiled'])->name('product_keyword_batchKeywordFiled'); | 287 | Route::any('keyword/batchKeywordFiled', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordFiled'])->name('product_keyword_batchKeywordFiled'); |
-
请 注册 或 登录 后发表评论