Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
26 个修改的文件
包含
83 行增加
和
37 行删除
| @@ -63,7 +63,7 @@ class GoogleSearchKeyword extends Command | @@ -63,7 +63,7 @@ class GoogleSearchKeyword extends Command | ||
| 63 | */ | 63 | */ |
| 64 | public function handle(){ | 64 | public function handle(){ |
| 65 | $projectModel = new Project(); | 65 | $projectModel = new Project(); |
| 66 | - $lists = $projectModel->list(['delete_status' => 0,'type'=>['!=',$projectModel::TYPE_ONE]], 'id', ['id']); | 66 | + $lists = $projectModel->list(['delete_status' => 0,'extend_type'=>0,'type'=>['in',[2,3,4]]], 'id', ['id']); |
| 67 | $domainModel = new DomainInfo(); | 67 | $domainModel = new DomainInfo(); |
| 68 | foreach ($lists as $val) { | 68 | foreach ($lists as $val) { |
| 69 | echo date('Y-m-d H:i:s') . '开始--项目的id:'. $val['id'] . PHP_EOL; | 69 | echo date('Y-m-d H:i:s') . '开始--项目的id:'. $val['id'] . PHP_EOL; |
| @@ -64,7 +64,7 @@ class SendKeyword extends Command | @@ -64,7 +64,7 @@ class SendKeyword extends Command | ||
| 64 | }) | 64 | }) |
| 65 | ->get(); | 65 | ->get(); |
| 66 | $time = time(); | 66 | $time = time(); |
| 67 | - $send_num = [30 => 1000, 60 => 3000, 90 => 6000]; | 67 | + $send_num = [30 => 1000, 50 => 2000, 60 => 4000, 70 => 6000]; |
| 68 | $ban_domain = $this->banDomain(); | 68 | $ban_domain = $this->banDomain(); |
| 69 | foreach ($projects as $item) { | 69 | foreach ($projects as $item) { |
| 70 | if (empty($item->is_auto_keywords)) | 70 | if (empty($item->is_auto_keywords)) |
| @@ -51,7 +51,7 @@ class GeneratePage extends Command | @@ -51,7 +51,7 @@ class GeneratePage extends Command | ||
| 51 | { | 51 | { |
| 52 | $noticeModel = new NoticeLog(); | 52 | $noticeModel = new NoticeLog(); |
| 53 | while (true){ | 53 | while (true){ |
| 54 | - $noticeInfo = $noticeModel->read(['status'=>0,'type'=>$noticeModel::GENERATE_PAGE]); | 54 | + $noticeInfo = $noticeModel->read(['status'=>0,'type'=>$noticeModel::GENERATE_PAGE,'start_at'=>['<=',date('Y-m-d H:i:s')]]); |
| 55 | if (empty($noticeInfo)) { | 55 | if (empty($noticeInfo)) { |
| 56 | sleep(10); | 56 | sleep(10); |
| 57 | continue; | 57 | continue; |
| @@ -189,7 +189,7 @@ class SyncProject extends Command | @@ -189,7 +189,7 @@ class SyncProject extends Command | ||
| 189 | if(isset($data[$param])){ | 189 | if(isset($data[$param])){ |
| 190 | return $data[$param]; | 190 | return $data[$param]; |
| 191 | }else{ | 191 | }else{ |
| 192 | - return 1; | 192 | + return 0; |
| 193 | } | 193 | } |
| 194 | } | 194 | } |
| 195 | 195 |
| @@ -7,6 +7,7 @@ use App\Helper\Common; | @@ -7,6 +7,7 @@ use App\Helper\Common; | ||
| 7 | use App\Helper\Gpt; | 7 | use App\Helper\Gpt; |
| 8 | use App\Models\Ai\AiCommand; | 8 | use App\Models\Ai\AiCommand; |
| 9 | use App\Models\Ai\AiTdkErrorLog; | 9 | use App\Models\Ai\AiTdkErrorLog; |
| 10 | +use App\Models\Com\NoticeLog; | ||
| 10 | use App\Models\Com\UpdateNotify; | 11 | use App\Models\Com\UpdateNotify; |
| 11 | use App\Models\Domain\DomainInfo; | 12 | use App\Models\Domain\DomainInfo; |
| 12 | use App\Models\Mail\Mail; | 13 | use App\Models\Mail\Mail; |
| @@ -258,7 +259,8 @@ class UpdateSeoTdk extends Command | @@ -258,7 +259,8 @@ class UpdateSeoTdk extends Command | ||
| 258 | 'url' => [], | 259 | 'url' => [], |
| 259 | 'language'=> [], | 260 | 'language'=> [], |
| 260 | ]; | 261 | ]; |
| 261 | - http_post($url, json_encode($param)); | 262 | + NoticeLog::createLog(NoticeLog::GENERATE_PAGE, json_encode(['c_url'=>$url,'c_params'=>$param]),date('Y-m-d H:i:s',time()+300)); |
| 263 | +// http_post($url, json_encode($param)); | ||
| 262 | echo getmypid() . ' ' . '更新中请稍后, 更新完成将会发送站内信通知更新结果!'. PHP_EOL; | 264 | echo getmypid() . ' ' . '更新中请稍后, 更新完成将会发送站内信通知更新结果!'. PHP_EOL; |
| 263 | } | 265 | } |
| 264 | public function seo_tdk($project_id, $task_id) | 266 | public function seo_tdk($project_id, $task_id) |
| @@ -1206,6 +1206,9 @@ function paginateArray($array, $page = 1, $pageSize = 20) { | @@ -1206,6 +1206,9 @@ function paginateArray($array, $page = 1, $pageSize = 20) { | ||
| 1206 | * @time :2025/4/3 16:19 | 1206 | * @time :2025/4/3 16:19 |
| 1207 | */ | 1207 | */ |
| 1208 | function getDomain($url) { | 1208 | function getDomain($url) { |
| 1209 | + if(empty($url)){ | ||
| 1210 | + return $url; | ||
| 1211 | + } | ||
| 1209 | $parsedUrl = parse_url($url); | 1212 | $parsedUrl = parse_url($url); |
| 1210 | return $parsedUrl['host'] ?? $url; // 如果解析失败,返回原始 URL | 1213 | return $parsedUrl['host'] ?? $url; // 如果解析失败,返回原始 URL |
| 1211 | } | 1214 | } |
| @@ -4,7 +4,7 @@ namespace App\Http\Controllers\Aside\Collect; | @@ -4,7 +4,7 @@ namespace App\Http\Controllers\Aside\Collect; | ||
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Http\Controllers\Aside\BaseController; | 6 | use App\Http\Controllers\Aside\BaseController; |
| 7 | -use App\Http\Logic\Aside\CollectLogic; | 7 | +use App\Http\Logic\Aside\Collect\CollectLogic; |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| @@ -32,7 +32,7 @@ class InquiryForwardController extends BaseController | @@ -32,7 +32,7 @@ class InquiryForwardController extends BaseController | ||
| 32 | $this->map['message'] = ['like', '%' . $this->map['message'] . '%']; | 32 | $this->map['message'] = ['like', '%' . $this->map['message'] . '%']; |
| 33 | } | 33 | } |
| 34 | if (isset($this->param['start_date']) && isset($this->param['end_date'])) { | 34 | if (isset($this->param['start_date']) && isset($this->param['end_date'])) { |
| 35 | - $this->map['inquiry_date'] = ['between', [$this->map['start_date'] . ' 00:00:00', $this->map['end_date'] . ' 23:59:59']]; | 35 | + $this->map['inquiry_date'] = ['between', [$this->map['start_date'] . ' 00:00:00', $this->map['end_date'] . ' 00:00:00']]; |
| 36 | unset($this->map['start_date']); | 36 | unset($this->map['start_date']); |
| 37 | unset($this->map['end_date']); | 37 | unset($this->map['end_date']); |
| 38 | } elseif (isset($this->param['start_date'])) { | 38 | } elseif (isset($this->param['start_date'])) { |
| @@ -85,6 +85,9 @@ class CustomModuleContentController extends BaseController | @@ -85,6 +85,9 @@ class CustomModuleContentController extends BaseController | ||
| 85 | if(!empty($v['image'])){ | 85 | if(!empty($v['image'])){ |
| 86 | $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | 86 | $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); |
| 87 | } | 87 | } |
| 88 | + if(!empty($v['og_image'])){ | ||
| 89 | + $v['og_image'] = getImageUrl($v['og_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | ||
| 90 | + } | ||
| 88 | if(!empty($v['video'])){ | 91 | if(!empty($v['video'])){ |
| 89 | $v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location'],$this->user['file_cdn'] ?? 0); | 92 | $v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location'],$this->user['file_cdn'] ?? 0); |
| 90 | $v['video']['video_image'] = getImageUrl($v['video']['video_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | 93 | $v['video']['video_image'] = getImageUrl($v['video']['video_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); |
| @@ -39,7 +39,7 @@ class GoogleKeywordInsightController extends BaseController | @@ -39,7 +39,7 @@ class GoogleKeywordInsightController extends BaseController | ||
| 39 | ]); | 39 | ]); |
| 40 | $logic->getGoogleInsight(); | 40 | $logic->getGoogleInsight(); |
| 41 | $detailModel = new GoogleKeywordInsightDetail(); | 41 | $detailModel = new GoogleKeywordInsightDetail(); |
| 42 | - $data = $detailModel->lists(['search'=>$this->param['keyword']],$this->page,$this->row); | 42 | + $data = $detailModel->lists(['search'=>$this->param['keyword']],$this->page,$this->row,'id',['*'],'asc'); |
| 43 | $this->response('success',Code::SUCCESS,$data); | 43 | $this->response('success',Code::SUCCESS,$data); |
| 44 | } | 44 | } |
| 45 | 45 |
| @@ -25,14 +25,19 @@ class GoogleLinkController extends BaseController | @@ -25,14 +25,19 @@ class GoogleLinkController extends BaseController | ||
| 25 | */ | 25 | */ |
| 26 | public function getLink(){ | 26 | public function getLink(){ |
| 27 | $linkModel = new GoogleLink(); | 27 | $linkModel = new GoogleLink(); |
| 28 | - $lists = $linkModel->lists($this->map,$this->page,$this->row,'id',['url','moz_da','status','google_search','date','project_id','domain']); | 28 | + $this->map['project_id'] = $this->user['project_id']; |
| 29 | + $this->map['status'] = 1; | ||
| 30 | + $this->map['date'] = ['>=', date('Y-m-d 00:00:00', strtotime('-7 days'))]; | ||
| 31 | + $lists = $linkModel->lists($this->map,$this->page,$this->row,'id',['url','moz_da','status','url_domain','google_search','date','project_id','domain']); | ||
| 29 | if(empty($lists['list'])){ | 32 | if(empty($lists['list'])){ |
| 30 | $linkService = new GoogleLinkService(); | 33 | $linkService = new GoogleLinkService(); |
| 31 | $data = $linkService->linkPageData($this->user['domain'],$this->user['project_id']); | 34 | $data = $linkService->linkPageData($this->user['domain'],$this->user['project_id']); |
| 35 | + if(is_array($data)){ | ||
| 32 | $lists = paginateArray($data,$this->page,$this->row); | 36 | $lists = paginateArray($data,$this->page,$this->row); |
| 37 | + }else{ | ||
| 38 | + $this->response('success'); | ||
| 39 | + } | ||
| 33 | } | 40 | } |
| 34 | - $lists['y_total'] = $linkModel->counts(['status'=>1]); | ||
| 35 | - $lists['n_total'] = $linkModel->counts(['status'=>0]); | ||
| 36 | $this->response('success',Code::SUCCESS,$lists); | 41 | $this->response('success',Code::SUCCESS,$lists); |
| 37 | } | 42 | } |
| 38 | 43 |
| @@ -36,13 +36,13 @@ class GoogleSearchController extends BaseController | @@ -36,13 +36,13 @@ class GoogleSearchController extends BaseController | ||
| 36 | ]); | 36 | ]); |
| 37 | //查询详情数据 | 37 | //查询详情数据 |
| 38 | $searchDetailModel = new GoogleSearchDetail(); | 38 | $searchDetailModel = new GoogleSearchDetail(); |
| 39 | - $this->map['project_id']= 711; | ||
| 40 | - $data = $searchDetailModel->lists($this->map,$this->page,$this->row,'clicks',['keys','click_rate','impressions_rate']); | 39 | + $this->map['project_id'] = $this->user['project_id']; |
| 40 | + $data = $searchDetailModel->lists($this->map,$this->page,$this->row,'impressions',['keys','click_rate','impressions_rate']); | ||
| 41 | if(!empty($data)){ | 41 | if(!empty($data)){ |
| 42 | if($this->param['type'] == 'country'){ | 42 | if($this->param['type'] == 'country'){ |
| 43 | $codeCountryModel = new GoogleCodeCountry(); | 43 | $codeCountryModel = new GoogleCodeCountry(); |
| 44 | foreach ($data['list'] as $key => $val){ | 44 | foreach ($data['list'] as $key => $val){ |
| 45 | - $val['zh_country'] = $codeCountryModel->getCodeCountry($val['keys']); | 45 | + $val['zh_country'] = $codeCountryModel->getCodeCountry($val['keys']) ?? $val['keys']; |
| 46 | $val['click_rate'] = number_format($val['click_rate'] * 100, 2); // 保留 2 位小数 | 46 | $val['click_rate'] = number_format($val['click_rate'] * 100, 2); // 保留 2 位小数 |
| 47 | $val['impressions_rate'] = number_format($val['impressions_rate'] * 100, 2); | 47 | $val['impressions_rate'] = number_format($val['impressions_rate'] * 100, 2); |
| 48 | $data['list'][$key] = $val; | 48 | $data['list'][$key] = $val; |
| @@ -552,6 +552,9 @@ class ProductController extends BaseController | @@ -552,6 +552,9 @@ class ProductController extends BaseController | ||
| 552 | $v['gallery'][$gallery_k] = $gallery_v; | 552 | $v['gallery'][$gallery_k] = $gallery_v; |
| 553 | } | 553 | } |
| 554 | } | 554 | } |
| 555 | + if(!empty($v['og_image'])){ | ||
| 556 | + $v['og_image'] = getImageUrl($v['og_image'] ?? '',$this->user['storage_type'],$this->user['project_location']); | ||
| 557 | + } | ||
| 555 | if(!empty($v['icon'])){ | 558 | if(!empty($v['icon'])){ |
| 556 | foreach ($v['icon'] as $icon_k => $icon_v){ | 559 | foreach ($v['icon'] as $icon_k => $icon_v){ |
| 557 | $icon_v = getImageUrl($icon_v,$this->user['storage_type'] ?? 0,$this->user['project_location']); | 560 | $icon_v = getImageUrl($icon_v,$this->user['storage_type'] ?? 0,$this->user['project_location']); |
| @@ -29,7 +29,10 @@ class ProcessRecordsLogic extends BaseLogic | @@ -29,7 +29,10 @@ class ProcessRecordsLogic extends BaseLogic | ||
| 29 | ]; | 29 | ]; |
| 30 | } | 30 | } |
| 31 | $data['project_company'] = $project['company'] ?? ''; | 31 | $data['project_company'] = $project['company'] ?? ''; |
| 32 | - $data['project_plan'] = Project::planMap()[$project['deploy_build']['plan']]; | 32 | + $plan = Project::planMap(); |
| 33 | + $seo_plan = Project::seoMap(); | ||
| 34 | + $data['project_plan'] = $plan[$project['deploy_build']['plan']] ?? 0; | ||
| 35 | + $data['project_seo_plan'] = $seo_plan[$project['deploy_build']['seo_plan']] ?? 0; | ||
| 33 | $data['project_service_duration'] = $project['deploy_build']['service_duration'] ?? ''; | 36 | $data['project_service_duration'] = $project['deploy_build']['service_duration'] ?? ''; |
| 34 | $data['domain'] = (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : '');; | 37 | $data['domain'] = (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : '');; |
| 35 | $data['test_domain'] = $project['deploy_build']['test_domain'] ?? ''; | 38 | $data['test_domain'] = $project['deploy_build']['test_domain'] ?? ''; |
| @@ -138,7 +138,6 @@ class CustomTemplateLogic extends BaseLogic | @@ -138,7 +138,6 @@ class CustomTemplateLogic extends BaseLogic | ||
| 138 | $condition['source'] = $this->getType(BTemplate::COMMON_FOOTER); | 138 | $condition['source'] = $this->getType(BTemplate::COMMON_FOOTER); |
| 139 | $footerComInfo = $bTemplateComModel->read($condition); | 139 | $footerComInfo = $bTemplateComModel->read($condition); |
| 140 | if($footerComInfo === false){ | 140 | if($footerComInfo === false){ |
| 141 | - $template_id = $this->getTemplateId(); | ||
| 142 | //取默认首页的 | 141 | //取默认首页的 |
| 143 | $condition['source'] = BTemplate::SOURCE_COM; | 142 | $condition['source'] = BTemplate::SOURCE_COM; |
| 144 | $footerComInfo = $bTemplateComModel->read($condition); | 143 | $footerComInfo = $bTemplateComModel->read($condition); |
| @@ -16,7 +16,6 @@ class BlogCategoryLogic extends BaseLogic | @@ -16,7 +16,6 @@ class BlogCategoryLogic extends BaseLogic | ||
| 16 | public function __construct() | 16 | public function __construct() |
| 17 | { | 17 | { |
| 18 | parent::__construct(); | 18 | parent::__construct(); |
| 19 | - | ||
| 20 | $this->model = new BlogCategoryModel(); | 19 | $this->model = new BlogCategoryModel(); |
| 21 | $this->param = $this->requestAll; | 20 | $this->param = $this->requestAll; |
| 22 | } | 21 | } |
| @@ -100,6 +100,7 @@ class BlogLogic extends BaseLogic | @@ -100,6 +100,7 @@ class BlogLogic extends BaseLogic | ||
| 100 | $blogLabelLogic = new BlogLabelLogic(); | 100 | $blogLabelLogic = new BlogLabelLogic(); |
| 101 | $info['label_name'] = $blogLabelLogic->getLabelName($info['label_id']); | 101 | $info['label_name'] = $blogLabelLogic->getLabelName($info['label_id']); |
| 102 | $info['image_link'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); | 102 | $info['image_link'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); |
| 103 | + $info['og_image'] = getImageUrl($info['og_image'],$this->user['storage_type'],$this->user['project_location']); | ||
| 103 | return $this->success($info); | 104 | return $this->success($info); |
| 104 | } | 105 | } |
| 105 | 106 | ||
| @@ -183,6 +184,12 @@ class BlogLogic extends BaseLogic | @@ -183,6 +184,12 @@ class BlogLogic extends BaseLogic | ||
| 183 | }else{ | 184 | }else{ |
| 184 | $param['category_id'] = ''; | 185 | $param['category_id'] = ''; |
| 185 | } | 186 | } |
| 187 | + if(isset($param['image'])){ | ||
| 188 | + $param['image'] = str_replace_url($param['image'] ?? ''); | ||
| 189 | + } | ||
| 190 | + if(isset($param['og_image'])){ | ||
| 191 | + $param['og_image'] = str_replace_url($param['og_image'] ?? ''); | ||
| 192 | + } | ||
| 186 | if(isset($this->param['release_at']) && !empty(($this->param['release_at'])) && ($this->param['status'] == 3)){ | 193 | if(isset($this->param['release_at']) && !empty(($this->param['release_at'])) && ($this->param['status'] == 3)){ |
| 187 | if($this->param['release_at'] < date('Y-m-d 23:59:59')){ | 194 | if($this->param['release_at'] < date('Y-m-d 23:59:59')){ |
| 188 | $this->fail('发布时间需大于当天'); | 195 | $this->fail('发布时间需大于当天'); |
| @@ -226,6 +226,9 @@ class CustomModuleContentLogic extends BaseLogic | @@ -226,6 +226,9 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 226 | if(isset($param['image']) && !empty($param['image'])){ | 226 | if(isset($param['image']) && !empty($param['image'])){ |
| 227 | $param['image'] = str_replace_url($param['image']); | 227 | $param['image'] = str_replace_url($param['image']); |
| 228 | } | 228 | } |
| 229 | + if(isset($param['og_image'])){ | ||
| 230 | + $param['og_image'] = str_replace_url($param['og_image'] ?? ''); | ||
| 231 | + } | ||
| 229 | if(isset($param['video'])){ | 232 | if(isset($param['video'])){ |
| 230 | $param['video']['url'] = str_replace_url($param['video']['url']); | 233 | $param['video']['url'] = str_replace_url($param['video']['url']); |
| 231 | $param['video']['video_image'] = str_replace_url($param['video']['video_image']); | 234 | $param['video']['video_image'] = str_replace_url($param['video']['video_image']); |
| @@ -75,7 +75,6 @@ class GoogleKeywordInsightLogic extends BaseLogic | @@ -75,7 +75,6 @@ class GoogleKeywordInsightLogic extends BaseLogic | ||
| 75 | DB::commit(); | 75 | DB::commit(); |
| 76 | }catch (\Exception $e){ | 76 | }catch (\Exception $e){ |
| 77 | DB::rollBack(); | 77 | DB::rollBack(); |
| 78 | - $this->fail('保存失败,请联系管理员'); | ||
| 79 | } | 78 | } |
| 80 | } | 79 | } |
| 81 | return $this->success(['id'=>$id ?? 0]); | 80 | return $this->success(['id'=>$id ?? 0]); |
| @@ -192,6 +192,9 @@ class NewsLogic extends BaseLogic | @@ -192,6 +192,9 @@ class NewsLogic extends BaseLogic | ||
| 192 | if(isset($param['image'])){ | 192 | if(isset($param['image'])){ |
| 193 | $param['image'] = str_replace_url($param['image'] ?? ''); | 193 | $param['image'] = str_replace_url($param['image'] ?? ''); |
| 194 | } | 194 | } |
| 195 | + if(isset($param['og_image'])){ | ||
| 196 | + $param['og_image'] = str_replace_url($param['og_image'] ?? ''); | ||
| 197 | + } | ||
| 195 | if(isset($this->param['text'])){ | 198 | if(isset($this->param['text'])){ |
| 196 | $param['text'] = $this->handleText($this->param['text']); | 199 | $param['text'] = $this->handleText($this->param['text']); |
| 197 | } | 200 | } |
| @@ -357,6 +357,9 @@ class ProductLogic extends BaseLogic | @@ -357,6 +357,9 @@ class ProductLogic extends BaseLogic | ||
| 357 | $param['thumb'] = Arr::a2s([]); | 357 | $param['thumb'] = Arr::a2s([]); |
| 358 | $param['gallery'] = Arr::a2s([]); | 358 | $param['gallery'] = Arr::a2s([]); |
| 359 | } | 359 | } |
| 360 | + if(isset($param['og_image'])){ | ||
| 361 | + $param['og_image'] = str_replace_url($param['og_image'] ?? ''); | ||
| 362 | + } | ||
| 360 | if(isset($param['files'])){ | 363 | if(isset($param['files'])){ |
| 361 | $param['files']['url'] = str_replace_url($param['files']['url'] ?? ''); | 364 | $param['files']['url'] = str_replace_url($param['files']['url'] ?? ''); |
| 362 | $param['files'] = Arr::a2s($param['files'] ?? []); | 365 | $param['files'] = Arr::a2s($param['files'] ?? []); |
| @@ -29,7 +29,6 @@ class ProjectCountryLogic extends BaseLogic | @@ -29,7 +29,6 @@ class ProjectCountryLogic extends BaseLogic | ||
| 29 | } | 29 | } |
| 30 | $lists['country_lists'] = $this->countryListsFormat($lists['country_lists']); | 30 | $lists['country_lists'] = $this->countryListsFormat($lists['country_lists']); |
| 31 | $lists['country_sort'] = $this->countrySortFormat($lists['country_sort']); | 31 | $lists['country_sort'] = $this->countrySortFormat($lists['country_sort']); |
| 32 | - | ||
| 33 | return $this->success($lists); | 32 | return $this->success($lists); |
| 34 | } | 33 | } |
| 35 | 34 | ||
| @@ -116,12 +115,11 @@ class ProjectCountryLogic extends BaseLogic | @@ -116,12 +115,11 @@ class ProjectCountryLogic extends BaseLogic | ||
| 116 | } | 115 | } |
| 117 | 116 | ||
| 118 | protected function countrySortFormat($country_sort){ | 117 | protected function countrySortFormat($country_sort){ |
| 119 | - if(empty($country_sort)){ | ||
| 120 | $webLanguageModel = new WebLanguage(); | 118 | $webLanguageModel = new WebLanguage(); |
| 121 | - $all_language_ids = array_column($webLanguageModel->list([],'id',['id'],'asc'),'id'); | ||
| 122 | - $country_sort = implode(',',$all_language_ids); | 119 | + $idArr = $webLanguageModel->selectField(['id'=>['not in',explode(',',$country_sort)]],'id'); |
| 120 | + if(!empty($idArr)){ | ||
| 121 | + $country_sort = $country_sort.','.implode(',',$idArr); | ||
| 123 | } | 122 | } |
| 124 | - | ||
| 125 | return $country_sort; | 123 | return $country_sort; |
| 126 | } | 124 | } |
| 127 | } | 125 | } |
| @@ -29,13 +29,15 @@ class NoticeLog extends Base | @@ -29,13 +29,15 @@ class NoticeLog extends Base | ||
| 29 | * 创建日志 | 29 | * 创建日志 |
| 30 | * @param $type | 30 | * @param $type |
| 31 | * @param $data | 31 | * @param $data |
| 32 | + * @param $start_at | ||
| 32 | * @return mixed | 33 | * @return mixed |
| 33 | */ | 34 | */ |
| 34 | - public static function createLog($type, $data) | 35 | + public static function createLog($type, $data,$start_at=0) |
| 35 | { | 36 | { |
| 36 | $log = new self(); | 37 | $log = new self(); |
| 37 | $log->type = $type; | 38 | $log->type = $type; |
| 38 | $log->data = $data; | 39 | $log->data = $data; |
| 40 | + $log->start_at = $start_at ?: date('Y-m-d H:i:s'); | ||
| 39 | return $log->save(); | 41 | return $log->save(); |
| 40 | } | 42 | } |
| 41 | 43 |
| @@ -88,8 +88,10 @@ class GoogleLinkService | @@ -88,8 +88,10 @@ class GoogleLinkService | ||
| 88 | public function saveLink($data,$project_id,$domain){ | 88 | public function saveLink($data,$project_id,$domain){ |
| 89 | $saveData = []; | 89 | $saveData = []; |
| 90 | foreach ($data as $val){ | 90 | foreach ($data as $val){ |
| 91 | - $timestamp = strtotime($val['created_at']); | ||
| 92 | - $date = date('Y-m-d H:i:s', $timestamp ?? time()); | 91 | + $date = date('Y-m-d 00:00:00', time()); |
| 92 | + if($val['status'] != 1){ | ||
| 93 | + continue; | ||
| 94 | + } | ||
| 93 | $saveData[] = [ | 95 | $saveData[] = [ |
| 94 | 'url'=>$val['url'], | 96 | 'url'=>$val['url'], |
| 95 | 'moz_da'=>$val['mozDA'], | 97 | 'moz_da'=>$val['mozDA'], |
| @@ -97,11 +99,15 @@ class GoogleLinkService | @@ -97,11 +99,15 @@ class GoogleLinkService | ||
| 97 | 'google_search'=>$val['googlesearch'], | 99 | 'google_search'=>$val['googlesearch'], |
| 98 | 'date'=>$date, | 100 | 'date'=>$date, |
| 99 | 'project_id'=>$project_id, | 101 | 'project_id'=>$project_id, |
| 100 | - 'domain'=>$domain | 102 | + 'domain'=>$domain, |
| 103 | + 'url_domain'=>getDomain($val['url'] ?? '') | ||
| 101 | ]; | 104 | ]; |
| 102 | } | 105 | } |
| 103 | $linkModel = new GoogleLink(); | 106 | $linkModel = new GoogleLink(); |
| 107 | + if(!empty($saveData)){ | ||
| 108 | + $linkModel->del(['project_id'=>$project_id]); | ||
| 104 | $linkModel->insertAll($saveData); | 109 | $linkModel->insertAll($saveData); |
| 110 | + } | ||
| 105 | return $saveData; | 111 | return $saveData; |
| 106 | } | 112 | } |
| 107 | } | 113 | } |
| @@ -33,23 +33,31 @@ class RapIdApIService | @@ -33,23 +33,31 @@ class RapIdApIService | ||
| 33 | */ | 33 | */ |
| 34 | public function requestUrl($keyword){ | 34 | public function requestUrl($keyword){ |
| 35 | $this->url = 'https://google-keyword-insight1.p.rapidapi.com/globalkey'; | 35 | $this->url = 'https://google-keyword-insight1.p.rapidapi.com/globalkey'; |
| 36 | - $url = $this->url.'/?keyword='.$keyword.'&lang=en'; | ||
| 37 | - return $this->curlGoogleApi($url); | 36 | + $param = [ |
| 37 | + 'keyword'=>$keyword, | ||
| 38 | + 'location'=>'US', | ||
| 39 | + 'lang'=>'en' | ||
| 40 | + ]; | ||
| 41 | + $query_string = str_replace('+', '%20', http_build_query($param)); | ||
| 42 | + $url = $this->url.'/?'.$query_string; | ||
| 43 | + $data = $this->curlGoogleApi($url); | ||
| 44 | + return $data; | ||
| 38 | } | 45 | } |
| 39 | 46 | ||
| 40 | /** | 47 | /** |
| 41 | - * @remark :热门关键词拉取 | ||
| 42 | - * @name :requestKeywordUrl | 48 | + * @remark :备用数据 |
| 49 | + * @name :keywordResearch | ||
| 43 | * @author :lyh | 50 | * @author :lyh |
| 44 | * @method :post | 51 | * @method :post |
| 45 | - * @time :2025/3/27 16:57 | 52 | + * @time :2025/4/10 10:23 |
| 46 | */ | 53 | */ |
| 47 | - public function requestKeywordUrl($keyword){ | ||
| 48 | - $this->url = 'https://google-keyword-insight1.p.rapidapi.com/topkeys'; | ||
| 49 | - $url = $this->url.'/?keyword='.$keyword.'&location=US&&lang=en'; | 54 | + public function keywordResearch($keyword){ |
| 55 | + $this->url = 'https://seo-keyword-research.p.rapidapi.com/keynew.php'; | ||
| 56 | + $param = ["keyword" => $keyword, 'country' => 'us']; | ||
| 57 | + $query_string = str_replace('+', '%20', http_build_query($param)); | ||
| 58 | + $url = $this->url.'/?'.$query_string; | ||
| 50 | return $this->curlGoogleApi($url); | 59 | return $this->curlGoogleApi($url); |
| 51 | } | 60 | } |
| 52 | - | ||
| 53 | /** | 61 | /** |
| 54 | * @remark :请求 | 62 | * @remark :请求 |
| 55 | * @name :curlGoogleApi | 63 | * @name :curlGoogleApi |
-
请 注册 或 登录 后发表评论