作者 邓超

Merge branch 'develop' into dc

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