作者 邓超

Merge branch 'develop' into dc

正在显示 49 个修改的文件 包含 1637 行增加125 行删除
  1 +<?php
  2 +
  3 +namespace App\Console\Commands\AyrShare;
  4 +
  5 +use App\Helper\AyrShare as AyrShareHelper;
  6 +use App\Models\AyrShare\AyrShare as AyrShareModel;
  7 +use Illuminate\Console\Command;
  8 +
  9 +class ShareConfig extends Command
  10 +{
  11 + public $error = 0;
  12 + /**
  13 + * The name and signature of the console command.
  14 + *
  15 + * @var string
  16 + */
  17 + protected $signature = 'share_config';
  18 +
  19 + /**
  20 + * The console command description.
  21 + *
  22 + * @var string
  23 + */
  24 + protected $description = '更新用户Ayr_share配置';
  25 + /**
  26 + * @name :(定时执行更新用户配置)handle
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2023/5/12 14:48
  30 + */
  31 + public function handle()
  32 + {
  33 + $ayrShareModel = new AyrShareModel();
  34 + //更新用户配置
  35 + $lists = $ayrShareModel->lists($this->map,$this->page,$this->row,'id',['id','profile_key','bind_plat_from']);
  36 + foreach ($lists['list'] as $k => $v){
  37 + if(empty($v['profile_key'])){
  38 + continue;
  39 + }
  40 + //获取当前用户配置
  41 + $ayrShareHelper = new AyrShareHelper();
  42 + $share_info = $ayrShareHelper->get_profiles_users($v['profile_key']);
  43 + if(!isset($share_info['activeSocialAccounts'])){
  44 + continue;
  45 + }
  46 + $str = json_encode($share_info['activeSocialAccounts']);
  47 + if($str != $v['bind_plat_from']){
  48 + $rs = $ayrShareModel->edit(['bind_plat_from'=>$str],['id'=>$v['id']]);
  49 + if($rs === false){
  50 + $this->error++;
  51 + }
  52 + }
  53 + }
  54 + echo $this->error;
  55 + }
  56 +}
  1 +<?php
  2 +
  3 +namespace App\Console\Commands\AyrShare;
  4 +use App\Helper\AyrShare as AyrShareHelper;
  5 +use App\Models\AyrShare\AyrRelease as AyrReleaseModel;
  6 +use Carbon\Carbon;
  7 +use App\Models\AyrShare\AyrShare as AyrShareModel;
  8 +use Illuminate\Console\Command;
  9 +
  10 +class ShareUser extends Command
  11 +{
  12 + public $error = 0;
  13 + /**
  14 + * The name and signature of the console command.
  15 + *
  16 + * @var string
  17 + */
  18 + protected $signature = 'share_user';
  19 +
  20 + /**
  21 + * The console command description.
  22 + *
  23 + * @var string
  24 + */
  25 + protected $description = '用户一周内无记录清除Ayr_share';
  26 + /**
  27 + * @name :(定时执行)handle
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2023/5/12 14:48
  31 + */
  32 + public function handle()
  33 + {
  34 + echo $this->user_operator_record();
  35 + }
  36 +
  37 + /**
  38 + * @name : 检测用户是否无操作记录
  39 + * @author :lyh
  40 + * @method :post
  41 + * @time :2023/5/12 14:55
  42 + */
  43 + protected function user_operator_record(){
  44 + //获取所有ayr_share用户
  45 + $ayr_share_model = new AyrShareModel();
  46 + $ayr_share_list = $ayr_share_model->list();
  47 + foreach ($ayr_share_list as $k => $v){
  48 + //查询当前用户是否有未推送的博文
  49 + $ayr_release = new AyrReleaseModel();
  50 + $release_info = $ayr_release->read(['idempotency_key'=>['>',date('Y-m-d H:i:s',time())],'share_id'=>$v['id']]);
  51 + //有推文时,直接跳出循环
  52 + if($release_info !== false){
  53 + continue;
  54 + }
  55 + //查看用户是否在一周内有发送博客
  56 + $start_at = Carbon::now()->modify('-7 days')->toDateString();
  57 + $end_at = Carbon::now()->toDateString();
  58 + $release_info = $ayr_release->read(['created_at'=>['between',[$start_at,$end_at]]]);
  59 + //有发送博文,则跳出循环
  60 + if($release_info == false){
  61 + continue;
  62 + }
  63 + //删除用户第三方配置
  64 + $ayr_share_helper = new AyrShareHelper();
  65 + $res = $ayr_share_helper->deleted_profiles();
  66 + if($res['status'] == 'fail'){
  67 + $this->error++;
  68 + continue;
  69 + }
  70 + //更新数据库
  71 + $data = [
  72 + 'title'=>null,
  73 + 'bind_plat_from'=>null,
  74 + 'profile_key'=>null,
  75 + 'ref_id'=>null,
  76 + ];
  77 + $res = $ayr_share_model->edit($data,['id'=>$v['id']]);
  78 + if($res == false){
  79 + $this->error++;
  80 + }
  81 + }
  82 + return $this->error;
  83 + }
  84 +}
  1 +<?php
  2 +
  3 +namespace App\Console\Commands\RankData;
  4 +
  5 +use Illuminate\Console\Command;
  6 +
  7 +/**
  8 + * Class BaseCommands
  9 + * @package App\Console\Commands\RankData
  10 + * @author zbj
  11 + * @date 2023/5/11
  12 + */
  13 +abstract class BaseCommands extends Command
  14 +{
  15 + /**
  16 + * @author zbj
  17 + * @date 2023/5/11
  18 + */
  19 + public function handle()
  20 + {
  21 + $try = 3;
  22 + do{
  23 + $try--;
  24 + if($try == 0){
  25 + break;
  26 + }
  27 +
  28 + $error = 0;
  29 + try {
  30 + if(!$this->do()){
  31 + $error = 1;
  32 + }
  33 + }catch (\Exception $e){
  34 + errorLog($this->signature . ' error', [], $e);
  35 + $error = 1;
  36 + }
  37 +
  38 + if($error){
  39 + echo 'error';
  40 + }
  41 + $error && sleep(60);
  42 + }while($error);
  43 + }
  44 +
  45 + abstract function do();
  46 +}
  1 +<?php
  2 +
  3 +namespace App\Console\Commands\RankData;
  4 +
  5 +use App\Helper\Arr;
  6 +use App\Helper\SemrushApi;
  7 +use App\Models\RankData\ExternalLinks as ExternalLinksModel;
  8 +use App\Models\Project\DeployOptimize;
  9 +
  10 +/**
  11 + * Class ExternalLinks
  12 + * @package App\Console\Commands
  13 + * @author zbj
  14 + * @date 2023/5/9
  15 + */
  16 +class ExternalLinks extends BaseCommands
  17 +{
  18 + /**
  19 + * The name and signature of the console command.
  20 + *
  21 + * @var string
  22 + */
  23 + protected $signature = 'rank_data_external_links';
  24 +
  25 + /**
  26 + * The console command description.
  27 + *
  28 + * @var string
  29 + */
  30 + protected $description = '排名数据-外链数据';
  31 +
  32 + /**
  33 + * @author zbj
  34 + * @date 2023/5/6
  35 + */
  36 + public function do()
  37 + {
  38 + $error = 0;
  39 + $semrushApi = new SemrushApi();
  40 + //有排名api编号的项目
  41 + $list = DeployOptimize::where('api_no', '>', 0)->pluck('domain', 'project_id')->toArray();
  42 +
  43 + foreach ($list as $project_id => $domain) {
  44 + if(!$domain){
  45 + continue;
  46 + }
  47 + $model = ExternalLinksModel::where('project_id', $project_id)->first();
  48 + if ($model && $model->updated_date == getThisWeekStarDate()) {
  49 + continue;
  50 + }
  51 + if (!$model) {
  52 + $model = new ExternalLinksModel();
  53 + }
  54 +
  55 + //外链数据
  56 + $res = $semrushApi->backlinks_overview($domain);
  57 + if (!$res) {
  58 + $error++;
  59 + continue;
  60 + }
  61 +
  62 + $data = $this->_data($project_id, $res['total']);
  63 +
  64 + $model->project_id = $project_id;
  65 + $model->total = $data['total'];
  66 + $model->data = $data['data'];
  67 + $model->updated_date = date('Y-m-d');
  68 + $model->save();
  69 + }
  70 + return !$error;
  71 + }
  72 +
  73 +
  74 + /**
  75 + * 构造chat数据
  76 + * @param $project_id
  77 + * @param $total
  78 + * @return array|mixed
  79 + * @author zbj
  80 + * @date 2023/5/10
  81 + */
  82 + public function _data($project_id, $total)
  83 + {
  84 + // //外链数
  85 + $data['total'] = intval($total);
  86 + $model = ExternalLinksModel::where('project_id', $project_id)->first();
  87 + if ($model) {
  88 + //特殊处理的外链数
  89 +// $data['total'] = ($total > $model->total) ? intval($total) : $model->total; //特殊处理的
  90 +
  91 + //chat数据
  92 + $chat_data = Arr::s2a($model['data']);
  93 + if (empty($chat_data[date('Y-m-d')])) {
  94 + array_shift($chat_data);
  95 + }
  96 + } else {
  97 + //chat数据
  98 + for ($i = 1; $i < 12; $i++) {
  99 + $date = date("Y-m-d", strtotime(-7 * $i . 'days'));
  100 + $chat_data[$date] = ceil($total - ($total * rand(5, 10) / 100));
  101 + }
  102 + }
  103 + $chat_data[date('Y-m-d')] = $data['total'];
  104 + $data['data'] = $chat_data;
  105 + return $data;
  106 + }
  107 +
  108 +}
  1 +<?php
  2 +
  3 +namespace App\Console\Commands\RankData;
  4 +
  5 +use App\Helper\QuanqiusouApi;
  6 +use App\Models\Project\DeployOptimize;
  7 +use App\Models\RankData\IndexedPages as IndexedPagesModel;
  8 +
  9 +/**
  10 + * Class IndexedPages
  11 + * @package App\Console\Commands
  12 + * @author zbj
  13 + * @date 2023/5/11
  14 + */
  15 +class IndexedPages extends BaseCommands
  16 +{
  17 + /**
  18 + * The name and signature of the console command.
  19 + *
  20 + * @var string
  21 + */
  22 + protected $signature = 'rank_data_indexed_pages';
  23 +
  24 + /**
  25 + * The console command description.
  26 + *
  27 + * @var string
  28 + */
  29 + protected $description = '排名数据-页面收录数';
  30 +
  31 + /**
  32 + * @throws \Exception
  33 + * @author zbj
  34 + * @date 2023/5/11
  35 + */
  36 + public function do(){
  37 + $error = 0;
  38 + $api = new QuanqiusouApi();
  39 + //有排名api编号的项目
  40 + $list = DeployOptimize::where('api_no', '>', 0)->pluck('api_no', 'project_id')->toArray();
  41 +
  42 + foreach ($list as $project_id => $api_no) {
  43 + $model = IndexedPagesModel::where('project_id', $project_id)->first();
  44 + if($model && $model->updated_date == getThisWeekStarDate()){
  45 + continue;
  46 + }
  47 +
  48 + if(!$model){
  49 + $model = new IndexedPagesModel();
  50 + }
  51 +
  52 + $res = $api->getSiteResPer($api_no);
  53 + if(!$res){
  54 + $error++;
  55 + continue;
  56 + }
  57 +
  58 + $model->project_id = $project_id;
  59 + $model->data = $res['data'];
  60 + $model->updated_date = date('Y-m-d');
  61 + $model->save();
  62 + }
  63 +
  64 + return !$error;
  65 + }
  66 +
  67 +}
  1 +<?php
  2 +
  3 +namespace App\Console\Commands\RankData;
  4 +
  5 +use App\Helper\Arr;
  6 +use App\Helper\QuanqiusouApi;
  7 +use App\Models\Project\DeployBuild;
  8 +use App\Models\Project\DeployOptimize;
  9 +use App\Models\RankData\RankData as GoogleRankModel;
  10 +
  11 +/**
  12 + * Class GoogleRank
  13 + * @package App\Console\Commands
  14 + * @author zbj
  15 + * @date 2023/5/6
  16 + */
  17 +class RankData extends BaseCommands
  18 +{
  19 + /**
  20 + * The name and signature of the console command.
  21 + *
  22 + * @var string
  23 + */
  24 + protected $signature = 'rank_data';
  25 +
  26 + /**
  27 + * The console command description.
  28 + *
  29 + * @var string
  30 + */
  31 + protected $description = '谷歌排名数据';
  32 +
  33 + /**
  34 + * @author zbj
  35 + * @date 2023/5/6
  36 + */
  37 + public function do()
  38 + {
  39 + $error = 0;
  40 + $api = new QuanqiusouApi();
  41 + //有排名api编号的项目
  42 + $list = DeployOptimize::where('api_no', '>' , 0)->select('api_no','minor_languages','project_id')->get();
  43 + //当日所有站点谷歌收录数据
  44 + $site_res = $api->getSiteRes();
  45 + if(!$site_res){
  46 + return false;
  47 + }
  48 +
  49 + foreach ($list as $item){
  50 + $model = GoogleRankModel::where('project_id', $item['project_id'])->where('lang', '')->first();
  51 + if (!$model || $model->updated_date == date('Y-m-d')) {
  52 + $res = $api->getGoogleRank($item['api_no']);
  53 + if(!$res){
  54 + $error++;
  55 + continue;
  56 + }
  57 + //收录数
  58 + $indexed_pages_num = $site_res[$item['api_no']];
  59 +
  60 + $this->save_rank($item['project_id'], $res, $indexed_pages_num);
  61 + }
  62 +
  63 + //有小语种的
  64 + if($item['minor_languages']){
  65 + $model = GoogleRankModel::where('project_id', $item['project_id'])->where('lang', '<>', '')->first();
  66 + if (!$model || $model->updated_date == date('Y-m-d')) {
  67 + $res = $api->getGoogleRank($item['api_no'], 1);
  68 + if(!$res){
  69 + $error++;
  70 + continue;
  71 + }
  72 + $data = [];
  73 + //不同的小语种取出来
  74 + foreach ($res as $keyword => $v){
  75 + $data[Arr::last($v)['lang']][$keyword] = $v;
  76 + }
  77 + foreach ($data as $lang => $rank){
  78 + $this->save_rank($item['project_id'], $rank, 0, $lang);
  79 + }
  80 + }
  81 + }
  82 + }
  83 + return !$error;
  84 + }
  85 +
  86 + /**
  87 + * @param $project_id
  88 + * @param int $indexed_pages_num
  89 + * @param $data
  90 + * @param string $lang
  91 + * @author zbj
  92 + * @date 2023/5/8
  93 + */
  94 + public function save_rank($project_id, $data, int $indexed_pages_num = 0, string $lang = ''){
  95 + $without_project_ids = []; //不用处理排名的项目
  96 +
  97 + $first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0;
  98 +
  99 + if(!$lang){
  100 + foreach ($data as &$ranks){
  101 + foreach ($ranks as &$rank){
  102 + //处理排名
  103 + if(!in_array($project_id, $without_project_ids)){
  104 + if($rank['position'] >= 10){
  105 + $rank['position'] -= 5;
  106 + }
  107 + //todo 需要特殊处理排名的项目
  108 + }
  109 + }
  110 + $last = Arr::last($ranks);
  111 + //第一名
  112 + if($last['position'] == 1){
  113 + $first_num ++;
  114 + }
  115 + //排名第一页
  116 + if($last['position'] > 0 && $last['position'] <= 10){
  117 + $first_page_num ++;
  118 + }
  119 + //排名前三页
  120 + if($last['position'] > 0 && $last['position'] <= 30){
  121 + $first_three_pages_num ++;
  122 + }
  123 + //排名前五页
  124 + if($last['position'] > 0 && $last['position'] <= 50){
  125 + $first_five_pages_num ++;
  126 + }
  127 + //排名前十页
  128 + if($last['position'] > 0 && $last['position'] <= 100){
  129 + $first_ten_pages_num ++;
  130 + }
  131 + }
  132 + }
  133 +
  134 + $where = [
  135 + 'project_id' => $project_id,
  136 + 'lang' => $lang
  137 + ];
  138 + $model = GoogleRankModel::where($where)->first();
  139 + if(!$model){
  140 + $model = new GoogleRankModel();
  141 + }
  142 +
  143 + //关键词达标天数
  144 + if($model->updated_date != date('Y-m-d')){
  145 + //保证关键词数
  146 + $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');
  147 + if($first_page_num >= $keyword_num){
  148 + $model->compliance_day = $model->compliance_day + 1;
  149 + }
  150 + }
  151 +
  152 + $model->project_id = $project_id;
  153 + $model->first_num = $first_num;
  154 + $model->first_page_num = $first_page_num;
  155 + $model->first_three_pages_num = $first_three_pages_num;
  156 + $model->first_five_pages_num = $first_five_pages_num;
  157 + $model->first_ten_pages_num = $first_ten_pages_num;
  158 + $model->indexed_pages_num = $indexed_pages_num;
  159 + $model->lang = $lang;
  160 + $model->data = $data;
  161 + $model->updated_date = date('Y-m-d');
  162 + $model->save();
  163 + }
  164 +}
  1 +<?php
  2 +
  3 +namespace App\Console\Commands\RankData;
  4 +
  5 +
  6 +use App\Helper\Arr;
  7 +use App\Helper\QuanqiusouApi;
  8 +use App\Models\Project\DeployOptimize;
  9 +use App\Models\RankData\RankWeek as RankWeekModel;
  10 +
  11 +/**
  12 + * Class WeekRank
  13 + * @package App\Console\Commands
  14 + * @author zbj
  15 + * @date 2023/5/11
  16 + */
  17 +class RankWeek extends BaseCommands
  18 +{
  19 + /**
  20 + * The name and signature of the console command.
  21 + *
  22 + * @var string
  23 + */
  24 + protected $signature = 'rank_data_week';
  25 +
  26 + /**
  27 + * The console command description.
  28 + *
  29 + * @var string
  30 + */
  31 + protected $description = '排名数据-每周排名数据';
  32 +
  33 + /**
  34 + * @author zbj
  35 + * @date 2023/5/6
  36 + */
  37 + public function do()
  38 + {
  39 + $error = 0;
  40 +
  41 + //获取每周排名数据
  42 + $api = new QuanqiusouApi();
  43 +
  44 + $res = $api->getGoogleRankWeek();
  45 + if (!$res) {
  46 + return false;
  47 + }
  48 +
  49 + $res = Arr::s2a($res);
  50 + //有排名api编号的项目
  51 + $list = DeployOptimize::where('api_no', '>', 0)->pluck('api_no', 'project_id')->toArray();
  52 +
  53 + foreach ($list as $project_id => $api_no) {
  54 + $rank_week = RankWeekModel::where('project_id', $project_id)->first();
  55 + if ($rank_week && $rank_week->updated_date == getThisWeekStarDate()) {
  56 + //本周数据已更新
  57 + continue;
  58 + }
  59 +
  60 + if (!$rank_week) {
  61 + $rank_week = new RankWeekModel();
  62 + }
  63 +
  64 + $rank_week->project_id = $project_id;
  65 + $rank_week->data = $res['data'][$api_no];
  66 + $rank_week->date = $res['date'];
  67 + $rank_week->updated_date = date('Y-m-d');
  68 + $rank_week->save();
  69 + }
  70 +
  71 + return !$error;
  72 + }
  73 +}
  1 +<?php
  2 +
  3 +namespace App\Console\Commands\RankData;
  4 +
  5 +use App\Helper\SemrushApi;
  6 +use App\Models\RankData\RecommDomain as RecommDomainModel;
  7 +use App\Models\Project\DeployOptimize;
  8 +
  9 +/**
  10 + * Class RecommDomain
  11 + * @package App\Console\Commands
  12 + * @author zbj
  13 + * @date 2023/5/9
  14 + */
  15 +class RecommDomain extends BaseCommands
  16 +{
  17 + /**
  18 + * The name and signature of the console command.
  19 + *
  20 + * @var string
  21 + */
  22 + protected $signature = 'rank_data_recomm_domain';
  23 +
  24 + /**
  25 + * The console command description.
  26 + *
  27 + * @var string
  28 + */
  29 + protected $description = '排名数据-外链引荐域名数据';
  30 +
  31 + /**
  32 + * @author zbj
  33 + * @date 2023/5/6
  34 + */
  35 + public function do()
  36 + {
  37 + $error = 0;
  38 + $semrushApi = new SemrushApi();
  39 + //有排名api编号的项目
  40 + $list = DeployOptimize::where('api_no', '>', 0)->pluck('domain', 'project_id')->toArray();
  41 +
  42 + foreach ($list as $project_id => $domain) {
  43 + if(!$domain){
  44 + continue;
  45 + }
  46 + $model = RecommDomainModel::where('project_id', $project_id)->first();
  47 + if ($model && $model->updated_date == getThisWeekStarDate()) {
  48 + continue;
  49 + }
  50 + if (!$model) {
  51 + $model = new RecommDomainModel();
  52 + }
  53 +
  54 + //外链引荐域名
  55 + $data = $semrushApi->backlinks_refdomains($domain);
  56 + if (!$data) {
  57 + $error++;
  58 + continue;
  59 + }
  60 +
  61 + $model->project_id = $project_id;
  62 + $model->data = $data;
  63 + $model->updated_date = date('Y-m-d');
  64 + $model->save();
  65 + }
  66 + return !$error;
  67 + }
  68 +}
  1 +<?php
  2 +
  3 +namespace App\Console\Commands\RankData;
  4 +
  5 +use App\Helper\Arr;
  6 +use App\Helper\GoogleSpeedApi;
  7 +use App\Models\Project\DeployOptimize;
  8 +use App\Models\RankData\Speed as GoogleSpeedModel;
  9 +
  10 +/**
  11 + * Class GoogleSpeed
  12 + * @package App\Console\Commands
  13 + * @author zbj
  14 + * @date 2023/5/10
  15 + */
  16 +class Speed extends BaseCommands
  17 +{
  18 + /**
  19 + * The name and signature of the console command.
  20 + *
  21 + * @var string
  22 + */
  23 + protected $signature = 'rank_data_speed';
  24 +
  25 + /**
  26 + * The console command description.
  27 + *
  28 + * @var string
  29 + */
  30 + protected $description = '排名数据-测速数据';
  31 +
  32 +
  33 + /**
  34 + * @author zbj
  35 + * @date 2023/5/10
  36 + */
  37 + public function do()
  38 + {
  39 + $error = 0;
  40 +
  41 + $googleSpeedApi = new GoogleSpeedApi();
  42 +
  43 + //有排名api编号的项目
  44 + $list = DeployOptimize::where('api_no', '>', 0)->pluck('domain', 'project_id')->toArray();
  45 +
  46 + foreach ($list as $project_id => $domain) {
  47 + $model = GoogleSpeedModel::where('project_id', $project_id)->first();
  48 + if ($model && $model->updated_date == getThisWeekStarDate()) {
  49 + //今周已更新 跳过
  50 + continue;
  51 + }
  52 +
  53 + $res = $googleSpeedApi->run($domain);
  54 + if (!$res) {
  55 + $error++;
  56 + }
  57 + if (!$model) {
  58 + $model = new GoogleSpeedModel;
  59 + }
  60 + $model->project_id = $project_id;
  61 + $model->data = $res;
  62 + $model->updated_date = date('Y-m-d');
  63 + $model->save();
  64 + }
  65 +
  66 + return !$error;
  67 + }
  68 +}
@@ -16,6 +16,13 @@ class Kernel extends ConsoleKernel @@ -16,6 +16,13 @@ class Kernel extends ConsoleKernel
16 protected function schedule(Schedule $schedule) 16 protected function schedule(Schedule $schedule)
17 { 17 {
18 // $schedule->command('inspire')->hourly(); 18 // $schedule->command('inspire')->hourly();
  19 + $schedule->command('rank_data')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次
  20 + $schedule->command('rank_data_speed')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次
  21 + $schedule->command('rank_data_external_links')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次
  22 + $schedule->command('rank_data_indexed_pages')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次
  23 + $schedule->command('rank_data_recomm_domain')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次
  24 + $schedule->command('rank_data_week')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次
  25 + $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次
19 } 26 }
20 27
21 /** 28 /**
@@ -68,7 +68,7 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K @@ -68,7 +68,7 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K
68 public function deleted_profiles($data){ 68 public function deleted_profiles($data){
69 $param = [ 69 $param = [
70 'title'=>$data['title'], 70 'title'=>$data['title'],
71 -// 'profileKey'=>$this->profile_key, 71 + 'profileKey'=>$data['profileKey'],
72 ]; 72 ];
73 $url = $this->path.'/api/profiles/profile'; 73 $url = $this->path.'/api/profiles/profile';
74 return $this->http_click('delete',$url,$param); 74 return $this->http_click('delete',$url,$param);
  1 +<?php
  2 +
  3 +
  4 +namespace App\Helper;
  5 +
  6 +use App\Utils\HttpUtils;
  7 +use GuzzleHttp\Exception\GuzzleException;
  8 +
  9 +
  10 +/**
  11 + * Class PageSpeed
  12 + * @package App\Helper
  13 + * @author zbj
  14 + * @date 2023/5/10
  15 + */
  16 +class GoogleSpeedApi
  17 +{
  18 +
  19 + protected $areas = [
  20 + [
  21 + "area" => "洛杉矶",
  22 + "numericValue" => 0,
  23 + ],
  24 + [
  25 + "area" => "圣地亚哥",
  26 + "numericValue" => 0,
  27 + ],
  28 + [
  29 + "area" => "伦敦",
  30 + "numericValue" => 0,
  31 + ],
  32 + [
  33 + "area" => "西雅图",
  34 + "numericValue" => 0,
  35 + ],
  36 + [
  37 + "area" => "吉隆坡",
  38 + "numericValue" => 0,
  39 + ],
  40 + [
  41 + "area" => "雅加达",
  42 + "numericValue" => 0,
  43 + ],
  44 + [
  45 + "area" => "孟买",
  46 + "numericValue" => 0,
  47 + ],
  48 + [
  49 + "area" => "迪拜",
  50 + "numericValue" => 0,
  51 + ],
  52 + [
  53 + "area" => "法兰克福",
  54 + "numericValue" => 0,
  55 + ],
  56 + [
  57 + "area" => "新加坡",
  58 + "numericValue" => 0,
  59 + ],
  60 + [
  61 + "area" => "悉尼",
  62 + "numericValue" => 0,
  63 + ],
  64 + [
  65 + "area" => "东京",
  66 + "numericValue" => 0,
  67 + ],
  68 + [
  69 + "area" => "硅谷",
  70 + "numericValue" => 0,
  71 + ],
  72 + [
  73 + "area" => "弗吉尼亚",
  74 + "numericValue" => 0,
  75 + ],
  76 + [
  77 + "area" => "香港",
  78 + "numericValue" => 0,
  79 + ],
  80 + [
  81 + "area" => "圣保罗",
  82 + "numericValue" => 0,
  83 + ],
  84 + [
  85 + "area" => "雅典",
  86 + "numericValue" => 0,
  87 + ],
  88 + [
  89 + "area" => "巴黎",
  90 + "numericValue" => 0,
  91 + ],
  92 + [
  93 + "area" => "罗马",
  94 + "numericValue" => 0,
  95 + ],
  96 + [
  97 + "area" => "马德里",
  98 + "numericValue" => 0,
  99 + ],
  100 + ];
  101 +
  102 + /**
  103 + * @param $url
  104 + * @return array|false
  105 + * @author zbj
  106 + * @date 2023/5/10
  107 + */
  108 + function run($url)
  109 + {
  110 + try {
  111 + $params = [
  112 + 'url' => $url
  113 + ];
  114 + $res = HttpUtils::get('http://45.136.131.72/api.php', $params);
  115 + if ($res) {
  116 + $res = Arr::s2a($res);
  117 + $area_data = Arr::s2a($res['area_data']);
  118 + }
  119 + $numericValue = $area_data[0]['numericValue'] ?? rand(500, 1000);
  120 + foreach ($this->areas as &$area) {
  121 + $start = -$numericValue * 0.5;
  122 + $end = $numericValue * 0.5;
  123 + $numer = rand($start, $end);
  124 + $area["numericValue"] = ceil($numericValue - $numer);
  125 + }
  126 +
  127 + return [
  128 + "url" => $url,
  129 + "area_data" => $this->areas,
  130 + "created_at" => date("Y-m-d H:i:s")
  131 + ];
  132 +
  133 + } catch (\Exception | GuzzleException $e) {
  134 + errorLog('测速失败', $params, $e);
  135 + return false;
  136 + }
  137 + }
  138 +}
  1 +<?php
  2 +
  3 +
  4 +namespace App\Helper;
  5 +
  6 +use App\Utils\HttpUtils;
  7 +use GuzzleHttp\Exception\GuzzleException;
  8 +use Illuminate\Support\Facades\Cache;
  9 +
  10 +
  11 +/**
  12 + * Class QuanqiusouApi
  13 + * @package App\Helper
  14 + * @author zbj
  15 + * @date 2023/5/11
  16 + */
  17 +class QuanqiusouApi
  18 +{
  19 + //接口地址
  20 + protected $url = 'http://api.quanqiusou.cn';
  21 +
  22 + /**
  23 + * 所有站点收录页面数
  24 + * @author zbj
  25 + * @date 2023/5/11
  26 + */
  27 + public function getSiteRes()
  28 + {
  29 + $key = 'quanqiusou_api_site_res_' . date('Y-m-d');
  30 + $res = Cache::get($key);
  31 + if (!$res) {
  32 + $api_url = $this->url . '/google-rank/echo_site_res.php';
  33 + try {
  34 + $res = HttpUtils::get($api_url, []);
  35 + if($res){
  36 + $res = Arr::s2a($res);
  37 + Cache::put($key, $res, 24 * 3600);
  38 + }
  39 + } catch (\Exception | GuzzleException $e) {
  40 + errorLog('获取站点收录页面数', [], $e);
  41 + return false;
  42 + }
  43 + }
  44 + return $res;
  45 + }
  46 +
  47 + /**
  48 + * 指定站点收录页面数
  49 + * @param $api_no
  50 + * @return array|false|mixed
  51 + * @author zbj
  52 + * @date 2023/5/11
  53 + */
  54 + public function getSiteResPer($api_no){
  55 + $key = 'quanqiusou_api_site_res_per_' . $api_no . '_' . date('Y-m-d');
  56 + $res = Cache::get($key);
  57 + if (!$res) {
  58 + $api_url = $this->url . '/google-rank/echo_site_res_per.php';
  59 + try {
  60 + $res = HttpUtils::get($api_url, ['apino' => $api_no]);
  61 + if($res){
  62 + $res = Arr::s2a($res);
  63 + Cache::put($key, $res, 24 * 3600);
  64 + }
  65 + } catch (\Exception | GuzzleException $e) {
  66 + errorLog('获取站点收录页面数', [], $e);
  67 + return false;
  68 + }
  69 + }
  70 + return $res;
  71 + }
  72 +
  73 +
  74 + /**
  75 + * 获取谷歌排名数据
  76 + * @param $api_no
  77 + * @param int $lang
  78 + * @param int $day
  79 + * @return array|false|mixed
  80 + * @author zbj
  81 + * @date 2023/5/11
  82 + */
  83 + public function getGoogleRank($api_no, int $lang = 0, int $day = 7)
  84 + {
  85 + $key = "quanqiusou_api_rank_{$api_no}_{$lang}_{$day}_" . date('Y-m-d');
  86 + $res = Cache::get($key);
  87 + if (!$res) {
  88 + $param = [
  89 + 'key' => '289c1fc81c89d79c04ed4fd72822948e',
  90 + 'w' => $api_no,
  91 + 'type' => $day
  92 + ];
  93 + if ($lang) {
  94 + $param['lang'] = $lang;
  95 + }
  96 +
  97 + $api_url = $this->url . '/api';
  98 +
  99 + try {
  100 + $res = HttpUtils::get($api_url, $param);
  101 + if($res){
  102 + $res = Arr::s2a($res);
  103 + Cache::put($key, $res, 24 * 3600);
  104 + }
  105 + } catch (\Exception | GuzzleException $e) {
  106 + errorLog('获取谷歌排名数据失败', $api_no, $e);
  107 + return false;
  108 + }
  109 + }
  110 +
  111 + return $res;
  112 + }
  113 +
  114 + /**
  115 + * 获取每周谷歌排名数据
  116 + * @return array|false|mixed
  117 + * @author zbj
  118 + * @date 2023/5/11
  119 + */
  120 + public function getGoogleRankWeek()
  121 + {
  122 + $key = "quanqiusou_api_week_data_" . date('Y-m-d');
  123 + $res = Cache::get($key);
  124 + if (!$res) {
  125 + $api_url = $this->url . '/google-rank/echo_week_data.php';
  126 + try {
  127 + $res = HttpUtils::get($api_url, []);
  128 + if($res){
  129 + $res = Arr::s2a($res);
  130 + Cache::put($key, $res, 24 * 3600);
  131 + }
  132 + } catch (\Exception | GuzzleException $e) {
  133 + errorLog('获取每周谷歌排名数据失败', [], $e);
  134 + return false;
  135 + }
  136 + }
  137 + return $res;
  138 + }
  139 +
  140 +}
  1 +<?php
  2 +
  3 +
  4 +namespace App\Helper;
  5 +
  6 +use App\Utils\HttpUtils;
  7 +use GuzzleHttp\Exception\GuzzleException;
  8 +
  9 +
  10 +/**
  11 + * Class SemrushApi
  12 + * @package App\Helper
  13 + * @author zbj
  14 + * @date 2023/5/9
  15 + */
  16 +class SemrushApi
  17 +{
  18 + //接口地址
  19 + protected $url = 'https://api.semrush.com';
  20 +
  21 + protected $key = '2927058317c47207e4a8c4cacf10acfd';
  22 +
  23 + /**
  24 + * 反链概述
  25 + */
  26 + function backlinks_overview($target,$target_type = "root_domain"){
  27 + if($target){
  28 + $url = $this->url."/analytics/v1/?";
  29 + $params = [
  30 + "type"=>"backlinks_overview",
  31 + "key"=>$this->key,
  32 + "target"=>$target,
  33 + "target_type"=>$target_type,
  34 + "export_columns"=>"ascore,total,domains_num,urls_num,ips_num,ipclassc_num,follows_num,nofollows_num,sponsored_num,ugc_num,texts_num,images_num,forms_num,frames_num"
  35 + ];
  36 + try {
  37 + $res = HttpUtils::get($url, $params);
  38 + return $this->data($res)[0];
  39 + }catch (\Exception|GuzzleException $e){
  40 + errorLog('获取站点外链数据', $params, $e);
  41 + return false;
  42 + }
  43 + }
  44 + return [];
  45 + }
  46 +
  47 + /**
  48 + * 引荐域名
  49 + */
  50 + public function backlinks_refdomains($target,$target_type = "root_domain",$offset = 0){
  51 + if($target){
  52 + $url = $this->url."/analytics/v1/?";
  53 + $params = [
  54 + "type"=>"backlinks_refdomains",
  55 + "key"=>$this->key,
  56 + "target"=>$target,
  57 + "target_type"=>$target_type,
  58 + "export_columns"=>"domain_ascore,domain,backlinks_num,ip,country,first_seen,last_seen",
  59 + "display_limit"=>10,
  60 + "display_offset"=>$offset
  61 + ];
  62 + try {
  63 + $res = HttpUtils::get($url, $params);
  64 + return $this->data($res);
  65 + }catch (\Exception|GuzzleException $e){
  66 + errorLog('获取站点外链数据', $params, $e);
  67 + return false;
  68 + }
  69 + }
  70 + return [];
  71 + }
  72 +
  73 +
  74 + /**
  75 + * 处理结果
  76 + * @param $res
  77 + * @return array
  78 + * @author zbj
  79 + * @date 2023/5/9
  80 + */
  81 + protected function data($res){
  82 + $temp = explode("\n",$res);
  83 +
  84 + $arr =array_map(function ($v){
  85 + return explode(";",$v);
  86 + }, $temp);
  87 + $data = [];
  88 +
  89 + for ($i = 1; $i < count($arr) - 1; $i++) {
  90 + $tmp = [];
  91 + foreach($arr[0] as $k =>$v){
  92 + $tmp[trim($v)] = trim($arr[$i][$k]);
  93 + }
  94 + $data[] = $tmp;
  95 + }
  96 + return $data;
  97 + }
  98 +
  99 +}
1 <?php 1 <?php
2 2
3 use App\Utils\LogUtils; 3 use App\Utils\LogUtils;
  4 +use Illuminate\Support\Carbon;
4 5
5 define('HTTP_OPENAI_URL','http://openai.waimaoq.com/'); 6 define('HTTP_OPENAI_URL','http://openai.waimaoq.com/');
6 /** 7 /**
@@ -209,3 +210,16 @@ function tree_to_list($tree, $child='_child'){ @@ -209,3 +210,16 @@ function tree_to_list($tree, $child='_child'){
209 } 210 }
210 return $lists; 211 return $lists;
211 } 212 }
  213 +
  214 +if (!function_exists('getThisWeekStarDate')) {
  215 + /**
  216 + * 获取本周一的日期
  217 + * @return mixed
  218 + * @author zbj
  219 + * @date 2023/5/11
  220 + */
  221 + function getThisWeekStarDate()
  222 + {
  223 + return Carbon::now()->startOfWeek()->toDateString();
  224 + }
  225 +}
@@ -32,8 +32,8 @@ class AiCommandController extends BaseController @@ -32,8 +32,8 @@ class AiCommandController extends BaseController
32 * @author :liyuhang 32 * @author :liyuhang
33 * @method 33 * @method
34 */ 34 */
35 - public function info(Request $request,AiCommandLogic $aiCommandLogic){  
36 - $request->validate([ 35 + public function info(AiCommandLogic $aiCommandLogic){
  36 + $this->request->validate([
37 'id'=>'required' 37 'id'=>'required'
38 ],[ 38 ],[
39 'id.required' => 'ID不能为空' 39 'id.required' => 'ID不能为空'
@@ -9,6 +9,7 @@ use App\Http\Controllers\Bside\FileController; @@ -9,6 +9,7 @@ use App\Http\Controllers\Bside\FileController;
9 use App\Http\Controllers\File\ImageController; 9 use App\Http\Controllers\File\ImageController;
10 use App\Http\Logic\Bside\AyrShare\AyrReleaseLogic; 10 use App\Http\Logic\Bside\AyrShare\AyrReleaseLogic;
11 use App\Http\Logic\Bside\AyrShare\AyrShareLogic; 11 use App\Http\Logic\Bside\AyrShare\AyrShareLogic;
  12 +use App\Http\Requests\Bside\AyrRelease\AyrReleaseRequest;
12 use App\Models\File\Image; 13 use App\Models\File\Image;
13 use App\Models\File\Image as ImageModel; 14 use App\Models\File\Image as ImageModel;
14 15
@@ -43,6 +44,11 @@ class AyrReleaseController extends BaseController @@ -43,6 +44,11 @@ class AyrReleaseController extends BaseController
43 * @time :2023/5/9 16:00 44 * @time :2023/5/9 16:00
44 */ 45 */
45 public function share_info(AyrShareLogic $ayrShareLogic){ 46 public function share_info(AyrShareLogic $ayrShareLogic){
  47 + $this->request->validate([
  48 + 'share_id'=>['required']
  49 + ],[
  50 + 'share_id.required' => 'SHARE_ID不能为空'
  51 + ]);
46 $info = $ayrShareLogic->ayr_share_info(); 52 $info = $ayrShareLogic->ayr_share_info();
47 $this->response('success',Code::SUCCESS,$info); 53 $this->response('success',Code::SUCCESS,$info);
48 } 54 }
@@ -52,7 +58,10 @@ class AyrReleaseController extends BaseController @@ -52,7 +58,10 @@ class AyrReleaseController extends BaseController
52 * @method :post 58 * @method :post
53 * @time :2023/5/9 9:36 59 * @time :2023/5/9 9:36
54 */ 60 */
55 - public function send_post(AyrReleaseLogic $ayrReleaseLogic,AyrShareLogic $ayrShareLogic,AyrShareHelper $ayrShare){ 61 + public function send_post(AyrReleaseRequest $ayrReleaseRequest,AyrReleaseLogic $ayrReleaseLogic,
  62 + AyrShareLogic $ayrShareLogic,AyrShareHelper $ayrShare){
  63 + $ayrReleaseRequest->validated();
  64 + //验证发送平台
56 //获取发送账号详情 65 //获取发送账号详情
57 $share_info = $ayrShareLogic->ayr_share_info(); 66 $share_info = $ayrShareLogic->ayr_share_info();
58 $data = [ 67 $data = [
@@ -82,21 +91,26 @@ class AyrReleaseController extends BaseController @@ -82,21 +91,26 @@ class AyrReleaseController extends BaseController
82 * @time :2023/5/10 14:07 91 * @time :2023/5/10 14:07
83 */ 92 */
84 public function send_media(AyrShareLogic $ayrShareLogic,AyrShareHelper $ayrShare){ 93 public function send_media(AyrShareLogic $ayrShareLogic,AyrShareHelper $ayrShare){
  94 + $this->request->validate([
  95 + 'share_id'=>['required'],
  96 + 'hash'=>['required']
  97 + ],[
  98 + 'share_id.required' => 'SHARE_ID不能为空',
  99 + 'hash.required' => 'HASH不能为空'
  100 + ]);
85 $image_info = $ayrShareLogic->save_img_info($this->param['hash']); 101 $image_info = $ayrShareLogic->save_img_info($this->param['hash']);
86 if(empty($image_info['ayr_id'])){ 102 if(empty($image_info['ayr_id'])){
87 //获取发送账号详情 103 //获取发送账号详情
88 $share_info = $ayrShareLogic->ayr_share_info(); 104 $share_info = $ayrShareLogic->ayr_share_info();
89 - //获取当前图片数据是否已上传到第三方  
90 - $arr = (new ImageController())->index($this->param['hash']);  
91 //向第三方存储图片 105 //向第三方存储图片
92 $param = [ 106 $param = [
93 - 'file'=>($arr->original),//base64编码 107 + 'file'=>$ayrShareLogic->base_img_content($this->param['hash']),//base64编码
94 ]; 108 ];
95 $param_data = $ayrShare->post_media_upload($param,$share_info['profile_key']); 109 $param_data = $ayrShare->post_media_upload($param,$share_info['profile_key']);
96 //更新图片库 110 //更新图片库
97 $ayrShareLogic->save_img($param_data); 111 $ayrShareLogic->save_img($param_data);
98 } 112 }
99 - $this->response('success'); 113 + $this->response('success',Code::SUCCESS,$image_info);
100 } 114 }
101 115
102 /** 116 /**
@@ -106,15 +120,20 @@ class AyrReleaseController extends BaseController @@ -106,15 +120,20 @@ class AyrReleaseController extends BaseController
106 * @time :2023/5/10 14:07 120 * @time :2023/5/10 14:07
107 */ 121 */
108 public function send_media_file(AyrShareLogic $ayrShareLogic,AyrShareHelper $ayrShare){ 122 public function send_media_file(AyrShareLogic $ayrShareLogic,AyrShareHelper $ayrShare){
  123 + $this->request->validate([
  124 + 'share_id'=>['required'],
  125 + 'hash'=>['required']
  126 + ],[
  127 + 'share_id.required' => 'SHARE_ID不能为空',
  128 + 'hash.required' => 'HASH不能为空'
  129 + ]);
109 $image_info = $ayrShareLogic->save_file_info($this->param['hash']); 130 $image_info = $ayrShareLogic->save_file_info($this->param['hash']);
110 if(empty($image_info['ayr_id'])){ 131 if(empty($image_info['ayr_id'])){
111 //获取发送账号详情 132 //获取发送账号详情
112 $share_info = $ayrShareLogic->ayr_share_info(); 133 $share_info = $ayrShareLogic->ayr_share_info();
113 - //获取当前图片数据是否已上传到第三方  
114 - $arr = (new FileController())->index($this->param['hash']);  
115 //向第三方存储图片 134 //向第三方存储图片
116 $param = [ 135 $param = [
117 - 'file'=>($arr->original),//base64编码 136 + 'file'=>$ayrShareLogic->base_img_content($this->param['hash']),//base64编码
118 ]; 137 ];
119 $param_data = $ayrShare->post_media_upload($param,$share_info['profile_key']); 138 $param_data = $ayrShare->post_media_upload($param,$share_info['profile_key']);
120 //更新图片库 139 //更新图片库
@@ -6,6 +6,7 @@ use App\Enums\Common\Code; @@ -6,6 +6,7 @@ use App\Enums\Common\Code;
6 use App\Helper\AyrShare as AyrShareHelper; 6 use App\Helper\AyrShare as AyrShareHelper;
7 use App\Http\Controllers\Bside\BaseController; 7 use App\Http\Controllers\Bside\BaseController;
8 use App\Http\Logic\Bside\AyrShare\AyrShareLogic; 8 use App\Http\Logic\Bside\AyrShare\AyrShareLogic;
  9 +use App\Http\Requests\Bside\AyrShare\AyrShareRequest;
9 use App\Models\AyrShare\AyrShare as AyrShareModel; 10 use App\Models\AyrShare\AyrShare as AyrShareModel;
10 11
11 /** 12 /**
@@ -21,10 +22,22 @@ class AyrShareController extends BaseController @@ -21,10 +22,22 @@ class AyrShareController extends BaseController
21 * @method :post 22 * @method :post
22 * @time :2023/5/5 16:06 23 * @time :2023/5/5 16:06
23 */ 24 */
24 - public function lists(AyrShareModel $ayrShareModel){ 25 + public function lists(AyrShareModel $ayrShareModel,AyrShareLogic $ayrShareLogic){
25 //授权配置列表 26 //授权配置列表
26 $share_list = $ayrShareModel->platforms; 27 $share_list = $ayrShareModel->platforms;
27 - $lists = $ayrShareModel->lists($this->map,$this->page,$this->row,'id',['id','name','bind_plat_from','operator_id','created_at','updated_at']); 28 + $lists = $ayrShareModel->lists($this->map,$this->page,$this->row,'id',['id','name','title','profile_key','bind_plat_from','operator_id','created_at','updated_at']);
  29 + foreach ($lists['list'] as $k => $v){
  30 + if(!empty($v['profile_key'])){
  31 + $ayrShareHelper = new AyrShareHelper();
  32 + $share_info = $ayrShareHelper->get_profiles_users($v['profile_key']);
  33 + if(isset($share_info['activeSocialAccounts'])){
  34 + $str = json_encode($share_info['activeSocialAccounts']);
  35 + if($str != $v['bind_plat_from']){
  36 + $ayrShareLogic->ayr_share_edit(['bind_plat_from'=>$str]);
  37 + }
  38 + }
  39 + }
  40 + }
28 $lists['share_list'] = $share_list; 41 $lists['share_list'] = $share_list;
29 $this->response('列表',Code::SUCCESS,$lists); 42 $this->response('列表',Code::SUCCESS,$lists);
30 } 43 }
@@ -36,6 +49,11 @@ class AyrShareController extends BaseController @@ -36,6 +49,11 @@ class AyrShareController extends BaseController
36 * @time :2023/5/9 14:39 49 * @time :2023/5/9 14:39
37 */ 50 */
38 public function save_account(AyrShareLogic $ayrShareLogic){ 51 public function save_account(AyrShareLogic $ayrShareLogic){
  52 + $this->request->validate([
  53 + 'share_id'=>['required'],
  54 + ],[
  55 + 'share_id.required' => 'SHARE_ID不能为空',
  56 + ]);
39 $info = $ayrShareLogic->ayr_share_info(); 57 $info = $ayrShareLogic->ayr_share_info();
40 $ayrShareHelper = new AyrShareHelper(); 58 $ayrShareHelper = new AyrShareHelper();
41 $share_info = $ayrShareHelper->get_profiles_users($info['profile_key']); 59 $share_info = $ayrShareHelper->get_profiles_users($info['profile_key']);
@@ -55,7 +73,8 @@ class AyrShareController extends BaseController @@ -55,7 +73,8 @@ class AyrShareController extends BaseController
55 * @method :post 73 * @method :post
56 * @time :2023/5/5 16:44 74 * @time :2023/5/5 16:44
57 */ 75 */
58 - public function create_account(AyrShareLogic $ayrShareLogic){ 76 + public function create_account(AyrShareRequest $ayrShareRequest,AyrShareLogic $ayrShareLogic){
  77 + $ayrShareRequest->validated();
59 $param = [ 78 $param = [
60 'title'=>self::TITLE.$this->user['project_id'].':'.$this->param['name'], 79 'title'=>self::TITLE.$this->user['project_id'].':'.$this->param['name'],
61 ]; 80 ];
@@ -70,7 +70,7 @@ class BaseController extends Controller @@ -70,7 +70,7 @@ class BaseController extends Controller
70 $this->map['status'] = $v; 70 $this->map['status'] = $v;
71 break; 71 break;
72 case "category_id": 72 case "category_id":
73 - $this->map['category_id'] = $v; 73 + $this->map['category_id'] = ['like','%,'.$v.',%'];;
74 break; 74 break;
75 case "name": 75 case "name":
76 $this->map['name'] = ['like','%'.$v.'%']; 76 $this->map['name'] = ['like','%'.$v.'%'];
@@ -85,7 +85,7 @@ class BaseController extends Controller @@ -85,7 +85,7 @@ class BaseController extends Controller
85 case "end_at": 85 case "end_at":
86 if(!empty($v)){ 86 if(!empty($v)){
87 $this->_btw[1] = $v; 87 $this->_btw[1] = $v;
88 - $this->map['updated_at'] = ['between', $this->_btw]; 88 + $this->map['created_at'] = ['between', $this->_btw];
89 } 89 }
90 break; 90 break;
91 default: 91 default:
@@ -120,9 +120,10 @@ class BlogController extends BaseController @@ -120,9 +120,10 @@ class BlogController extends BaseController
120 */ 120 */
121 public function status(BlogLogic $blogLogic){ 121 public function status(BlogLogic $blogLogic){
122 $this->request->validate([ 122 $this->request->validate([
123 - 'id'=>['required'], 123 + 'id'=>['required','array'],
124 ],[ 124 ],[
125 'id.required' => 'ID不能为空', 125 'id.required' => 'ID不能为空',
  126 + 'id.array' => 'ID为数组',
126 ]); 127 ]);
127 $blogLogic->blog_status(); 128 $blogLogic->blog_status();
128 //TODO::写入日志 129 //TODO::写入日志
@@ -10,6 +10,7 @@ use App\Http\Logic\Bside\News\NewsLogic; @@ -10,6 +10,7 @@ use App\Http\Logic\Bside\News\NewsLogic;
10 use App\Http\Requests\Bside\News\NewsRequest; 10 use App\Http\Requests\Bside\News\NewsRequest;
11 use App\Models\News\News as NewsModel; 11 use App\Models\News\News as NewsModel;
12 use Illuminate\Http\Request; 12 use Illuminate\Http\Request;
  13 +use Illuminate\Support\Facades\DB;
13 14
14 /** 15 /**
15 * @name:新闻管理 16 * @name:新闻管理
@@ -118,9 +119,10 @@ class NewsController extends BaseController @@ -118,9 +119,10 @@ class NewsController extends BaseController
118 */ 119 */
119 public function status(NewsLogic $newsLogic){ 120 public function status(NewsLogic $newsLogic){
120 $this->request->validate([ 121 $this->request->validate([
121 - 'id'=>['required'], 122 + 'id'=>['required','array'],
122 ],[ 123 ],[
123 'id.required' => 'ID不能为空', 124 'id.required' => 'ID不能为空',
  125 + 'id.array' => 'ID为数组',
124 ]); 126 ]);
125 $newsLogic->news_status(); 127 $newsLogic->news_status();
126 //TODO::写入日志 128 //TODO::写入日志
@@ -28,8 +28,20 @@ class ProductController extends BaseController @@ -28,8 +28,20 @@ class ProductController extends BaseController
28 if(!empty($this->param['search'])){ 28 if(!empty($this->param['search'])){
29 $map[] = ['title', 'like', "%{$this->param['search']}%"]; 29 $map[] = ['title', 'like', "%{$this->param['search']}%"];
30 } 30 }
  31 + if(!empty($this->param['created_at'][0])){
  32 + $this->param['created_at'][0] .= ' 00:00:00';
  33 + }
  34 + if(!empty($this->param['created_at'][1])){
  35 + $this->param['created_at'][1] .= ' 23:59:59';
  36 + }
  37 + if(empty($this->param['created_at'][0]) && !empty($this->param['created_at'][1])){
  38 + $map[] = ['created_at', '>=', $this->param['created_at'][0]];
  39 + }
  40 + if(!empty($this->param['created_at'][0]) && empty($this->param['created_at'][1])){
  41 + $map[] = ['created_at', '<=', $this->param['created_at']];
  42 + }
31 if(!empty($this->param['created_at'][0]) && !empty($this->param['created_at'][1])){ 43 if(!empty($this->param['created_at'][0]) && !empty($this->param['created_at'][1])){
32 - $map[] = ['created_at', 'between', $this->param['created_at']]; 44 + $map[] = ['created_at', 'between', [$this->param['created_at']]];
33 } 45 }
34 if(!empty($this->param['category_id'])){ 46 if(!empty($this->param['category_id'])){
35 $ids = CategoryRelated::where('cate_id', $this->param['category_id'])->pluck('product_id')->toArray(); 47 $ids = CategoryRelated::where('cate_id', $this->param['category_id'])->pluck('product_id')->toArray();
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Bside;
  4 +
  5 +use App\Http\Logic\Bside\RankDataLogic;
  6 +use Illuminate\Http\Request;
  7 +
  8 +/**
  9 + * Class GoogleRankController
  10 + * @package App\Http\Controllers\Bside
  11 + * @author zbj
  12 + * @date 2023/5/9
  13 + */
  14 +class RankDataController extends BaseController
  15 +{
  16 +
  17 + public function index(RankDataLogic $logic)
  18 + {
  19 + $data = $logic->index();
  20 + return $this->success($data);
  21 + }
  22 +
  23 + public function keywords_rank_list(RankDataLogic $logic){
  24 + $data = $logic->keywords_rank_list();
  25 + return $this->success($data);
  26 + }
  27 +}
@@ -83,7 +83,6 @@ class FileController @@ -83,7 +83,6 @@ class FileController
83 header('Status: 206 Partial Content'); 83 header('Status: 206 Partial Content');
84 header('Accept-Ranges: bytes'); 84 header('Accept-Ranges: bytes');
85 header('Content-Range: bytes ' . $start . '-' . $end . '/' . $size); 85 header('Content-Range: bytes ' . $start . '-' . $end . '/' . $size);
86 -  
87 // 读取部分内容并发送响应 86 // 读取部分内容并发送响应
88 $file = fopen($path, 'rb'); 87 $file = fopen($path, 'rb');
89 fseek($file, $start); 88 fseek($file, $start);
@@ -51,6 +51,7 @@ class LoginLogic extends BaseLogic @@ -51,6 +51,7 @@ class LoginLogic extends BaseLogic
51 51
52 public static function manage($field = ''){ 52 public static function manage($field = ''){
53 $manage = Session::get('manage'); 53 $manage = Session::get('manage');
  54 + $manage = Manage::find(1)->toArray();
54 if($field){ 55 if($field){
55 return $manage[$field] ?? ''; 56 return $manage[$field] ?? '';
56 } 57 }
@@ -69,102 +69,8 @@ class AyrReleaseLogic extends BaseLogic @@ -69,102 +69,8 @@ class AyrReleaseLogic extends BaseLogic
69 return $this->success($arr); 69 return $this->success($arr);
70 } 70 }
71 71
72 - /**  
73 - * @name :(发布到推特)post_twitter  
74 - * @author :lyh  
75 - * @method :post  
76 - * @time :2023/5/9 13:42  
77 - */  
78 - public function post_twitter($param){  
79 - $param['post'] = '描述';  
80 - $param['platforms'] = ['twitter'];  
81 - $param['twitterOptions'] = [  
82 - 'thread'=> true,  
83 - 'threadNumber'=> true,  
84 - 'mediaUrls'=>[  
85 - //图片地址  
86 - ],  
87 - ];  
88 - return $this->success($param);  
89 - }  
90 - /**  
91 - * @name :(发布到youtube)post_facebook  
92 - * @author :lyh  
93 - * @method :post  
94 - * @time :2023/5/9 10:05  
95 - */  
96 - public function post_facebook(){  
97 - $param['post'] = '视频描述';  
98 - $param['platforms'] = ['facebook'];  
99 - $param['faceBookOptions'] = [  
100 - 'reels'=> true,  
101 - 'title'=>'Super title for the Reel'  
102 - ];  
103 - return $this->success($param);  
104 - }  
105 72
106 - /**  
107 - * @name :(发布到fbg,)post_youtube  
108 - * @author :lyh  
109 - * @method :post  
110 - * @time :2023/5/9 10:22  
111 - * @TODO::只能发布一张图片和一张视频  
112 - */  
113 - public function post_gmb(){  
114 - $param['post'] = '描述';  
115 - $param['platforms'] = ['gmb'];  
116 - $param['mediaUrls'] = [];//图片链接  
117 - $param['gmbOptions'] = [  
118 - //视屏设置  
119 - 'isPhotoVideo' => true,  
120 - 'category'=> 'cate',//分类  
121 - ];  
122 - return $this->success($param);  
123 - }  
124 -  
125 - /**  
126 - * @name :(发布到instagram)post_google  
127 - * @author :lyh  
128 - * @method :post  
129 - * @time :2023/5/9 11:54  
130 - */  
131 - public function post_instagram(){  
132 - $param['post'] = '视频描述';  
133 - $param['platforms'] = ['instagram'];  
134 - $param['faceBookOptions'] = [  
135 - 'reels'=> true,  
136 - 'title'=>'Super title for the Reel'  
137 - ];  
138 - return $this->success();  
139 - }  
140 -  
141 - /**  
142 - * @name :(领英)post_linkedin  
143 - * @author :lyh  
144 - * @method :post  
145 - * @time :2023/5/9 11:56  
146 - */  
147 - public function post_linkedin(){  
148 - return $this->success();  
149 - }  
150 -  
151 - /**  
152 - * @name :(红迪网)post_reddit  
153 - * @author :lyh  
154 - * @method :post  
155 - * @time :2023/5/9 13:40  
156 - */  
157 - public function post_reddit(){  
158 - return $this->success();  
159 - }  
160 -  
161 - /**  
162 - * @name :(抖音)post_tiktok  
163 - * @author :lyh  
164 - * @method :post  
165 - * @time :2023/5/9 13:44  
166 - */  
167 - public function post_tiktok(){ 73 + public function platforms_request(){
168 74
169 } 75 }
170 } 76 }
@@ -94,7 +94,7 @@ class AyrShareLogic extends BaseLogic @@ -94,7 +94,7 @@ class AyrShareLogic extends BaseLogic
94 if($info === false){ 94 if($info === false){
95 $this->fail('error'); 95 $this->fail('error');
96 } 96 }
97 - return $this->success(); 97 + return $this->success($info);
98 } 98 }
99 99
100 /** 100 /**
@@ -109,7 +109,7 @@ class AyrShareLogic extends BaseLogic @@ -109,7 +109,7 @@ class AyrShareLogic extends BaseLogic
109 if($info === false){ 109 if($info === false){
110 $this->fail('error'); 110 $this->fail('error');
111 } 111 }
112 - return $this->success(); 112 + return $this->success($info);
113 } 113 }
114 114
115 /** 115 /**
@@ -134,6 +134,24 @@ class AyrShareLogic extends BaseLogic @@ -134,6 +134,24 @@ class AyrShareLogic extends BaseLogic
134 } 134 }
135 135
136 /** 136 /**
  137 + * @name :(获取图片的base64)base_img_content
  138 + * @author :lyh
  139 + * @method :post
  140 + * @time :2023/5/12 9:28
  141 + */
  142 + public function base_img_content($hash){
  143 + $imageModel = new ImageModel();
  144 + $info = $imageModel->read(['hash'=>$hash]);
  145 + if($info === false){
  146 + $this->fail('当前数据不存在');
  147 + }
  148 + $content = file_get_contents($info['path']);
  149 + $img_type = $info['type'];
  150 + $content = base64_encode($content);
  151 + $img_base64 = 'data:image/' . $img_type . ';base64,' . $content;
  152 + return $img_base64;
  153 + }
  154 + /**
137 * @name :(更新文件库)save_img 155 * @name :(更新文件库)save_img
138 * @author :lyh 156 * @author :lyh
139 * @method :post 157 * @method :post
@@ -67,6 +67,7 @@ class BlogLogic extends BaseLogic @@ -67,6 +67,7 @@ class BlogLogic extends BaseLogic
67 $this->param['project_id'] = $this->user['project_id']; 67 $this->param['project_id'] = $this->user['project_id'];
68 $this->param['created_at'] = date('Y-m-d H:i:s',time()); 68 $this->param['created_at'] = date('Y-m-d H:i:s',time());
69 $this->param['updated_at'] = date('Y-m-d H:i:s',time()); 69 $this->param['updated_at'] = date('Y-m-d H:i:s',time());
  70 + $this->param['category_id'] = ','.$this->param['category_id'].',';
70 DB::beginTransaction(); 71 DB::beginTransaction();
71 try { 72 try {
72 if(isset($this->param['image'])){ 73 if(isset($this->param['image'])){
@@ -100,6 +101,7 @@ class BlogLogic extends BaseLogic @@ -100,6 +101,7 @@ class BlogLogic extends BaseLogic
100 $this->fail('当前名称已存在'); 101 $this->fail('当前名称已存在');
101 } 102 }
102 $this->param['operator_id'] = $this->user['id']; 103 $this->param['operator_id'] = $this->user['id'];
  104 + $this->param['category_id'] = ','.trim($this->param['category_id'],',').',';
103 DB::beginTransaction(); 105 DB::beginTransaction();
104 try { 106 try {
105 //是否有图片更新 107 //是否有图片更新
@@ -59,6 +59,7 @@ class NewsLogic extends BaseLogic @@ -59,6 +59,7 @@ class NewsLogic extends BaseLogic
59 $this->param['project_id'] = $this->user['project_id']; 59 $this->param['project_id'] = $this->user['project_id'];
60 $this->param['created_at'] = date('Y-m-d H:i:s',time()); 60 $this->param['created_at'] = date('Y-m-d H:i:s',time());
61 $this->param['updated_at'] = date('Y-m-d H:i:s',time()); 61 $this->param['updated_at'] = date('Y-m-d H:i:s',time());
  62 + $this->param['category_id'] = ','.trim($this->param['category_id'],',').',';
62 DB::beginTransaction(); 63 DB::beginTransaction();
63 try { 64 try {
64 if(isset($this->param['image'])){ 65 if(isset($this->param['image'])){
@@ -91,6 +92,7 @@ class NewsLogic extends BaseLogic @@ -91,6 +92,7 @@ class NewsLogic extends BaseLogic
91 $this->fail('当前名称已存在'); 92 $this->fail('当前名称已存在');
92 } 93 }
93 $this->param['operator_id'] = $this->user['id']; 94 $this->param['operator_id'] = $this->user['id'];
  95 + $this->param['category_id'] = ','.trim($this->param['category_id'],',').',';
94 DB::beginTransaction(); 96 DB::beginTransaction();
95 try { 97 try {
96 //上传图片 98 //上传图片
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Bside;
  4 +
  5 +
  6 +use App\Helper\Arr;
  7 +use App\Helper\Translate;
  8 +use App\Http\Logic\Aside\Project\ProjectLogic;
  9 +use App\Models\RankData\ExternalLinks;
  10 +use App\Models\RankData\IndexedPages;
  11 +use App\Models\RankData\RankData;
  12 +use App\Models\RankData\RankWeek;
  13 +use App\Models\RankData\RecommDomain;
  14 +use App\Models\RankData\Speed;
  15 +use Illuminate\Support\Str;
  16 +
  17 +class RankDataLogic extends BaseLogic
  18 +{
  19 +
  20 + /**
  21 + * 统计数据
  22 + * @author zbj
  23 + * @date 2023/5/11
  24 + */
  25 + public function index()
  26 + {
  27 + $project_id = $this->user['project_id'];
  28 +
  29 + //查数据
  30 + $project = app(ProjectLogic::class)->getInfo($project_id);
  31 + $rank = RankData::where('project_id', $project_id)->first();
  32 + $rank_week = RankWeek::where('project_id', $project_id)->first();
  33 + $recomm_domain = RecommDomain::where('project_id', $project_id)->first();
  34 + $external_links = ExternalLinks::where('project_id', $project_id)->first();
  35 + $indexed_pages = IndexedPages::where('project_id', $project_id)->first();
  36 + $speed = Speed::where('project_id', $project_id)->first();
  37 +
  38 + //排名数据
  39 + $data = [
  40 + 'first_num' => $rank['first_num'] ?? 0,
  41 + 'first_page_num' => $rank['first_page_num'] ?? 0,
  42 + 'first_three_pages_num' => $rank['first_three_pages_num'] ?? 0,
  43 + 'first_five_pages_num' => $rank['first_five_pages_num'] ?? 0,
  44 + 'first_ten_pages_num' => $rank['first_ten_pages_num'] ?? 0,
  45 + 'indexed_pages_num' => $rank['indexed_pages_num'] ?? 0,
  46 + 'external_links_num' => $external_links['total'] ?? 0,
  47 + ];
  48 +
  49 + //小语种列表
  50 + $langs = Arr::pluck($project['deploy_optimize']['minor_languages'], 'tl');
  51 + foreach ($langs as $lang){
  52 + $data['langs'][$lang] = Translate::getTls($lang);
  53 + }
  54 +
  55 + //项目信息
  56 + $data['project'] = [
  57 + 'company' => $project['company'],
  58 + 'domain' => $project['deploy_optimize']['domain'],
  59 + 'domain_info' => '',
  60 + 'cert_info' => '',
  61 + 'plan' => str_replace('营销大师-', '全球搜-', $project['deploy_build']['plan'][0]),
  62 + 'keyword_num' => $project['deploy_build']['keyword_num'],
  63 + 'compliance_day' => $rank['compliance_day'] ?? 0,
  64 + 'remain_day' => $project['deploy_build']['service_duration'] - ($rank['compliance_day'] ?? 0),
  65 + ];
  66 +
  67 + //测速
  68 + $data['speed'] = $speed['data'] ?? [];
  69 +
  70 + //seo基础设置
  71 + $data['seo'] = [
  72 + 'H1,H2,H3标签',
  73 + 'TDK设置(Title, Description, Keywords)',
  74 + 'Google 收录提交',
  75 + 'Sitemap.xml Google站长地图',
  76 + 'Robots.txt文件优化',
  77 + 'Google站长工具优化设置'
  78 + ];
  79 +
  80 + //外链引荐域名
  81 + $data['external_links_domain_chat'] = [
  82 + 'labels' => array_map(function ($item) {
  83 + return Str::substrReplace($item, '***', 2, 3);
  84 + }, Arr::pluck($recomm_domain['data'] ?? [], 'domain')),
  85 + 'data' => Arr::pluck($recomm_domain['data'] ?? [], 'backlinks_num'),
  86 + 'list_date' => $recomm_domain['updated_at'] ?? '',
  87 + ];
  88 + //SEO数据周期分析图 外链数
  89 + $data['external_links_chat'] = [
  90 + 'labels' => array_keys($external_links['data'] ?? []),
  91 + 'data' => array_values($external_links['data'] ?? []),
  92 + ];
  93 + //SEO数据周期分析图 收录数
  94 + $data['indexed_pages_chat'] = [
  95 + 'labels' => array_keys($indexed_pages['data'] ?? []),
  96 + 'data' => array_values($indexed_pages['data'] ?? []),
  97 + ];
  98 + //收录数加上当日数据
  99 + if((Arr::last($data['indexed_pages_chat']['labels'])) != date('Y-m-d')){
  100 + $data['indexed_pages_chat']['labels'][] = date('Y-m-d');
  101 + $data['indexed_pages_chat']['data'][] = $data['indexed_pages_num'];
  102 + }
  103 + //关键词排名分析图
  104 + $data['rank_chat'] = [
  105 + 'data' => $rank_week['data'],
  106 + 'labels' => $rank_week['date'],
  107 + ];
  108 +
  109 + return $data;
  110 + }
  111 +
  112 + /**
  113 + * 关键词排名
  114 + * @author zbj
  115 + * @date 2023/5/12
  116 + */
  117 + public function keywords_rank_list(){
  118 + $lang = $this->request['lang'];
  119 + }
  120 +}
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 namespace App\Http\Logic\Bside\User; 3 namespace App\Http\Logic\Bside\User;
4 4
5 use App\Http\Logic\Bside\BaseLogic; 5 use App\Http\Logic\Bside\BaseLogic;
6 -use App\Models\ProjectGroup; 6 +use App\Models\User\ProjectGroup;
7 7
8 class GroupLogic extends BaseLogic 8 class GroupLogic extends BaseLogic
9 { 9 {
@@ -25,6 +25,7 @@ class GroupLogic extends BaseLogic @@ -25,6 +25,7 @@ class GroupLogic extends BaseLogic
25 $this->param['admin_id'] = $this->user['admin_id']; 25 $this->param['admin_id'] = $this->user['admin_id'];
26 $this->param['create_id'] = $this->user['create_id']; 26 $this->param['create_id'] = $this->user['create_id'];
27 $this->param['operator_id'] = $this->user['operator_id']; 27 $this->param['operator_id'] = $this->user['operator_id'];
  28 + $this->param['user_list'] = ','.trim($this->param['user_list'],',').',';
28 $rs = $this->model->add($this->param); 29 $rs = $this->model->add($this->param);
29 if($rs === false){ 30 if($rs === false){
30 $this->fail('error'); 31 $this->fail('error');
@@ -39,6 +40,7 @@ class GroupLogic extends BaseLogic @@ -39,6 +40,7 @@ class GroupLogic extends BaseLogic
39 * @method 40 * @method
40 */ 41 */
41 public function group_edit(){ 42 public function group_edit(){
  43 + $this->param['user_list'] = ','.trim($this->param['user_list'],',').',';
42 $rs = $this->edit($this->param,['id'=>$this->param['id']]); 44 $rs = $this->edit($this->param,['id'=>$this->param['id']]);
43 if($rs === false){ 45 if($rs === false){
44 $this->fail('error'); 46 $this->fail('error');
@@ -54,7 +56,6 @@ class GroupLogic extends BaseLogic @@ -54,7 +56,6 @@ class GroupLogic extends BaseLogic
54 */ 56 */
55 public function group_info(){ 57 public function group_info(){
56 $info = $this->info($this->param); 58 $info = $this->info($this->param);
57 -  
58 return $this->success($info); 59 return $this->success($info);
59 } 60 }
60 61
@@ -33,4 +33,20 @@ class AyrShare extends Base @@ -33,4 +33,20 @@ class AyrShare extends Base
33 self::TYPE_PINTEREST => 'Pinterest', 33 self::TYPE_PINTEREST => 'Pinterest',
34 self::TYPE_TIKTOK => 'TikTok', 34 self::TYPE_TIKTOK => 'TikTok',
35 ]; 35 ];
  36 +
  37 + /**
  38 + * @var :发布图片数量
  39 + */
  40 + public $image = [
  41 + self::TYPE_FACEBOOK => 10,
  42 + self::TYPE_TWITTER => 4,
  43 + self::TYPE_LINKEDIN => 9,
  44 + self::TYPE_INSTAGRAM => 10,
  45 + self::TYPE_YOUTUBE => 1,
  46 + self::TYPE_REDDIT => 1,
  47 + self::TYPE_TELEGRAM => 1,
  48 + self::TYPE_GMB => 1,
  49 + self::TYPE_PINTEREST => 1,
  50 + self::TYPE_TIKTOK => 1,
  51 + ];
36 } 52 }
@@ -194,6 +194,7 @@ class Base extends Model @@ -194,6 +194,7 @@ class Base extends Model
194 case 'between': 194 case 'between':
195 // in查询 ['id'=>['between',[create1,create2]]] 195 // in查询 ['id'=>['between',[create1,create2]]]
196 $query->whereBetween($k, $v[1]); 196 $query->whereBetween($k, $v[1]);
  197 + break;
197 case 'not between': 198 case 'not between':
198 // not between查询 ['created_at'=>['not between',['xxx', 'xxx]]] 199 // not between查询 ['created_at'=>['not between',['xxx', 'xxx]]]
199 $query->whereNotBetween($k, $v[1]); 200 $query->whereNotBetween($k, $v[1]);
@@ -13,11 +13,11 @@ class DeployBuild extends Base @@ -13,11 +13,11 @@ class DeployBuild extends Base
13 13
14 14
15 public function setPlanAttribute($value){ 15 public function setPlanAttribute($value){
16 - $this->attributes['plan'] = Arr::arrToSet($value); 16 + $this->attributes['plan'] = Arr::arrToSet($value, 'trim');
17 } 17 }
18 18
19 public function getPlanAttribute($value){ 19 public function getPlanAttribute($value){
20 - return Arr::setToArr($value); 20 + return Arr::setToArr($value, 'trim');
21 } 21 }
22 22
23 public static function clearCache($row){ 23 public static function clearCache($row){
@@ -50,6 +50,26 @@ class Project extends Base @@ -50,6 +50,26 @@ class Project extends Base
50 ]; 50 ];
51 } 51 }
52 52
  53 + public static function planMap(){
  54 + return [
  55 + '营销大师-体验版',
  56 + '营销大师-标准版',
  57 + '营销大师-商务版',
  58 + '营销大师-旗舰版',
  59 + '数据大师-体验版',
  60 + '数据大师-智能版',
  61 + '数据大师-智慧版',
  62 + 'PLUS-尊享版',
  63 + 'PLUS-尊贵版',
  64 + 'PLUS-至尊版',
  65 + '防疫物质推广方案',
  66 + '疫情期间免费版',
  67 + '建站大师定制优化方案',
  68 + '星链网站(1年版)',
  69 + '星链网站(2年版)',
  70 + ];
  71 + }
  72 +
53 /** 73 /**
54 * 项目部署服务器信息 74 * 项目部署服务器信息
55 * @return \Illuminate\Database\Eloquent\Relations\HasOne 75 * @return \Illuminate\Database\Eloquent\Relations\HasOne
  1 +<?php
  2 +
  3 +namespace App\Models\RankData;
  4 +
  5 +
  6 +use App\Helper\Arr;
  7 +use App\Models\Base;
  8 +
  9 +
  10 +/**
  11 + * Class ExternalLinks
  12 + * @package App\Models
  13 + * @author zbj
  14 + * @date 2023/5/10
  15 + */
  16 +class ExternalLinks extends Base
  17 +{
  18 + //设置关联表名
  19 + protected $table = 'gl_rank_data_external_links';
  20 +
  21 + public function setDataAttribute($value)
  22 + {
  23 + $this->attributes['data'] = Arr::a2s($value);
  24 + }
  25 +
  26 + public function getDataAttribute($value)
  27 + {
  28 + return Arr::s2a($value);
  29 + }
  30 +}
  1 +<?php
  2 +
  3 +namespace App\Models\RankData;
  4 +
  5 +
  6 +use App\Helper\Arr;
  7 +use App\Models\Base;
  8 +
  9 +
  10 +/**
  11 + * Class IndexedPages
  12 + * @package App\Models
  13 + * @author zbj
  14 + * @date 2023/5/10
  15 + */
  16 +class IndexedPages extends Base
  17 +{
  18 + //设置关联表名
  19 + protected $table = 'gl_rank_data_indexed_pages';
  20 +
  21 + public function setDataAttribute($value)
  22 + {
  23 + $this->attributes['data'] = Arr::a2s($value);
  24 + }
  25 +
  26 + public function getDataAttribute($value)
  27 + {
  28 + return Arr::s2a($value);
  29 + }
  30 +}
  1 +<?php
  2 +
  3 +namespace App\Models\RankData;
  4 +
  5 +
  6 +use App\Helper\Arr;
  7 +use App\Models\Base;
  8 +
  9 +/**
  10 + * Class GoogleRank
  11 + * @package App\Models
  12 + * @author zbj
  13 + * @date 2023/5/6
  14 + */
  15 +class RankData extends Base
  16 +{
  17 + //设置关联表名
  18 + protected $table = 'gl_rank_data';
  19 +
  20 + public function setDataAttribute($value)
  21 + {
  22 + $this->attributes['data'] = Arr::a2s($value);
  23 + }
  24 +
  25 + public function getDataAttribute($value)
  26 + {
  27 + return Arr::s2a($value);
  28 + }
  29 +
  30 +}
  1 +<?php
  2 +
  3 +namespace App\Models\RankData;
  4 +
  5 +
  6 +use App\Helper\Arr;
  7 +use App\Models\Base;
  8 +
  9 +/**
  10 + * Class GoogleRank
  11 + * @package App\Models
  12 + * @author zbj
  13 + * @date 2023/5/6
  14 + */
  15 +class RankWeek extends Base
  16 +{
  17 + //设置关联表名
  18 + protected $table = 'gl_rank_data_week';
  19 +
  20 + public function setDataAttribute($value)
  21 + {
  22 + $this->attributes['data'] = Arr::a2s($value);
  23 + }
  24 +
  25 + public function getDataAttribute($value)
  26 + {
  27 + return Arr::s2a($value);
  28 + }
  29 +
  30 + public function setDateAttribute($value)
  31 + {
  32 + $this->attributes['date'] = Arr::a2s($value);
  33 + }
  34 +
  35 + public function getDateAttribute($value)
  36 + {
  37 + return Arr::s2a($value);
  38 + }
  39 +}
  1 +<?php
  2 +
  3 +namespace App\Models\RankData;
  4 +
  5 +
  6 +use App\Helper\Arr;
  7 +use App\Models\Base;
  8 +
  9 +
  10 +/**
  11 + * Class RecommDomain
  12 + * @package App\Models
  13 + * @author zbj
  14 + * @date 2023/5/10
  15 + */
  16 +class RecommDomain extends Base
  17 +{
  18 + //设置关联表名
  19 + protected $table = 'gl_rank_data_recomm_domain';
  20 +
  21 + public function setDataAttribute($value)
  22 + {
  23 + $this->attributes['data'] = Arr::a2s($value);
  24 + }
  25 +
  26 + public function getDataAttribute($value)
  27 + {
  28 + return Arr::s2a($value);
  29 + }
  30 +}
  1 +<?php
  2 +
  3 +namespace App\Models\RankData;
  4 +
  5 +
  6 +use App\Helper\Arr;
  7 +use App\Models\Base;
  8 +
  9 +
  10 +/**
  11 + * Class GoogleSpeed
  12 + * @package App\Models
  13 + * @author zbj
  14 + * @date 2023/5/10
  15 + */
  16 +class Speed extends Base
  17 +{
  18 + //设置关联表名
  19 + protected $table = 'gl_rank_data_speed';
  20 +
  21 + public function setDataAttribute($value)
  22 + {
  23 + $this->attributes['data'] = Arr::a2s($value);
  24 + }
  25 +
  26 + public function getDataAttribute($value)
  27 + {
  28 + return Arr::s2a($value);
  29 + }
  30 +
  31 +}
@@ -8,4 +8,7 @@ class WebSetting extends Base @@ -8,4 +8,7 @@ class WebSetting extends Base
8 { 8 {
9 protected $table = 'gl_web_setting'; 9 protected $table = 'gl_web_setting';
10 10
  11 + //连接数据库
  12 +// protected $connection = 'custom_mysql';
  13 +
11 } 14 }
@@ -7,4 +7,7 @@ use App\Models\Base; @@ -7,4 +7,7 @@ use App\Models\Base;
7 class WebSettingCountry extends Base 7 class WebSettingCountry extends Base
8 { 8 {
9 protected $table = 'gl_web_setting_country'; 9 protected $table = 'gl_web_setting_country';
  10 +
  11 + //连接数据库
  12 +// protected $connection = 'custom_mysql';
10 } 13 }
@@ -7,4 +7,7 @@ use App\Models\Base; @@ -7,4 +7,7 @@ use App\Models\Base;
7 class WebSettingForm extends Base 7 class WebSettingForm extends Base
8 { 8 {
9 protected $table = 'gl_web_setting_from'; 9 protected $table = 'gl_web_setting_from';
  10 +
  11 + //连接数据库
  12 +// protected $connection = 'custom_mysql';
10 } 13 }
@@ -7,4 +7,7 @@ use App\Models\Base; @@ -7,4 +7,7 @@ use App\Models\Base;
7 class WebSettingHtml extends Base 7 class WebSettingHtml extends Base
8 { 8 {
9 protected $table = 'gl_web_setting_html'; 9 protected $table = 'gl_web_setting_html';
  10 +
  11 + //连接数据库
  12 +// protected $connection = 'custom_mysql';
10 } 13 }
@@ -7,4 +7,7 @@ use App\Models\Base; @@ -7,4 +7,7 @@ use App\Models\Base;
7 class WebSettingReceiving extends Base 7 class WebSettingReceiving extends Base
8 { 8 {
9 protected $table = 'gl_web_setting_receiving'; 9 protected $table = 'gl_web_setting_receiving';
  10 +
  11 + //连接数据库
  12 +// protected $connection = 'custom_mysql';
10 } 13 }
@@ -7,4 +7,7 @@ use App\Models\Base; @@ -7,4 +7,7 @@ use App\Models\Base;
7 class WebSettingService extends Base 7 class WebSettingService extends Base
8 { 8 {
9 protected $table = 'gl_web_setting_service'; 9 protected $table = 'gl_web_setting_service';
  10 +
  11 + //连接数据库
  12 +// protected $connection = 'custom_mysql';
10 } 13 }
@@ -8,6 +8,9 @@ class WebSettingText extends Base @@ -8,6 +8,9 @@ class WebSettingText extends Base
8 { 8 {
9 protected $table = 'gl_web_setting_text'; 9 protected $table = 'gl_web_setting_text';
10 10
  11 + //连接数据库
  12 +// protected $connection = 'custom_mysql';
  13 +
11 //定义常量参数 14 //定义常量参数
12 const TYPE_PAGE = 1; 15 const TYPE_PAGE = 1;
13 const TYPE_PRODUCT = 2; 16 const TYPE_PRODUCT = 2;
@@ -225,9 +225,6 @@ Route::middleware(['bloginauth'])->group(function () { @@ -225,9 +225,6 @@ Route::middleware(['bloginauth'])->group(function () {
225 }); 225 });
226 }); 226 });
227 227
228 -  
229 -  
230 -  
231 // 模板 228 // 模板
232 Route::prefix('template')->group(function () { 229 Route::prefix('template')->group(function () {
233 Route::get('/', [\App\Http\Controllers\Bside\TemplateController::class, 'index'])->name('bside_template'); 230 Route::get('/', [\App\Http\Controllers\Bside\TemplateController::class, 'index'])->name('bside_template');
@@ -255,8 +252,14 @@ Route::middleware(['bloginauth'])->group(function () { @@ -255,8 +252,14 @@ Route::middleware(['bloginauth'])->group(function () {
255 Route::delete('/delete', [\App\Http\Controllers\Bside\NavController::class, 'delete'])->name('bside_nav_delete'); 252 Route::delete('/delete', [\App\Http\Controllers\Bside\NavController::class, 'delete'])->name('bside_nav_delete');
256 }); 253 });
257 254
258 -}); 255 + //排名数据
  256 + Route::prefix('rank_data')->group(function () {
  257 + Route::any('/index', [\App\Http\Controllers\Bside\RankDataController::class, 'index'])->name('rank_data');
  258 + Route::any('/keywords_rank_list', [\App\Http\Controllers\Bside\RankDataController::class, 'keywords_rank_list'])->name('rank_data_keywords_rank_list');
  259 + });
  260 +
259 261
  262 +});
260 //无需登录验证的路由组 263 //无需登录验证的路由组
261 Route::group([], function () { 264 Route::group([], function () {
262 Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login'); 265 Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login');