Merge remote-tracking branch 'origin/master' into zhl
正在显示
18 个修改的文件
包含
212 行增加
和
84 行删除
| @@ -297,13 +297,16 @@ class VideoTask extends Command | @@ -297,13 +297,16 @@ class VideoTask extends Command | ||
| 297 | break; | 297 | break; |
| 298 | } | 298 | } |
| 299 | $keyword_ids = implode(',',$item->keyword_id); | 299 | $keyword_ids = implode(',',$item->keyword_id); |
| 300 | + $keyword_video_ids = implode(',',$item->keyword_video_id); | ||
| 300 | if (strpos(','.$keyword_ids.',', ','.$keyword_id.',') === false) { | 301 | if (strpos(','.$keyword_ids.',', ','.$keyword_id.',') === false) { |
| 301 | - //不包含 | ||
| 302 | - $productModel = new Product(); | ||
| 303 | - $keyword_ids = !empty($keyword_ids) ? ','.$keyword_ids.',' : ',' ; | ||
| 304 | - $keyword_id_str = $keyword_ids . $keyword_id.','; | ||
| 305 | - KeywordRelated::saveRelated($item->id,explode(',',trim($keyword_id_str,','))); | ||
| 306 | - $productModel->edit(['keyword_id'=>$keyword_id_str],['id'=>$item->id]); | 302 | + if(strpos(','.$keyword_video_ids.',', ','.$keyword_id.',') === false){ |
| 303 | + //不包含 | ||
| 304 | + $productModel = new Product(); | ||
| 305 | + $keyword_video_ids = !empty($keyword_video_ids) ? ','.$keyword_video_ids.',' : ',' ; | ||
| 306 | + $keyword_video_id_str = $keyword_video_ids . $keyword_id.','; | ||
| 307 | + $productModel->edit(['keyword_video_id'=>$keyword_video_id_str],['id'=>$item->id]); | ||
| 308 | + KeywordRelated::saveRelated($item->id,$keyword_video_ids,2); | ||
| 309 | + } | ||
| 307 | } | 310 | } |
| 308 | $data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title]; | 311 | $data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title]; |
| 309 | } | 312 | } |
| @@ -26,6 +26,7 @@ use App\Models\File\Image as ImageModel; | @@ -26,6 +26,7 @@ use App\Models\File\Image as ImageModel; | ||
| 26 | use App\Models\News\News; | 26 | use App\Models\News\News; |
| 27 | use App\Models\News\NewsCategory; | 27 | use App\Models\News\NewsCategory; |
| 28 | use App\Models\Product\Keyword; | 28 | use App\Models\Product\Keyword; |
| 29 | +use App\Models\Product\KeywordRelated; | ||
| 29 | use App\Models\Product\Product; | 30 | use App\Models\Product\Product; |
| 30 | use App\Models\Project\DeployOptimize; | 31 | use App\Models\Project\DeployOptimize; |
| 31 | use App\Models\Project\MinorLanguages; | 32 | use App\Models\Project\MinorLanguages; |
| @@ -61,33 +62,59 @@ class Demo extends Command | @@ -61,33 +62,59 @@ class Demo extends Command | ||
| 61 | protected $description = 'demo'; | 62 | protected $description = 'demo'; |
| 62 | 63 | ||
| 63 | public function handle(){ | 64 | public function handle(){ |
| 64 | -// $projectModel = new Project(); | ||
| 65 | -// $list = $projectModel->list(['id'=>1659]); | ||
| 66 | -// foreach ($list as $v){ | ||
| 67 | -// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | ||
| 68 | -// ProjectServer::useProject($v['id']); | ||
| 69 | -// $this->getProduct(); | ||
| 70 | -// DB::disconnect('custom_mysql'); | ||
| 71 | -// } | ||
| 72 | - return $this->savePurchaserInfo(); | 65 | + $keywordVideoModel = new KeywordVideoTask(); |
| 66 | + $list = $keywordVideoModel->list(); | ||
| 67 | + foreach ($list as $v){ | ||
| 68 | + echo date('Y-m-d H:i:s') . 'project_id:'.$v['project_id'] . PHP_EOL; | ||
| 69 | + ProjectServer::useProject($v['project_id']); | ||
| 70 | + $this->getProduct(); | ||
| 71 | + DB::disconnect('custom_mysql'); | ||
| 72 | + } | ||
| 73 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 73 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | + /** | ||
| 77 | + * @remark :更新产品 | ||
| 78 | + * @name :getProduct | ||
| 79 | + * @author :lyh | ||
| 80 | + * @method :post | ||
| 81 | + * @time :2024/11/27 15:40 | ||
| 82 | + */ | ||
| 76 | public function getProduct(){ | 83 | public function getProduct(){ |
| 77 | $productModel = new Product(); | 84 | $productModel = new Product(); |
| 78 | - $lists = $productModel->list(['status'=>['!=',2]]); | 85 | + $lists = $productModel->list(['status'=>['!=',3]]); |
| 79 | if(!empty($lists)){ | 86 | if(!empty($lists)){ |
| 80 | foreach ($lists as $v){ | 87 | foreach ($lists as $v){ |
| 81 | - if(!empty($v['route'])){ | ||
| 82 | - echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | ||
| 83 | - $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | ||
| 84 | - $productModel->edit(['route'=>$route],['id'=>$v['id']]); | 88 | + if(!empty($v['keyword_video_id'])){ |
| 89 | + foreach ($v['keyword_video_id'] as $val){ | ||
| 90 | + $keywordRelaModel = new KeywordRelated(); | ||
| 91 | + echo date('Y-m-d H:i:s') . 'keyword_id :'.$val . 'product_id :'.$v['id'] . PHP_EOL; | ||
| 92 | + $keywordRelaModel->edit(['type'=>2],['keyword_id'=>$val,'product_id'=>$v['id']]); | ||
| 93 | + } | ||
| 85 | } | 94 | } |
| 86 | } | 95 | } |
| 87 | } | 96 | } |
| 88 | } | 97 | } |
| 89 | 98 | ||
| 90 | /** | 99 | /** |
| 100 | + * @remark :复制表及结构 | ||
| 101 | + * @name :copyProduct | ||
| 102 | + * @author :lyh | ||
| 103 | + * @method :post | ||
| 104 | + * @time :2024/11/27 16:09 | ||
| 105 | + */ | ||
| 106 | + public function copyProduct(){ | ||
| 107 | + $tableName = 'gl_product'; | ||
| 108 | + $copyTableName = 'gl_product_c'; | ||
| 109 | + if (Schema::connection('custom_mysql')->hasTable($copyTableName)) { | ||
| 110 | + DB::connection('custom_mysql')->statement("DROP TABLE {$copyTableName}"); | ||
| 111 | + } | ||
| 112 | + // 创建新表并复制数据 | ||
| 113 | + DB::connection('custom_mysql')->statement("CREATE TABLE {$copyTableName} LIKE {$tableName}"); | ||
| 114 | + DB::connection('custom_mysql')->statement("INSERT INTO {$copyTableName} SELECT * FROM {$tableName}"); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + /** | ||
| 91 | * @remark :保存供应商详情 | 118 | * @remark :保存供应商详情 |
| 92 | * @name :savePurchaserInfo | 119 | * @name :savePurchaserInfo |
| 93 | * @author :lyh | 120 | * @author :lyh |
| @@ -37,7 +37,7 @@ class Temp extends Command | @@ -37,7 +37,7 @@ class Temp extends Command | ||
| 37 | * @author Akun | 37 | * @author Akun |
| 38 | * @date 2024/11/18 15:07 | 38 | * @date 2024/11/18 15:07 |
| 39 | */ | 39 | */ |
| 40 | - public function handle() | 40 | + public function handle5() |
| 41 | { | 41 | { |
| 42 | $projects = Project::select(['id'])->orderBy('id', 'asc')->get(); | 42 | $projects = Project::select(['id'])->orderBy('id', 'asc')->get(); |
| 43 | foreach ($projects as $project) { | 43 | foreach ($projects as $project) { |
| @@ -236,7 +236,7 @@ class Temp extends Command | @@ -236,7 +236,7 @@ class Temp extends Command | ||
| 236 | * @author Akun | 236 | * @author Akun |
| 237 | * @date 2024/09/26 10:48 | 237 | * @date 2024/09/26 10:48 |
| 238 | */ | 238 | */ |
| 239 | - public function handle1() | 239 | + public function handle() |
| 240 | { | 240 | { |
| 241 | $notify_model = new Notify(); | 241 | $notify_model = new Notify(); |
| 242 | $project_model = new Project(); | 242 | $project_model = new Project(); |
| @@ -254,10 +254,12 @@ class Temp extends Command | @@ -254,10 +254,12 @@ class Temp extends Command | ||
| 254 | $project_info = $project_model->read(['id' => $project_id], ['serve_id']); | 254 | $project_info = $project_model->read(['id' => $project_id], ['serve_id']); |
| 255 | if (!$project_info) { | 255 | if (!$project_info) { |
| 256 | $this->output('未查询到项目数据'); | 256 | $this->output('未查询到项目数据'); |
| 257 | + continue; | ||
| 257 | } | 258 | } |
| 258 | $serve_ip_info = $serve_ip_model->read(['id' => $project_info['serve_id']], ['servers_id']); | 259 | $serve_ip_info = $serve_ip_model->read(['id' => $project_info['serve_id']], ['servers_id']); |
| 259 | if (!$serve_ip_info) { | 260 | if (!$serve_ip_info) { |
| 260 | $this->output('未查询到服务器数据'); | 261 | $this->output('未查询到服务器数据'); |
| 262 | + continue; | ||
| 261 | } | 263 | } |
| 262 | $servers_id = $serve_ip_info['servers_id']; | 264 | $servers_id = $serve_ip_info['servers_id']; |
| 263 | 265 | ||
| @@ -290,9 +292,17 @@ class Temp extends Command | @@ -290,9 +292,17 @@ class Temp extends Command | ||
| 290 | } | 292 | } |
| 291 | } else { | 293 | } else { |
| 292 | //其他服务器:请求对应C端接口 | 294 | //其他服务器:请求对应C端接口 |
| 293 | - $c_url = $domain . '/api/update_page/?project_id=' . $project_id . '&type=3'; | ||
| 294 | - $re = http_get($c_url); | ||
| 295 | - $this->output($re['message'] ?? ''); | 295 | + $c_url = $domain . '/api/update_page/'; |
| 296 | + $c_params = [ | ||
| 297 | + 'project_id' => $project_id, | ||
| 298 | + 'type' => 3 | ||
| 299 | + ]; | ||
| 300 | + $re = http_post($c_url, json_encode($c_params), [], true); | ||
| 301 | + if (isset($re['status']) && $re['status'] == 200) { | ||
| 302 | + $this->output($c_url . ' | 请求成功'); | ||
| 303 | + } else { | ||
| 304 | + $this->output($c_url . ' | ' . ($re['message'] ?? '未返回失败原因')); | ||
| 305 | + } | ||
| 296 | } | 306 | } |
| 297 | $this->output('项目id:' . $project_id . ',end'); | 307 | $this->output('项目id:' . $project_id . ',end'); |
| 298 | } | 308 | } |
| @@ -300,6 +310,6 @@ class Temp extends Command | @@ -300,6 +310,6 @@ class Temp extends Command | ||
| 300 | 310 | ||
| 301 | public function output($msg) | 311 | public function output($msg) |
| 302 | { | 312 | { |
| 303 | - echo $msg . PHP_EOL; | 313 | + echo date('Y-m-d H:i:s') . ' | ' . $msg . PHP_EOL; |
| 304 | } | 314 | } |
| 305 | } | 315 | } |
| @@ -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']) { |
| 404 | - $new_source = CosService::uploadRemote($project_id, 'source', $vs['url_complete']); | 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 { | ||
| 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, |
| @@ -12,6 +12,7 @@ namespace App\Console\Commands\Update; | @@ -12,6 +12,7 @@ namespace App\Console\Commands\Update; | ||
| 12 | use App\Models\Domain\DomainInfo; | 12 | use App\Models\Domain\DomainInfo; |
| 13 | use App\Models\Product\Keyword; | 13 | use App\Models\Product\Keyword; |
| 14 | use App\Models\Product\KeywordPage; | 14 | use App\Models\Product\KeywordPage; |
| 15 | +use App\Models\Product\Product; | ||
| 15 | use App\Services\ProjectServer; | 16 | use App\Services\ProjectServer; |
| 16 | use Illuminate\Console\Command; | 17 | use Illuminate\Console\Command; |
| 17 | use Illuminate\Support\Facades\DB; | 18 | use Illuminate\Support\Facades\DB; |
| @@ -106,4 +107,19 @@ class UpdateKeyword extends Command | @@ -106,4 +107,19 @@ class UpdateKeyword extends Command | ||
| 106 | shell_exec('curl -k "'.$url.'"'); | 107 | shell_exec('curl -k "'.$url.'"'); |
| 107 | return true; | 108 | return true; |
| 108 | } | 109 | } |
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * @remark :更新产品关键词 | ||
| 113 | + * @name :updatedProductKeyword | ||
| 114 | + * @author :lyh | ||
| 115 | + * @method :post | ||
| 116 | + * @time :2024/11/27 14:26 | ||
| 117 | + */ | ||
| 118 | + public function updatedProductKeyword(){ | ||
| 119 | + $productModel = new Product(); | ||
| 120 | + $lists = $productModel->list(); | ||
| 121 | + foreach ($lists as $k => $v){ | ||
| 122 | + | ||
| 123 | + } | ||
| 124 | + } | ||
| 109 | } | 125 | } |
| @@ -230,7 +230,7 @@ class AdsController extends BaseController | @@ -230,7 +230,7 @@ class AdsController extends BaseController | ||
| 230 | public function fbInquiryChart(Request $request) | 230 | public function fbInquiryChart(Request $request) |
| 231 | { | 231 | { |
| 232 | $start_date = $request->input('start_date', date('Y-m-d', strtotime('-1 month'))); | 232 | $start_date = $request->input('start_date', date('Y-m-d', strtotime('-1 month'))); |
| 233 | - $end_date = $request->input('end', date('Y-m-d')); | 233 | + $end_date = $request->input('end_date', date('Y-m-d')); |
| 234 | $result = ReInquiryForm::select(DB::raw('DATE(inquiry_date) as date'), DB::raw('COUNT(*) as count')) | 234 | $result = ReInquiryForm::select(DB::raw('DATE(inquiry_date) as date'), DB::raw('COUNT(*) as count')) |
| 235 | ->whereBetween('inquiry_date', [$start_date, date('Y-m-d', strtotime($end_date . ' +1 day'))]) | 235 | ->whereBetween('inquiry_date', [$start_date, date('Y-m-d', strtotime($end_date . ' +1 day'))]) |
| 236 | ->groupBy(DB::raw('DATE(inquiry_date)')) | 236 | ->groupBy(DB::raw('DATE(inquiry_date)')) |
| @@ -25,6 +25,9 @@ class OperationHeartbeatController extends BaseController | @@ -25,6 +25,9 @@ class OperationHeartbeatController extends BaseController | ||
| 25 | * @time :2024/8/28 14:03 | 25 | * @time :2024/8/28 14:03 |
| 26 | */ | 26 | */ |
| 27 | public function saveHeartbeat(){ | 27 | public function saveHeartbeat(){ |
| 28 | + if($this->user['project_id'] == 1){ | ||
| 29 | + $this->response('success'); | ||
| 30 | + } | ||
| 28 | $this->request->validate([ | 31 | $this->request->validate([ |
| 29 | 'source'=>'required', | 32 | 'source'=>'required', |
| 30 | 'source_id'=>'required', | 33 | 'source_id'=>'required', |
| @@ -64,6 +67,10 @@ class OperationHeartbeatController extends BaseController | @@ -64,6 +67,10 @@ class OperationHeartbeatController extends BaseController | ||
| 64 | * @time :2024/8/28 14:29 | 67 | * @time :2024/8/28 14:29 |
| 65 | */ | 68 | */ |
| 66 | public function getInfo(){ | 69 | public function getInfo(){ |
| 70 | + if($this->user['project_id'] == 1){ | ||
| 71 | + $info['status'] = 0; | ||
| 72 | + $this->response('success',Code::SUCCESS,$info); | ||
| 73 | + } | ||
| 67 | $this->request->validate([ | 74 | $this->request->validate([ |
| 68 | 'source'=>'required', | 75 | 'source'=>'required', |
| 69 | 'source_id'=>'required', | 76 | 'source_id'=>'required', |
| @@ -31,7 +31,7 @@ class KeywordController extends BaseController | @@ -31,7 +31,7 @@ class KeywordController extends BaseController | ||
| 31 | public function index(Keyword $keyword) | 31 | public function index(Keyword $keyword) |
| 32 | { | 32 | { |
| 33 | $this->map = $this->searchParam($this->map); | 33 | $this->map = $this->searchParam($this->map); |
| 34 | - $filed = ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at','route','keyword_title']; | 34 | + $filed = ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at','route','keyword_title','is_video_keyword']; |
| 35 | $data = $keyword->lists($this->map,$this->page,$this->row,$this->order,$filed); | 35 | $data = $keyword->lists($this->map,$this->page,$this->row,$this->order,$filed); |
| 36 | if(!empty($data)){ | 36 | if(!empty($data)){ |
| 37 | foreach ($data['list'] as &$v){ | 37 | foreach ($data['list'] as &$v){ |
| @@ -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_id'],$this->param['product_id']); | ||
| 277 | + $this->response('success'); | ||
| 278 | + } | ||
| 260 | } | 279 | } |
| @@ -391,17 +391,6 @@ class TranslateController extends BaseController | @@ -391,17 +391,6 @@ class TranslateController extends BaseController | ||
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | /** | 393 | /** |
| 394 | - * @remark :获取默认数据 | ||
| 395 | - * @name :getDefaultData | ||
| 396 | - * @author :lyh | ||
| 397 | - * @method :post | ||
| 398 | - * @time :2024/7/16 15:28 | ||
| 399 | - */ | ||
| 400 | - public function getDefaultData(){ | ||
| 401 | - | ||
| 402 | - } | ||
| 403 | - | ||
| 404 | - /** | ||
| 405 | * @remark : | 394 | * @remark : |
| 406 | * @name :pageList | 395 | * @name :pageList |
| 407 | * @author :lyh | 396 | * @author :lyh |
| @@ -69,13 +69,11 @@ class EmailController extends BaseController | @@ -69,13 +69,11 @@ class EmailController extends BaseController | ||
| 69 | public function set_smtp(Smtp $smtp) | 69 | public function set_smtp(Smtp $smtp) |
| 70 | { | 70 | { |
| 71 | $this->request->validate([ | 71 | $this->request->validate([ |
| 72 | - 'project_id' => ['required'], | ||
| 73 | 'email' => ['required', 'email', 'max:200'], | 72 | 'email' => ['required', 'email', 'max:200'], |
| 74 | 'password' => ['required', 'max:200'], | 73 | 'password' => ['required', 'max:200'], |
| 75 | 'host' => ['required', 'max:200', 'regex:/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/'], | 74 | 'host' => ['required', 'max:200', 'regex:/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/'], |
| 76 | 'from_name' => ['required', 'max:200'], | 75 | 'from_name' => ['required', 'max:200'], |
| 77 | ], [ | 76 | ], [ |
| 78 | - 'project_id.required' => '参数异常', | ||
| 79 | 'email.required' => '邮箱必须', | 77 | 'email.required' => '邮箱必须', |
| 80 | 'email.email' => '邮箱格式错误', | 78 | 'email.email' => '邮箱格式错误', |
| 81 | 'password.required' => '授权码/密码必须', | 79 | 'password.required' => '授权码/密码必须', |
| @@ -83,15 +81,21 @@ class EmailController extends BaseController | @@ -83,15 +81,21 @@ class EmailController extends BaseController | ||
| 83 | 'host.regex' => 'smtp格式错误', | 81 | 'host.regex' => 'smtp格式错误', |
| 84 | 'from_name.required' => '发信人昵称必须', | 82 | 'from_name.required' => '发信人昵称必须', |
| 85 | ]); | 83 | ]); |
| 86 | - $info = $smtp->read(['project_id' => $this->param['project_id']]); | 84 | + $this->param['project_id'] = $this->project['id']; |
| 85 | + $info = $smtp->read(['project_id' => $this->project['id']]); | ||
| 87 | if (!$info) { | 86 | if (!$info) { |
| 88 | $smtp->add($this->param); | 87 | $smtp->add($this->param); |
| 89 | } else { | 88 | } else { |
| 90 | - $smtp->edit($this->param, ['project_id' => $this->param['project_id']]); | 89 | + $smtp->edit($this->param, ['project_id' => $this->project['id']]); |
| 91 | } | 90 | } |
| 92 | $this->response('success'); | 91 | $this->response('success'); |
| 93 | } | 92 | } |
| 94 | 93 | ||
| 94 | + public function get_smtp(Smtp $smtp){ | ||
| 95 | + $info = $smtp->read(['project_id' => $this->project['id']]); | ||
| 96 | + $this->response($info??[]); | ||
| 97 | + } | ||
| 98 | + | ||
| 95 | public function group_send(GroupSendTask $groupSendTask) | 99 | public function group_send(GroupSendTask $groupSendTask) |
| 96 | { | 100 | { |
| 97 | $this->request->validate([ | 101 | $this->request->validate([ |
| @@ -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'] ?? []); |
| @@ -53,33 +53,6 @@ class QueryListener | @@ -53,33 +53,6 @@ class QueryListener | ||
| 53 | $log = $log.' [ RunTime:'.$event->time.'ms ] '; | 53 | $log = $log.' [ RunTime:'.$event->time.'ms ] '; |
| 54 | Log::debug($log); | 54 | Log::debug($log); |
| 55 | } | 55 | } |
| 56 | - //监听api_no是TM咋个被改的 | ||
| 57 | - if (Str::contains($event->sql, 'update') && Str::contains($event->sql, '`api_no` =')) { | ||
| 58 | - //记录debug 根据这个溯源 | ||
| 59 | - $trace = debug_backtrace(); | ||
| 60 | - $traces = []; | ||
| 61 | - foreach ($trace as $index => $caller) { | ||
| 62 | - if ($index === 0) { | ||
| 63 | - continue; // 跳过当前方法的调用信息 | ||
| 64 | - } | ||
| 65 | - $file = $caller['file']; | ||
| 66 | - $line = $caller['line']; | ||
| 67 | - $class = $caller['class']; | ||
| 68 | - $method = $caller['function']; | ||
| 69 | - $traces[] = "Method $method called from $class in file $file at line $line\n"; | ||
| 70 | - } | ||
| 71 | - //用户信息 哪个改的 还是脚本跑的 | ||
| 72 | - $token = request()->header('token'); | ||
| 73 | - Log::channel('test')->info('api_no updated', [ | ||
| 74 | - 'sql' => $event->sql, | ||
| 75 | - 'bindings' => $event->bindings, | ||
| 76 | - 'route' => Route::current(), | ||
| 77 | - 'request' => request()->all(), | ||
| 78 | - 'a_info' => Cache::get(Common::MANAGE_TOKEN . $token), | ||
| 79 | - 'b_info' => Cache::get($token), | ||
| 80 | - 'trace' => $traces | ||
| 81 | - ]); | ||
| 82 | - } | ||
| 83 | }catch (\Exception $exception){ | 56 | }catch (\Exception $exception){ |
| 84 | Log::error('log sql error:'.$exception->getMessage()); | 57 | Log::error('log sql error:'.$exception->getMessage()); |
| 85 | } | 58 | } |
| @@ -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 | } |
| @@ -24,19 +24,20 @@ class KeywordRelated extends Base | @@ -24,19 +24,20 @@ class KeywordRelated extends Base | ||
| 24 | * @author zbj | 24 | * @author zbj |
| 25 | * @date 2023/5/4 | 25 | * @date 2023/5/4 |
| 26 | */ | 26 | */ |
| 27 | - public static function saveRelated($product_id, $keyword_ids) | 27 | + public static function saveRelated($product_id, $keyword_ids,$type = 1) |
| 28 | { | 28 | { |
| 29 | if(!is_array($keyword_ids)){ | 29 | if(!is_array($keyword_ids)){ |
| 30 | $keyword_ids = array_filter(Arr::splitFilterToArray($keyword_ids), 'intval'); | 30 | $keyword_ids = array_filter(Arr::splitFilterToArray($keyword_ids), 'intval'); |
| 31 | } | 31 | } |
| 32 | //先删除 | 32 | //先删除 |
| 33 | - self::where('product_id', $product_id)->delete(); | 33 | + self::where('product_id', $product_id)->where('type',$type)->delete(); |
| 34 | 34 | ||
| 35 | //批量保存 | 35 | //批量保存 |
| 36 | $data = []; | 36 | $data = []; |
| 37 | if(!empty($keyword_ids)){ | 37 | if(!empty($keyword_ids)){ |
| 38 | foreach ($keyword_ids as $keyword_id){ | 38 | foreach ($keyword_ids as $keyword_id){ |
| 39 | $data[] = [ | 39 | $data[] = [ |
| 40 | + 'type' => $type, | ||
| 40 | 'product_id' => $product_id, | 41 | 'product_id' => $product_id, |
| 41 | 'keyword_id' => $keyword_id, | 42 | 'keyword_id' => $keyword_id, |
| 42 | 'created_at'=>date('Y-m-d H:i:s'), | 43 | 'created_at'=>date('Y-m-d H:i:s'), |
| @@ -196,7 +196,9 @@ class Product extends Base | @@ -196,7 +196,9 @@ class Product extends Base | ||
| 196 | public function getKeywordIdAttribute($value){ | 196 | public function getKeywordIdAttribute($value){ |
| 197 | return Arr::setToArr(trim($value,',')); | 197 | return Arr::setToArr(trim($value,',')); |
| 198 | } | 198 | } |
| 199 | - | 199 | + public function getKeywordVideoIdAttribute($value){ |
| 200 | + return Arr::setToArr(trim($value,',')); | ||
| 201 | + } | ||
| 200 | public function getRelatedProductIdAttribute($value){ | 202 | public function getRelatedProductIdAttribute($value){ |
| 201 | return Arr::setToArr($value); | 203 | return Arr::setToArr($value); |
| 202 | } | 204 | } |
| @@ -310,13 +310,22 @@ class SyncSubmitTaskService | @@ -310,13 +310,22 @@ class SyncSubmitTaskService | ||
| 310 | //过滤内容 | 310 | //过滤内容 |
| 311 | if(!empty($data['data']['message'])) { | 311 | if(!empty($data['data']['message'])) { |
| 312 | //过滤内容关键字 | 312 | //过滤内容关键字 |
| 313 | - if (!empty($config['filter_contents'])){ | 313 | + if (!empty($config['filter_contents'])) { |
| 314 | foreach ($config['filter_contents'] as $filter_content) { | 314 | foreach ($config['filter_contents'] as $filter_content) { |
| 315 | - if (Str::contains(strtolower($data['data']['message']), strtolower($filter_content))) { | ||
| 316 | - throw new InquiryFilterException('过滤内容:' . $filter_content); | 315 | + //中文直接包含 |
| 316 | + if (preg_match("/^[\x{4e00}-\x{9fa5}]+$/u", $filter_content)) { | ||
| 317 | + if (Str::contains($data['data']['message'], $filter_content)) { | ||
| 318 | + throw new InquiryFilterException('过滤内容:' . $filter_content); | ||
| 319 | + } | ||
| 320 | + } else { | ||
| 321 | + //英文要指定词才过滤 | ||
| 322 | + if (preg_match("/\b" . preg_quote($filter_content, "/") . "\b/i", $data['data']['message'])) { | ||
| 323 | + throw new InquiryFilterException('过滤内容:' . $filter_content); | ||
| 324 | + } | ||
| 317 | } | 325 | } |
| 318 | } | 326 | } |
| 319 | } | 327 | } |
| 328 | + | ||
| 320 | //是否允许包含链接 | 329 | //是否允许包含链接 |
| 321 | if(isset($config['is_allow_link']) && !$config['is_allow_link']){ | 330 | if(isset($config['is_allow_link']) && !$config['is_allow_link']){ |
| 322 | if (Str::contains(strtolower($data['data']['message']), ['http://', 'https://', 'www.'])) { | 331 | if (Str::contains(strtolower($data['data']['message']), ['http://', 'https://', 'www.'])) { |
| @@ -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'); |
| @@ -632,6 +633,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -632,6 +633,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 632 | Route::any('/del', [\App\Http\Controllers\Bside\Subscribe\EmailController::class, 'delete'])->name('subscribe_email_del'); | 633 | Route::any('/del', [\App\Http\Controllers\Bside\Subscribe\EmailController::class, 'delete'])->name('subscribe_email_del'); |
| 633 | Route::any('/export', [\App\Http\Controllers\Bside\Subscribe\EmailController::class, 'export'])->name('subscribe_email_export'); | 634 | Route::any('/export', [\App\Http\Controllers\Bside\Subscribe\EmailController::class, 'export'])->name('subscribe_email_export'); |
| 634 | Route::any('/set_smtp', [\App\Http\Controllers\Bside\Subscribe\EmailController::class, 'set_smtp'])->name('subscribe_email_set_smtp'); | 635 | Route::any('/set_smtp', [\App\Http\Controllers\Bside\Subscribe\EmailController::class, 'set_smtp'])->name('subscribe_email_set_smtp'); |
| 636 | + Route::any('/get_smtp', [\App\Http\Controllers\Bside\Subscribe\EmailController::class, 'get_smtp'])->name('subscribe_email_get_smtp'); | ||
| 635 | Route::any('/group_send', [\App\Http\Controllers\Bside\Subscribe\EmailController::class, 'group_send'])->name('subscribe_email_group_send'); | 637 | Route::any('/group_send', [\App\Http\Controllers\Bside\Subscribe\EmailController::class, 'group_send'])->name('subscribe_email_group_send'); |
| 636 | }); | 638 | }); |
| 637 | 639 |
-
请 注册 或 登录 后发表评论