Merge remote-tracking branch 'origin/master' into akun
正在显示
18 个修改的文件
包含
185 行增加
和
24 行删除
| @@ -9,7 +9,9 @@ | @@ -9,7 +9,9 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Console\Commands\LyhTest; | 10 | namespace App\Console\Commands\LyhTest; |
| 11 | 11 | ||
| 12 | +use App\Models\Com\NoticeLog; | ||
| 12 | use App\Models\Project\AiBlogTask; | 13 | use App\Models\Project\AiBlogTask; |
| 14 | +use App\Models\Project\Project; | ||
| 13 | use Illuminate\Console\Command; | 15 | use Illuminate\Console\Command; |
| 14 | use Illuminate\Support\Facades\Artisan; | 16 | use Illuminate\Support\Facades\Artisan; |
| 15 | use Illuminate\Support\Facades\DB; | 17 | use Illuminate\Support\Facades\DB; |
| @@ -31,11 +33,9 @@ class lyhDemo extends Command | @@ -31,11 +33,9 @@ class lyhDemo extends Command | ||
| 31 | protected $description = '更新路由'; | 33 | protected $description = '更新路由'; |
| 32 | 34 | ||
| 33 | public function handle(){ | 35 | public function handle(){ |
| 34 | - $client = new \GuzzleHttp\Client(); | ||
| 35 | - $data = $client->request('GET', 'https://quanqiusou.cn/extend_api/v6/update.php?postid='.'13810', [ | ||
| 36 | - 'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号 | ||
| 37 | - ])->getBody()->getContents(); | ||
| 38 | - $data = json_decode($data, true); | ||
| 39 | - dd($data); | 36 | + $projectModel = new Project(); |
| 37 | + $noticeModel = new NoticeLog(); | ||
| 38 | + $lists = $projectModel->list(['from_order_id'=>null]); | ||
| 39 | + return true; | ||
| 40 | } | 40 | } |
| 41 | } | 41 | } |
| @@ -269,6 +269,16 @@ class SyncProject extends Command | @@ -269,6 +269,16 @@ class SyncProject extends Command | ||
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | /** | 271 | /** |
| 272 | + * @remark :生成唯一的13位数字 | ||
| 273 | + * @name :stringTo13DigitNumber | ||
| 274 | + * @author :lyh | ||
| 275 | + * @method :post | ||
| 276 | + * @time :2025/3/27 15:09 | ||
| 277 | + */ | ||
| 278 | + public function generateUniqueString($input) { | ||
| 279 | + return substr(md5($input), 0, 13); | ||
| 280 | + } | ||
| 281 | + /** | ||
| 272 | * @remark :设置post_id | 282 | * @remark :设置post_id |
| 273 | * @name :setPostId | 283 | * @name :setPostId |
| 274 | * @author :lyh | 284 | * @author :lyh |
| @@ -299,6 +309,9 @@ class SyncProject extends Command | @@ -299,6 +309,9 @@ class SyncProject extends Command | ||
| 299 | $param['channel'] = Arr::a2s(["user_id"=>"", "zone_id"=>"", "channel_id"=>""]); | 309 | $param['channel'] = Arr::a2s(["user_id"=>"", "zone_id"=>"", "channel_id"=>""]); |
| 300 | } | 310 | } |
| 301 | $projectModel = new Project(); | 311 | $projectModel = new Project(); |
| 312 | + if(empty($param['from_order_id'])){ | ||
| 313 | + $param['from_order_id'] = $this->generateUniqueString($param['notice_order_id']); | ||
| 314 | + } | ||
| 302 | $info = $projectModel->read(['from_order_id'=>$param['from_order_id'],'delete_status'=>0]); | 315 | $info = $projectModel->read(['from_order_id'=>$param['from_order_id'],'delete_status'=>0]); |
| 303 | if($info !== false){ | 316 | if($info !== false){ |
| 304 | unset($param['type']); //更新的 不更新状态了 | 317 | unset($param['type']); //更新的 不更新状态了 |
| @@ -67,7 +67,7 @@ class SyncSubmitTask extends Command | @@ -67,7 +67,7 @@ class SyncSubmitTask extends Command | ||
| 67 | $task_info->remark = $e->getMessage(); | 67 | $task_info->remark = $e->getMessage(); |
| 68 | $task_info->save(); | 68 | $task_info->save(); |
| 69 | 69 | ||
| 70 | - $this->output('任务完成'); | 70 | + $this->output('任务完成' . $e->getMessage()); |
| 71 | } catch (\Exception $e) { | 71 | } catch (\Exception $e) { |
| 72 | 72 | ||
| 73 | $task_info->retry = $task_info->retry + 1; | 73 | $task_info->retry = $task_info->retry + 1; |
| @@ -980,7 +980,7 @@ class Country | @@ -980,7 +980,7 @@ class Country | ||
| 980 | * @method :post | 980 | * @method :post |
| 981 | * @time :2025/3/27 10:38 | 981 | * @time :2025/3/27 10:38 |
| 982 | */ | 982 | */ |
| 983 | -public function getCountryNameByAlpha3($alpha3) { | 983 | +public static function getCountryNameByAlpha3($alpha3) { |
| 984 | // ISO 3166-1 alpha-3 国家码与国家名称的映射 | 984 | // ISO 3166-1 alpha-3 国家码与国家名称的映射 |
| 985 | $countries = [ | 985 | $countries = [ |
| 986 | 'AFG' => 'Afghanistan', | 986 | 'AFG' => 'Afghanistan', |
| @@ -12,6 +12,7 @@ use App\Models\ASide\APublicModel; | @@ -12,6 +12,7 @@ use App\Models\ASide\APublicModel; | ||
| 12 | use App\Models\Channel\Channel; | 12 | use App\Models\Channel\Channel; |
| 13 | use App\Models\Com\KeywordVideoTask; | 13 | use App\Models\Com\KeywordVideoTask; |
| 14 | use App\Models\Domain\DomainInfo; | 14 | use App\Models\Domain\DomainInfo; |
| 15 | +use App\Models\HomeCount\AfterCount; | ||
| 15 | use App\Models\Manage\ManageHr; | 16 | use App\Models\Manage\ManageHr; |
| 16 | use App\Models\Product\Category; | 17 | use App\Models\Product\Category; |
| 17 | use App\Models\Product\Keyword; | 18 | use App\Models\Product\Keyword; |
| @@ -570,4 +571,15 @@ class OptimizeController extends BaseController | @@ -570,4 +571,15 @@ class OptimizeController extends BaseController | ||
| 570 | $this->response('success',Code::SUCCESS,$list); | 571 | $this->response('success',Code::SUCCESS,$list); |
| 571 | } | 572 | } |
| 572 | 573 | ||
| 574 | + /** | ||
| 575 | + * @remark :售后数据统计 | ||
| 576 | + * @name :getAfterCount | ||
| 577 | + * @author :lyh | ||
| 578 | + * @method :post | ||
| 579 | + * @time :2025/3/27 17:21 | ||
| 580 | + */ | ||
| 581 | + public function getAfterCount(AfterCount $afterCount){ | ||
| 582 | + $list = $afterCount->lists($this->map,$this->page,$this->row); | ||
| 583 | + $this->response('success',Code::SUCCESS,$list); | ||
| 584 | + } | ||
| 573 | } | 585 | } |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :GoogleSearchController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/3/27 13:53 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Bside\GoogleKeywordInsight; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Bside\BaseController; | ||
| 14 | +use App\Services\GoogleSearchService; | ||
| 15 | + | ||
| 16 | +class GoogleSearchController extends BaseController | ||
| 17 | +{ | ||
| 18 | + /** | ||
| 19 | + * @remark :google搜索数据 | ||
| 20 | + * @name :searchList | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2025/3/27 13:59 | ||
| 24 | + */ | ||
| 25 | + public function getSearchList(){ | ||
| 26 | + $this->request->validate([ | ||
| 27 | + 'search' => 'required' | ||
| 28 | + ],[ | ||
| 29 | + 'search.required' => '搜索类型不能为空', | ||
| 30 | + ]); | ||
| 31 | + //获取当前项目域名 | ||
| 32 | + $domain = parse_url($this->user['domain'], PHP_URL_HOST); | ||
| 33 | + $googleService = new GoogleSearchService(); | ||
| 34 | + $data = $googleService->googleSearch($domain,$this->param['search']); | ||
| 35 | + $this->response('success',Code::SUCCESS,$data); | ||
| 36 | + } | ||
| 37 | +} |
| @@ -34,11 +34,13 @@ class BlogCategoryLogic extends BaseLogic | @@ -34,11 +34,13 @@ class BlogCategoryLogic extends BaseLogic | ||
| 34 | DB::beginTransaction(); | 34 | DB::beginTransaction(); |
| 35 | try { | 35 | try { |
| 36 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 36 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 37 | + $info = $this->model->read(['id'=>$this->param['id']],['id','alias']); | ||
| 37 | $id = $this->param['id']; | 38 | $id = $this->param['id']; |
| 38 | $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); | 39 | $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); |
| 39 | $route = $this->param['alias']; | 40 | $route = $this->param['alias']; |
| 40 | $this->param['operator_id'] = $this->user['id']; | 41 | $this->param['operator_id'] = $this->user['id']; |
| 41 | $this->edit($this->param,['id'=>$id]); | 42 | $this->edit($this->param,['id'=>$id]); |
| 43 | + $this->curlDelRoute(['new_route'=>$route ?? '','old_route'=>$info['alias'] ?? '']); | ||
| 42 | }else{ | 44 | }else{ |
| 43 | //路由拼接 | 45 | //路由拼接 |
| 44 | if(!isset($this->param['alias']) || empty($this->param['alias'])){ | 46 | if(!isset($this->param['alias']) || empty($this->param['alias'])){ |
| @@ -49,6 +51,7 @@ class BlogCategoryLogic extends BaseLogic | @@ -49,6 +51,7 @@ class BlogCategoryLogic extends BaseLogic | ||
| 49 | $id = $this->model->addReturnId($this->param); | 51 | $id = $this->model->addReturnId($this->param); |
| 50 | $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); | 52 | $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); |
| 51 | $this->edit(['alias'=>$route],['id'=>$id]); | 53 | $this->edit(['alias'=>$route],['id'=>$id]); |
| 54 | + $this->curlDelRoute(['new_route'=>$route]); | ||
| 52 | } | 55 | } |
| 53 | DB::commit(); | 56 | DB::commit(); |
| 54 | }catch (\Exception $e){ | 57 | }catch (\Exception $e){ |
| @@ -56,7 +59,6 @@ class BlogCategoryLogic extends BaseLogic | @@ -56,7 +59,6 @@ class BlogCategoryLogic extends BaseLogic | ||
| 56 | $this->fail('系统错误,请联系管理'); | 59 | $this->fail('系统错误,请联系管理'); |
| 57 | } | 60 | } |
| 58 | $this->addUpdateNotify(RouteMap::SOURCE_BLOG_CATE,$route); | 61 | $this->addUpdateNotify(RouteMap::SOURCE_BLOG_CATE,$route); |
| 59 | - $this->curlDelRoute(['new_route'=>$route]); | ||
| 60 | return $this->success(['id'=>$id]); | 62 | return $this->success(['id'=>$id]); |
| 61 | } | 63 | } |
| 62 | 64 |
| @@ -30,6 +30,7 @@ class BlogLogic extends BaseLogic | @@ -30,6 +30,7 @@ class BlogLogic extends BaseLogic | ||
| 30 | //拼接参数 | 30 | //拼接参数 |
| 31 | $this->param = $this->paramProcessing($this->param); | 31 | $this->param = $this->paramProcessing($this->param); |
| 32 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 32 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 33 | + $info = $this->model->read(['id'=>$this->param['id']],['id','url']); | ||
| 33 | $id = $this->param['id']; | 34 | $id = $this->param['id']; |
| 34 | $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 | 35 | $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 |
| 35 | $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示 | 36 | $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示 |
| @@ -38,14 +39,15 @@ class BlogLogic extends BaseLogic | @@ -38,14 +39,15 @@ class BlogLogic extends BaseLogic | ||
| 38 | } | 39 | } |
| 39 | $route = $this->param['url']; | 40 | $route = $this->param['url']; |
| 40 | $this->edit($this->param,['id'=>$id]); | 41 | $this->edit($this->param,['id'=>$id]); |
| 42 | + $this->curlDelRoute(['new_route'=>$route ?? '','old_route'=>$info['url'] ?? '']); | ||
| 41 | }else{ | 43 | }else{ |
| 42 | $this->param['sort'] = $this->setNewsSort(); | 44 | $this->param['sort'] = $this->setNewsSort(); |
| 43 | $id = $this->model->addReturnId($this->param); | 45 | $id = $this->model->addReturnId($this->param); |
| 44 | $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); | 46 | $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); |
| 45 | $this->edit(['url'=>$route],['id'=>$id]); | 47 | $this->edit(['url'=>$route],['id'=>$id]); |
| 48 | + $this->curlDelRoute(['new_route'=>$route]); | ||
| 46 | } | 49 | } |
| 47 | $this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route); | 50 | $this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route); |
| 48 | - $this->curlDelRoute(['new_route'=>$route]); | ||
| 49 | return $this->success(['id'=>$id]); | 51 | return $this->success(['id'=>$id]); |
| 50 | } | 52 | } |
| 51 | 53 |
| @@ -63,6 +63,7 @@ class NewsCategoryLogic extends BaseLogic | @@ -63,6 +63,7 @@ class NewsCategoryLogic extends BaseLogic | ||
| 63 | $this->verifyParamName($this->param['name']); | 63 | $this->verifyParamName($this->param['name']); |
| 64 | $this->param = $this->handleParam($this->param); | 64 | $this->param = $this->handleParam($this->param); |
| 65 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 65 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 66 | + $info = $this->model->read(['id'=>$this->param['id']],['id','alias']); | ||
| 66 | $id = $this->param['id']; | 67 | $id = $this->param['id']; |
| 67 | $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); | 68 | $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); |
| 68 | $route = $this->param['alias']; | 69 | $route = $this->param['alias']; |
| @@ -71,6 +72,7 @@ class NewsCategoryLogic extends BaseLogic | @@ -71,6 +72,7 @@ class NewsCategoryLogic extends BaseLogic | ||
| 71 | } | 72 | } |
| 72 | $this->param['operator_id'] = $this->user['id']; | 73 | $this->param['operator_id'] = $this->user['id']; |
| 73 | $this->edit($this->param,['id'=>$id]); | 74 | $this->edit($this->param,['id'=>$id]); |
| 75 | + $this->curlDelRoute(['new_route'=>$route ?? '','old_route'=>$info['alias'] ?? '']); | ||
| 74 | }else{ | 76 | }else{ |
| 75 | if(!isset($this->param['alias']) || empty($this->param['alias'])){ | 77 | if(!isset($this->param['alias']) || empty($this->param['alias'])){ |
| 76 | $this->param['alias'] = Translate::tran($this->param['name'], 'en'); | 78 | $this->param['alias'] = Translate::tran($this->param['name'], 'en'); |
| @@ -82,9 +84,9 @@ class NewsCategoryLogic extends BaseLogic | @@ -82,9 +84,9 @@ class NewsCategoryLogic extends BaseLogic | ||
| 82 | $id = $this->model->addReturnId($this->param); | 84 | $id = $this->model->addReturnId($this->param); |
| 83 | $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); | 85 | $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); |
| 84 | $this->model->edit(['alias'=>$route],['id'=>$id]); | 86 | $this->model->edit(['alias'=>$route],['id'=>$id]); |
| 87 | + $this->curlDelRoute(['new_route'=>$route]); | ||
| 85 | } | 88 | } |
| 86 | $this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route); | 89 | $this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route); |
| 87 | - $this->curlDelRoute(['new_route'=>$route]); | ||
| 88 | return $this->success(['id'=>$id]); | 90 | return $this->success(['id'=>$id]); |
| 89 | } | 91 | } |
| 90 | 92 |
| @@ -61,6 +61,7 @@ class NewsLogic extends BaseLogic | @@ -61,6 +61,7 @@ class NewsLogic extends BaseLogic | ||
| 61 | { | 61 | { |
| 62 | $this->param = $this->paramProcessing($this->param); | 62 | $this->param = $this->paramProcessing($this->param); |
| 63 | if (isset($this->param['id']) && !empty($this->param['id'])) { | 63 | if (isset($this->param['id']) && !empty($this->param['id'])) { |
| 64 | + $info = $this->model->read(['id'=>$this->param['id']],['id','url']); | ||
| 64 | $id = $this->param['id']; | 65 | $id = $this->param['id']; |
| 65 | $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 | 66 | $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 |
| 66 | $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示 | 67 | $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示 |
| @@ -70,14 +71,15 @@ class NewsLogic extends BaseLogic | @@ -70,14 +71,15 @@ class NewsLogic extends BaseLogic | ||
| 70 | //是否更新路由 | 71 | //是否更新路由 |
| 71 | $route = $this->param['url']; | 72 | $route = $this->param['url']; |
| 72 | $this->edit($this->param, ['id' => $id]); | 73 | $this->edit($this->param, ['id' => $id]); |
| 74 | + $this->curlDelRoute(['new_route'=>$route ?? '','old_route'=>$info['url'] ?? '']); | ||
| 73 | } else { | 75 | } else { |
| 74 | $this->param['sort'] = $this->setNewsSort(); | 76 | $this->param['sort'] = $this->setNewsSort(); |
| 75 | $id = $this->model->addReturnId($this->param); | 77 | $id = $this->model->addReturnId($this->param); |
| 76 | $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); | 78 | $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); |
| 77 | $this->edit(['url' => $route], ['id' => $id]); | 79 | $this->edit(['url' => $route], ['id' => $id]); |
| 80 | + $this->curlDelRoute(['new_route'=>$route]); | ||
| 78 | } | 81 | } |
| 79 | $this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route); | 82 | $this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route); |
| 80 | - $this->curlDelRoute(['new_route'=>$route]); | ||
| 81 | return $this->success(['id'=>$id]); | 83 | return $this->success(['id'=>$id]); |
| 82 | } | 84 | } |
| 83 | 85 |
| @@ -115,20 +115,22 @@ class CategoryLogic extends BaseLogic | @@ -115,20 +115,22 @@ class CategoryLogic extends BaseLogic | ||
| 115 | public function categorySave(){ | 115 | public function categorySave(){ |
| 116 | $this->param = $this->saveHandleParam($this->param); | 116 | $this->param = $this->saveHandleParam($this->param); |
| 117 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 117 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 118 | + $info = $this->model->read(['id'=>$this->param['id']],['id','route']); | ||
| 118 | $id = $this->param['id']; | 119 | $id = $this->param['id']; |
| 119 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); | 120 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); |
| 120 | $route = $this->param['route']; | 121 | $route = $this->param['route']; |
| 121 | $this->model->edit($this->param,['id'=>$id]); | 122 | $this->model->edit($this->param,['id'=>$id]); |
| 123 | + $this->curlDelRoute(['new_route'=>$route ?? '','old_route'=>$info['route'] ?? '']); | ||
| 122 | }else{ | 124 | }else{ |
| 123 | $this->param['project_id'] = $this->user['project_id']; | 125 | $this->param['project_id'] = $this->user['project_id']; |
| 124 | $id = $this->model->addReturnId($this->param); | 126 | $id = $this->model->addReturnId($this->param); |
| 125 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); | 127 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); |
| 126 | $this->edit(['route'=>$route],['id'=>$id]); | 128 | $this->edit(['route'=>$route],['id'=>$id]); |
| 129 | + $this->curlDelRoute(['new_route'=>$route]); | ||
| 127 | } | 130 | } |
| 128 | //清除缓存 | 131 | //清除缓存 |
| 129 | Common::del_user_cache('product_category',$this->user['project_id']); | 132 | Common::del_user_cache('product_category',$this->user['project_id']); |
| 130 | $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route); | 133 | $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route); |
| 131 | - $this->curlDelRoute(['new_route'=>$route]); | ||
| 132 | return $this->success(['id'=>$id]); | 134 | return $this->success(['id'=>$id]); |
| 133 | } | 135 | } |
| 134 | 136 |
| @@ -51,7 +51,6 @@ class ProductLogic extends BaseLogic | @@ -51,7 +51,6 @@ class ProductLogic extends BaseLogic | ||
| 51 | $this->saveExtendInfo($data['id'],$this->param['extend'] ?? []);//扩展字段 | 51 | $this->saveExtendInfo($data['id'],$this->param['extend'] ?? []);//扩展字段 |
| 52 | $this->saveDetail($data['id'],$this->param['detail'] ?? []); | 52 | $this->saveDetail($data['id'],$this->param['detail'] ?? []); |
| 53 | $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$data['route'] ?? ''); | 53 | $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$data['route'] ?? ''); |
| 54 | - $this->curlDelRoute(['new_route'=>$data['route'] ?? '']); | ||
| 55 | return $this->success(['id'=>$data['id']]); | 54 | return $this->success(['id'=>$data['id']]); |
| 56 | } | 55 | } |
| 57 | 56 | ||
| @@ -73,6 +72,7 @@ class ProductLogic extends BaseLogic | @@ -73,6 +72,7 @@ class ProductLogic extends BaseLogic | ||
| 73 | $id = $this->model->addReturnId($param); | 72 | $id = $this->model->addReturnId($param); |
| 74 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | 73 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); |
| 75 | $this->model->edit(['route'=>$route],['id'=>$id]); | 74 | $this->model->edit(['route'=>$route],['id'=>$id]); |
| 75 | + $this->curlDelRoute(['new_route'=>$route ?? '']); | ||
| 76 | return $this->success(['id'=>$id,'route'=>$route]); | 76 | return $this->success(['id'=>$id,'route'=>$route]); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| @@ -84,6 +84,7 @@ class ProductLogic extends BaseLogic | @@ -84,6 +84,7 @@ class ProductLogic extends BaseLogic | ||
| 84 | * @time :2024/12/18 10:09 | 84 | * @time :2024/12/18 10:09 |
| 85 | */ | 85 | */ |
| 86 | public function editProduct(){ | 86 | public function editProduct(){ |
| 87 | + $info = $this->model->read(['id'=>$this->param['id']],['id','route']); | ||
| 87 | //处理字段 | 88 | //处理字段 |
| 88 | $param = $this->handleSaveParam($this->param); | 89 | $param = $this->handleSaveParam($this->param); |
| 89 | $route = $param['route']; | 90 | $route = $param['route']; |
| @@ -95,6 +96,7 @@ class ProductLogic extends BaseLogic | @@ -95,6 +96,7 @@ class ProductLogic extends BaseLogic | ||
| 95 | $param['route'] = RouteMap::setRoute($param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); | 96 | $param['route'] = RouteMap::setRoute($param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); |
| 96 | } | 97 | } |
| 97 | $this->model->edit($param,['id'=>$this->param['id']]); | 98 | $this->model->edit($param,['id'=>$this->param['id']]); |
| 99 | + $this->curlDelRoute(['new_route'=>$route ?? '','old_route'=>$info['route'] ?? '']); | ||
| 98 | return $this->success(['id'=>$this->param['id'],'route'=>$route]); | 100 | return $this->success(['id'=>$this->param['id'],'route'=>$route]); |
| 99 | } | 101 | } |
| 100 | 102 |
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | namespace App\Models\Com; | 10 | namespace App\Models\Com; |
| 11 | 11 | ||
| 12 | use App\Models\Base; | 12 | use App\Models\Base; |
| 13 | +use Illuminate\Support\Facades\Cache; | ||
| 13 | 14 | ||
| 14 | /** | 15 | /** |
| 15 | * @remark :国家信息 | 16 | * @remark :国家信息 |
| @@ -21,4 +22,14 @@ use App\Models\Base; | @@ -21,4 +22,14 @@ use App\Models\Base; | ||
| 21 | class WordCountry extends Base | 22 | class WordCountry extends Base |
| 22 | { | 23 | { |
| 23 | protected $table = 'gl_world_country_city'; | 24 | protected $table = 'gl_world_country_city'; |
| 25 | + | ||
| 26 | + public static function getCountryByIso2($iso2){ | ||
| 27 | + $key = 'getCountryByIso2_' . $iso2; | ||
| 28 | + $info = Cache::get($key); | ||
| 29 | + if (!$info) { | ||
| 30 | + $info = self::where('pid', 0)->where('iso2', $iso2)->first(); | ||
| 31 | + Cache::put($key, $info, 24 * 3600); | ||
| 32 | + } | ||
| 33 | + return $info; | ||
| 34 | + } | ||
| 24 | } | 35 | } |
| @@ -100,4 +100,17 @@ class WebLanguage extends Base | @@ -100,4 +100,17 @@ class WebLanguage extends Base | ||
| 100 | return $this->hasOne(CountryCustom::class, 'language_id', 'id'); | 100 | return $this->hasOne(CountryCustom::class, 'language_id', 'id'); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | + | ||
| 104 | + public static function getShorts(){ | ||
| 105 | + $key = 'language_shorts'; | ||
| 106 | + $list = Cache::get($key); | ||
| 107 | + if (!$list) { | ||
| 108 | + $list = self::pluck('short')->toArray(); | ||
| 109 | + if($list){ | ||
| 110 | + Cache::put($key, $list, 24 * 3600); | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + return $list; | ||
| 114 | + } | ||
| 115 | + | ||
| 103 | } | 116 | } |
| @@ -9,6 +9,8 @@ | @@ -9,6 +9,8 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Services; | 10 | namespace App\Services; |
| 11 | 11 | ||
| 12 | +use App\Helper\Country; | ||
| 13 | + | ||
| 12 | /** | 14 | /** |
| 13 | * @remark :google关键字扩展 | 15 | * @remark :google关键字扩展 |
| 14 | * @name :GoogleSearchService | 16 | * @name :GoogleSearchService |
| @@ -21,7 +23,7 @@ class GoogleSearchService | @@ -21,7 +23,7 @@ class GoogleSearchService | ||
| 21 | public $url = ""; | 23 | public $url = ""; |
| 22 | 24 | ||
| 23 | /** | 25 | /** |
| 24 | - * @remark :请求数据 | 26 | + * @remark :扩展关键词请求数据 |
| 25 | * @name :requestUrl | 27 | * @name :requestUrl |
| 26 | * @author :lyh | 28 | * @author :lyh |
| 27 | * @method :post | 29 | * @method :post |
| @@ -30,6 +32,30 @@ class GoogleSearchService | @@ -30,6 +32,30 @@ class GoogleSearchService | ||
| 30 | public function requestUrl($keyword){ | 32 | public function requestUrl($keyword){ |
| 31 | $this->url = 'https://google-keyword-insight1.p.rapidapi.com/globalkey'; | 33 | $this->url = 'https://google-keyword-insight1.p.rapidapi.com/globalkey'; |
| 32 | $url = $this->url.'/?keyword='.$keyword.'&lang=en'; | 34 | $url = $this->url.'/?keyword='.$keyword.'&lang=en'; |
| 35 | + return $this->curlGoogleApi($url); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * @remark :热门关键词拉取 | ||
| 40 | + * @name :requestKeywordUrl | ||
| 41 | + * @author :lyh | ||
| 42 | + * @method :post | ||
| 43 | + * @time :2025/3/27 16:57 | ||
| 44 | + */ | ||
| 45 | + public function requestKeywordUrl($keyword){ | ||
| 46 | + $this->url = 'https://google-keyword-insight1.p.rapidapi.com/topkeys'; | ||
| 47 | + $url = $this->url.'/?keyword='.$keyword.'&location=US&&lang=en'; | ||
| 48 | + return $this->curlGoogleApi($url); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * @remark :请求 | ||
| 53 | + * @name :curlGoogleApi | ||
| 54 | + * @author :lyh | ||
| 55 | + * @method :post | ||
| 56 | + * @time :2025/3/27 16:59 | ||
| 57 | + */ | ||
| 58 | + public function curlGoogleApi($url){ | ||
| 33 | $curl = curl_init(); | 59 | $curl = curl_init(); |
| 34 | curl_setopt_array($curl, [ | 60 | curl_setopt_array($curl, [ |
| 35 | CURLOPT_URL => $url, | 61 | CURLOPT_URL => $url, |
| @@ -48,7 +74,7 @@ class GoogleSearchService | @@ -48,7 +74,7 @@ class GoogleSearchService | ||
| 48 | $err = curl_error($curl); | 74 | $err = curl_error($curl); |
| 49 | curl_close($curl); | 75 | curl_close($curl); |
| 50 | if ($err) { | 76 | if ($err) { |
| 51 | - errorLog("关键词扩展cURL Error #:", $url, $err); | 77 | + errorLog("热门关键词cURL Error #:", $url, $err); |
| 52 | return false; | 78 | return false; |
| 53 | } else { | 79 | } else { |
| 54 | return json_decode($response,true); | 80 | return json_decode($response,true); |
| @@ -61,12 +87,27 @@ class GoogleSearchService | @@ -61,12 +87,27 @@ class GoogleSearchService | ||
| 61 | * @author :lyh | 87 | * @author :lyh |
| 62 | * @method :post | 88 | * @method :post |
| 63 | * @time :2025/3/27 11:18 | 89 | * @time :2025/3/27 11:18 |
| 64 | - * @param :date,query,page,device,country | 90 | + * @param :date,query,page,device,country/时间、聚合、前页、设备、国家 |
| 65 | */ | 91 | */ |
| 66 | - public function googleSearch($data){ | ||
| 67 | - $this->url = 'https://www.cmer.site/api/google/search?domain=www.suertetextile.com&q='; | ||
| 68 | - $url = $this->url.$data; | ||
| 69 | - return http_get($url); | 92 | + public function googleSearch($domain,$search){ |
| 93 | + $data = [ | ||
| 94 | + 1=>'date', | ||
| 95 | + 2=>'query', | ||
| 96 | + 3=>'page', | ||
| 97 | + 4=>'device', | ||
| 98 | + 5=>'country' | ||
| 99 | + ]; | ||
| 100 | + $this->url = 'https://www.cmer.site/api/google/search'; | ||
| 101 | + $url = $this->url.'?domain='.$domain.'&q='.$data[$search]; | ||
| 102 | + $data = http_get($url); | ||
| 103 | + $data = $data['data'] ?? []; | ||
| 104 | + if(!empty($data) && ($search == 5)){ | ||
| 105 | + foreach ($data as $key => $val){ | ||
| 106 | + $val['keys_country'] = Country::getCountryNameByAlpha3(strtoupper($val['keys'][0])); | ||
| 107 | + $data[$key] = $val; | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + return $data; | ||
| 70 | } | 111 | } |
| 71 | 112 | ||
| 72 | } | 113 | } |
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | namespace App\Services; | 4 | namespace App\Services; |
| 5 | 5 | ||
| 6 | use App\Exceptions\InquiryFilterException; | 6 | use App\Exceptions\InquiryFilterException; |
| 7 | +use App\Models\Com\WordCountry; | ||
| 7 | use App\Models\Domain\CountryCode; | 8 | use App\Models\Domain\CountryCode; |
| 8 | use App\Models\Domain\DomainInfo; | 9 | use App\Models\Domain\DomainInfo; |
| 9 | use App\Models\Inquiry\InquiryForm; | 10 | use App\Models\Inquiry\InquiryForm; |
| @@ -15,6 +16,7 @@ use App\Models\Project\Project; | @@ -15,6 +16,7 @@ use App\Models\Project\Project; | ||
| 15 | use App\Models\Subscribe\Email; | 16 | use App\Models\Subscribe\Email; |
| 16 | use App\Models\SyncSubmitTask\SyncSubmitTask; | 17 | use App\Models\SyncSubmitTask\SyncSubmitTask; |
| 17 | use App\Models\Visit\Visit; | 18 | use App\Models\Visit\Visit; |
| 19 | +use App\Models\WebSetting\WebLanguage; | ||
| 18 | use App\Models\Workchat\MessagePush; | 20 | use App\Models\Workchat\MessagePush; |
| 19 | use App\Utils\LogUtils; | 21 | use App\Utils\LogUtils; |
| 20 | use Illuminate\Support\Facades\Cache; | 22 | use Illuminate\Support\Facades\Cache; |
| @@ -74,7 +76,24 @@ class SyncSubmitTaskService | @@ -74,7 +76,24 @@ class SyncSubmitTaskService | ||
| 74 | } | 76 | } |
| 75 | } | 77 | } |
| 76 | } | 78 | } |
| 77 | - | 79 | + //$data['data']['referrer_url']为空 && 访问小语种 && 访问国家和IP所在国家不匹配 不记录数据 |
| 80 | + //$data['data']['referrer_url']为空 && 任何小语种 美国都不记 | ||
| 81 | + if (empty($data['data']['referrer_url']) && $task['type'] == 'visit') { | ||
| 82 | + $tran_visit = ''; | ||
| 83 | + //是否是小语种 二级域名或二级目录 | ||
| 84 | + $langs = WebLanguage::getShorts(); | ||
| 85 | + foreach ($langs as $lang){ | ||
| 86 | + if(Str::contains($data['data']['url'], [$lang . '.' .$data['domain'], $data['domain'] . '/' . $lang. '/'])){ | ||
| 87 | + $tran_visit = $lang; | ||
| 88 | + break; | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + //直接根据 语种缩写 去匹配 国家简码 不搞麻烦了,将就用 | ||
| 92 | + $tran_country = WordCountry::getCountryByIso2($tran_visit)['chinese_name'] ?? ''; | ||
| 93 | + if ($tran_visit && $tran_visit !='en' && ($checkIpCountry['country'] == '美国' || $tran_country != $checkIpCountry['country'])) { | ||
| 94 | + throw new InquiryFilterException( '判定为蜘蛛爬取小语种'); | ||
| 95 | + } | ||
| 96 | + } | ||
| 78 | //域名 过滤国家或ip | 97 | //域名 过滤国家或ip |
| 79 | $domain_info = DomainInfo::getCacheInfoByProjectId($project['id']); | 98 | $domain_info = DomainInfo::getCacheInfoByProjectId($project['id']); |
| 80 | if(!empty($domain_info['not_allow_country'])){ | 99 | if(!empty($domain_info['not_allow_country'])){ |
| @@ -302,7 +302,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -302,7 +302,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 302 | Route::any('/saveMinorLanguages', [Aside\Optimize\OptimizeController::class, 'saveMinorLanguages'])->name('admin.optimize_saveMinorLanguages');//设置小语种监控开关 | 302 | Route::any('/saveMinorLanguages', [Aside\Optimize\OptimizeController::class, 'saveMinorLanguages'])->name('admin.optimize_saveMinorLanguages');//设置小语种监控开关 |
| 303 | Route::any('/editTranslateStatus', [Aside\Optimize\OptimizeController::class, 'editTranslateStatus'])->name('admin.optimize_editTranslateStatus');//设置robots开关 | 303 | Route::any('/editTranslateStatus', [Aside\Optimize\OptimizeController::class, 'editTranslateStatus'])->name('admin.optimize_editTranslateStatus');//设置robots开关 |
| 304 | Route::any('/getAnchorLink', [Aside\Optimize\OptimizeController::class, 'getAnchorLink'])->name('admin.optimize_getAnchorLink');//设置robots开关 | 304 | Route::any('/getAnchorLink', [Aside\Optimize\OptimizeController::class, 'getAnchorLink'])->name('admin.optimize_getAnchorLink');//设置robots开关 |
| 305 | - | 305 | + Route::any('/getAfterCount', [Aside\Optimize\OptimizeController::class, 'getAfterCount'])->name('admin.optimize_getAfterCount');//设置robots开关 |
| 306 | }); | 306 | }); |
| 307 | //生成关键字 | 307 | //生成关键字 |
| 308 | Route::prefix('create_keyword')->group(function () { | 308 | Route::prefix('create_keyword')->group(function () { |
| @@ -700,7 +700,10 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -700,7 +700,10 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 700 | Route::prefix('google_keyword_insight')->group(function () { | 700 | Route::prefix('google_keyword_insight')->group(function () { |
| 701 | Route::any('/getKeywordInsight', [\App\Http\Controllers\Bside\GoogleKeywordInsight\GoogleKeywordInsightController::class, 'getKeywordInsight'])->name('google_keyword_insight_getKeywordInsight'); | 701 | Route::any('/getKeywordInsight', [\App\Http\Controllers\Bside\GoogleKeywordInsight\GoogleKeywordInsightController::class, 'getKeywordInsight'])->name('google_keyword_insight_getKeywordInsight'); |
| 702 | }); | 702 | }); |
| 703 | - | 703 | + //google搜索数据 |
| 704 | + Route::prefix('google_search')->group(function () { | ||
| 705 | + Route::any('/getSearchList', [\App\Http\Controllers\Bside\GoogleKeywordInsight\GoogleSearchController::class, 'getSearchList'])->name('google_search_getSearchList'); | ||
| 706 | + }); | ||
| 704 | //企业产品库 | 707 | //企业产品库 |
| 705 | Route::prefix('enterprise_product')->group(function () { | 708 | Route::prefix('enterprise_product')->group(function () { |
| 706 | Route::any('/getEnterProduct', [\App\Http\Controllers\Bside\SeoSetting\EnterpriseProductController::class, 'getEnterProduct'])->name('enterprise_product_getEnterProduct'); | 709 | Route::any('/getEnterProduct', [\App\Http\Controllers\Bside\SeoSetting\EnterpriseProductController::class, 'getEnterProduct'])->name('enterprise_product_getEnterProduct'); |
-
请 注册 或 登录 后发表评论