作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

正在显示 33 个修改的文件 包含 265 行增加60 行删除
... ... @@ -31,7 +31,7 @@ class ImportCustomModule extends Command
*
* @var string
*/
protected $description = 'import_custom_module';
protected $description = '特殊项目导入扩展模块及扩展数据';
/**
* @remark :导入
... ...
... ... @@ -33,7 +33,7 @@ class CountAll extends Command
*
* @var string
*/
protected $description = '升级项目统计';
protected $description = '所有项目统计';
public function handle(){
$projectModel = new Project();
... ...
... ... @@ -27,7 +27,7 @@ class CountDate extends Command
*
* @var string
*/
protected $description = '时间统计记录';
protected $description = '按时间统计所有项目记录';
/**
* @name :(定时执行生成昨日数据统计)handle
... ...
... ... @@ -35,7 +35,7 @@ class CountProject extends Command
*
* @var string
*/
protected $description = '升级项目统计';
protected $description = '按项目统计日记录';
public function handle(){
$project_id = $this->argument('project_id');
... ...
... ... @@ -25,7 +25,7 @@ class InquiryDelay extends Command
*
* @var string
*/
protected $description = '延时询盘转发';
protected $description = '延时询盘转发(暂时弃用)';
/**
* @remark :延时询盘转发
... ...
... ... @@ -272,9 +272,10 @@ class postInquiry extends Command
'email' => $detail['email'],
'phone' => $detail['phone'],
'post_id' => $log['url'],
'message' => $detail['message'],
];
$res = Http::withoutVerifying()->post('https://fob.ai.cc/api/ad_to_scrm', $data)->json();
if (empty($res['code']) || $res['code'] != 200) {
if (empty($res['status']) || $res['status'] != 200) {
$log->status = ReInquiryDetailLog::STATUS_FAIL;
$log->remark = mb_substr($res['message'] ?? '', 0, 200);
$log->save();
... ...
... ... @@ -36,7 +36,7 @@ class MonthAllCount extends Command
*
* @var string
*/
protected $description = '升级项目统计-月统计';
protected $description = '项目统计-月统计';
public function handle(){
$projectModel = new Project();
... ...
... ... @@ -32,7 +32,7 @@ class SendProduct extends Command
*
* @var string
*/
protected $description = '根据发布时间发布产品';
protected $description = '自动发布--根据发布时间发布产品';
/**
* @remark :发布
... ...
... ... @@ -30,7 +30,7 @@ class CountAllProject extends Command
*
* @var string
*/
protected $description = '统计所有项目设置';
protected $description = '统计所有项目设置(4.0-5.0-6.0)';
public function handle(){
... ...
... ... @@ -28,7 +28,7 @@ class countProject extends Command
*
* @var string
*/
protected $description = '项目数据统计生成文件';
protected $description = '项目数据统计生成文件(测试脚本)';
public function handle(){
$start = '2023-10';
... ...
... ... @@ -37,6 +37,8 @@ class ExternalLinks extends BaseCommands
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->select('domain', 'api_no', 'project_id')->get()->toArray();
Log::channel('rank_data')->info('开始-外链数据-'.count($list));
//特殊项目
$list[] = ['api_no' => 11201, 'project_id' => 2104];
foreach ($list as $item) {
$rankDataLogic = new RankDataLogic();
$rankDataLogic->syncExternalLinks($item['api_no']);
... ...
... ... @@ -43,6 +43,10 @@ class IndexedPages extends BaseCommands
}else{
foreach ($site_res as $api_no => $num){
$project_ids = DeployOptimize::where('api_no', $api_no)->pluck('project_id');
//特殊项目
if($api_no == 11201){
$project_ids[] = 2104;
}
foreach ($project_ids as $project_id){
$rank_data = RankData::where('project_id', $project_id)->where('lang', '')->first();
if($rank_data){
... ... @@ -56,7 +60,7 @@ class IndexedPages extends BaseCommands
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->pluck('api_no', 'project_id')->toArray();
Log::channel('rank_data')->info('开始-页面收录数据-'.count($list));
$list[2104] = 11201;
foreach ($list as $project_id => $api_no) {
Log::channel('rank_data')->info('开始-页面收录数据-' . $project_id . '->' .$api_no);
$rankDataLogic = new RankDataLogic();
... ...
... ... @@ -48,7 +48,11 @@ class RankData extends BaseCommands
Cache::set('clear_remain_today_' . date('Y-m-d'), 1, 24 * 3600);
}
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->select('api_no', 'project_id')->orderBy('project_id', 'asc')->get();
$list = DeployOptimize::where('api_no', '>', 0)->select('api_no', 'project_id')->orderBy('project_id', 'asc')->get()->toArray();
//特殊项目 一个项目多个apino
$list[] = ['api_no' => 11201, 'project_id' => 2104];
$list[] = ['api_no' => 10690, 'project_id' => 2104];
Log::channel('rank_data')->info('开始-排名数据-' . count($list));
foreach ($list as $item){
RankDataLogModel::addTask($item['project_id'], $item['api_no']);
... ... @@ -56,6 +60,7 @@ class RankData extends BaseCommands
//小语种
$api = new QuanqiusouApi();
$lang_list = $api->getLangList();
foreach ($list as $item){
$langs = $lang_list[$item['api_no']] ?? [];
foreach ($langs as $lang){
... ...
... ... @@ -76,7 +76,7 @@ class RankDataLog extends BaseCommands
$log->data = Arr::s2a($res);
//保存数据
$this->output('保存排名数据:ID'.$log->project_id . ',APINO' . $log->api_no);
$is_compliance = (new RankDataLogic())->save_rank($log->project_id, $res, null, $log->lang);
$is_compliance = (new RankDataLogic())->save_rank($log->project_id, $log->api_no, $res, null, $log->lang);
$log->is_compliance = $is_compliance;
$log->status = 1;
$log->save();
... ...
... ... @@ -73,6 +73,8 @@ class RankDataTask extends Command
$rankDataLogic->syncSpeed($item['data']['api_no'], true);
//每周排名数据
$rankDataLogic->syncRankWeek($item['data']['api_no'], true);
//收录数
$rankDataLogic->syncIndexedPages($item['data']['api_no'], true);
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
... ...
... ... @@ -36,6 +36,8 @@ class RankWeek extends BaseCommands
{
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->pluck('api_no', 'project_id')->toArray();
//特殊处理
$list[2104] = 11201;
LogUtils::info('start rank_data_week:' . count($list));
foreach ($list as $project_id => $api_no) {
$rankDataLogic = new RankDataLogic();
... ...
... ... @@ -36,6 +36,8 @@ class RecommDomain extends BaseCommands
{
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->select('domain', 'api_no', 'project_id')->get()->toArray();
//特殊处理
$list[] = ['api_no' => 11201, 'project_id' => 2104];
Log::channel('rank_data')->info('开始-外链引荐域名数据-'.count($list));
foreach ($list as $item) {
... ...
... ... @@ -7,7 +7,7 @@
* @time :2024/4/17 10:05
*/
namespace App\Console\Commands\Sync;
namespace App\Console\Commands\SyncFilesImage;
use App\Models\File\ErrorFile;
use Illuminate\Console\Command;
... ...
... ... @@ -7,7 +7,7 @@
* @time :2024/9/11 10:39
*/
namespace App\Console\Commands\Sync;
namespace App\Console\Commands\SyncFilesImage;
use App\Models\File\Image;
use App\Models\File\ImageSetting;
... ...
... ... @@ -7,7 +7,7 @@
* @time :2024/8/14 14:23
*/
namespace App\Console\Commands\Sync;
namespace App\Console\Commands\SyncFilesImage;
use App\Models\File\ErrorFile;
use App\Models\File\File;
... ...
<?php
/**
* @remark :
* @name :UpdateBuildConfiguration.php
* @author :lyh
* @method :post
* @time :2024/12/11 11:30
*/
namespace App\Console\Commands\Test;
use App\Models\Product\Detail;
use App\Models\Product\Product;
use App\Models\Project\DeployBuild;
use App\Models\Project\Project;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class UpdateBuildConfiguration extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'update_build_configuration';
/**
* The console command description.
*
* @var string
*/
protected $description = '更新部署表中-产品-博客-新闻-是否开启可视化';
/**
* @remark :执行脚本
* @name :handle
* @author :lyh
* @method :post
* @time :2024/12/11 11:49
*/
public function handle(){
//查询当前的所有项目都开启可视化
$buildModel = new DeployBuild();
$lists = $buildModel->list();
foreach ($lists as $k => $v){
$v['configuration']['is_product'] = $v['configuration']['is_news'] = $v['configuration']['is_blogs'] = $v['configuration']['is_module'] = 1;
$buildModel->edit(['configuration'=>json_encode($v['configuration'],true)],['id'=>$v['id']]);
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
}
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
/**
* @remark :清洗产品新描述数据
* @name :handles
* @author :lyh
* @method :post
* @time :2024/12/11 14:33
*/
public function handles(){
$projectModel = new Project();
$list = $projectModel->list(['delete_status'=>0]);
foreach ($list as $k => $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$this->getProduct();
DB::disconnect('custom_mysql');
}
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
/**
* @remark :清洗产品新描述
* @name :getProduct
* @author :lyh
* @method :post
* @time :2024/12/11 14:40
*/
public function getProduct(){
$productModel = new Product();
$lists = $productModel->list();
$detailModel = new Detail();
foreach ($lists as $k => $v){
echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
$data = [
'product_id'=>$v['id'],
'column_id'=>1,
'text_type'=>1,
'title'=>'',
'sort'=>1,
'content'=>$v['describe']
];
$detailModel->add($data);
}
}
}
... ...
... ... @@ -1008,8 +1008,8 @@ if (!function_exists('check_domain_record')) {
*/
function email_desensitize($email){
$parts = explode('@', $email);
$username = $parts[0];
$domain = $parts[1];
$username = $parts[0] ?? '';
$domain = $parts[1] ?? '';
$maskedUsername = substr($username, 0, -4) . '****';
$maskedDomain = '****.' . substr($domain, -5);
return $maskedUsername . '@' . $maskedDomain;
... ...
... ... @@ -38,6 +38,12 @@ class NoticeController extends BaseController
{
LogUtils::info('notice rank_data', $this->param);
NoticeLog::createLog(NoticeLog::TYPE_RANK_DATA, $this->param);
//特殊项目 一个项目多个apino
if($this->param['api_no'] == 10690){
NoticeLog::createLog(NoticeLog::TYPE_RANK_DATA, ['api_no' => 11201]);
}
$this->response('success');
}
... ...
... ... @@ -49,11 +49,29 @@ class OptimizeController extends BaseController
if(!empty($lists) && !empty($lists['list'])){
$rankDataModel = new RankData();
foreach ($lists['list'] as $k => $v){
$data = $rankDataModel->read(['project_id'=>$v['id'],'lang'=>'','updated_date'=>date('Y-m-d')],['first_page_num','indexed_pages_num']);
$data = $rankDataModel->read(['project_id'=>$v['id'],'lang'=>''],['first_page_num','indexed_pages_num']);
$v['first_page_num'] = $data['first_page_num'] ?? 0;
$v['indexed_pages_num'] = $data['indexed_pages_num'] ?? 0;
$v['g'] = $this->getGNum($v['id']);
$v = $this->handleParam($v);
//特殊项目 两个api_no
if($v['id'] == 2104){
$keyword_num_map = [10690=>100, 11201 => 50];
$v['first_page_num'] = $v['indexed_pages_num'] = $v['g'] = $v['keyword_num'] = [];
foreach ($keyword_num_map as $api_no => $keyword_num){
$data = $rankDataModel->read(['project_id'=>$v['id'],'api_no' => $api_no, 'lang'=>''],['first_page_num','indexed_pages_num']);
$v['first_page_num'][] = $data['first_page_num'] ?? 0;
$v['indexed_pages_num'][] = $data['indexed_pages_num'] ?? 0;
$v['g'][] = $this->getGNum($v['id'], $api_no);
$v['keyword_num'][] = $keyword_num;
}
$v['first_page_num'] = implode(',', $v['first_page_num']);
$v['indexed_pages_num'] = implode(',', $v['indexed_pages_num']);
$v['g'] = implode(',', $v['g']);
$v['keyword_num'] = implode(',', $v['keyword_num']);
}
$lists['list'][$k] = $v;
}
}
... ... @@ -99,9 +117,12 @@ class OptimizeController extends BaseController
* @method :post
* @time :2024/1/6 11:12
*/
public function getGNum($project_id){
public function getGNum($project_id, $api_no = ''){
$num = 0;
$list = RankData::where('project_id', $project_id)->where('lang', '')->value('data') ?: [];
$list = RankData::where('project_id', $project_id)->where('lang', '')
->when($api_no, function ($query, $api_no) {
return $query->where('api_no', $api_no);
})->value('data') ?: [];
if(!empty($list)){
foreach ($list as $v) {
$last = Arr::last($v);
... ...
... ... @@ -157,7 +157,7 @@ class AdsController extends BaseController
}
$is_require_num = 0;
foreach ($target as $k=>$v){
if(empty($item['url'])){
if(empty($v['url'])){
unset($target[$k]);
}
}
... ...
... ... @@ -170,8 +170,10 @@ class InquiryController extends BaseController
//非正常登录的
if(($this->user['login_source']??0) != 2 && ($this->user['login_source']??0) != 3){
if(!empty($item['email']) && (strpos($item['email'], '@') !== false)){
$item['email'] = email_desensitize($item['email']);
}
//脱敏
!empty($item['email']) && $item['email'] = email_desensitize($item['email']);
!empty($item['phone']) && $item['phone'] = substr($item['phone'], 0, -4) . '****';
}
... ...
... ... @@ -327,14 +327,4 @@ class LoginController extends BaseController
return $data;
}
public function ceshi()
{
$cos = new CosService();
$cdnUrl = '/upload/p/1/image_other/2023-11/655d9c70b692e10129.png';
$data = [
'image' => '/upload/m/image_other/2024-06/logo-162-2-1.png',
'gravity' => 'center',
];
return $cos->addFieldImage($cdnUrl, $data,true);
}
}
... ...
... ... @@ -531,7 +531,7 @@ class CustomTemplateLogic extends BaseLogic
$info = $this->model->read(['id'=>$this->param['id']]);
$param = $this->setCustomTemplateParams($info);
$save_id = $this->model->insertGetId($param);
$route = RouteMap::setRoute($param['url'], RouteMap::SOURCE_PRODUCT, $save_id, $this->user['project_id']);
$route = RouteMap::setRoute($param['url'], RouteMap::SOURCE_PAGE, $save_id, $this->user['project_id']);
$this->model->edit(['route'=>$route],['id'=>$save_id]);
return $this->success(['id'=>$save_id]);
}
... ...
... ... @@ -208,6 +208,7 @@ class ProductLogic extends BaseLogic
public function editList(){
$category_ids = $this->param['category_id'];
$this->param['category_id'] = $this->handleListCategory($this->param['category_id']);
$keyword_arr = $this->param['keyword_id'];
$this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']);
if(isset($this->param['gallery']) && !empty($this->param['gallery'])){
foreach ($this->param['gallery'] as $k => $v){
... ... @@ -226,6 +227,7 @@ class ProductLogic extends BaseLogic
$this->model->edit($this->param,['id'=>$this->param['id']]);
//产品分类关联
CategoryRelated::saveRelated($this->param['id'], $category_ids);
KeywordRelated::saveRelated($this->param['id'],$keyword_arr);
}catch (\Exception $e){
$this->fail('系统错误,请连续管理员');
}
... ... @@ -696,9 +698,7 @@ class ProductLogic extends BaseLogic
}else{
$product = $this->model->read(['title' => $data[0]]);
}
if (!$product) {
$category_id = '';
$category_arr = [];
if ($data[2]??'') {
... ... @@ -817,9 +817,9 @@ class ProductLogic extends BaseLogic
$seo_description = substr(strip_tags($data[10]),0,200);
}
$seo_mate = [
'title' => $seo_title,
'keyword' => $seo_keywords,
'description' => $seo_description
'title' => $seo_title ?? '',
'keyword' => $seo_keywords ?? '',
'description' => $seo_description ?? ''
];
//处理参数
$attrs = [];
... ... @@ -877,7 +877,7 @@ class ProductLogic extends BaseLogic
'intro' => $intro,
'content' => $content,
'describe' => Arr::a2s($describe),
'seo_mate' => Arr::a2s($seo_mate),
'seo_mate' => Arr::a2s($seo_mate ?? []),
'created_uid' => $user_id,
'status' => Product::STATUS_ON
]
... ...
... ... @@ -45,17 +45,23 @@ class RankDataLogic extends BaseLogic
$project_id = $this->user['project_id'];
//查数据
$project = (new ProjectLogic())->getProjectInfo($project_id);
if(request('api_no')){
$api_no = request('api_no');
}else{
$api_no = $project['deploy_optimize']['api_no'] ?? 0;
}
$domain_info = (new DomainInfoLogic)->getDomainInfo($project_id);
$rank = RankData::where('project_id', $project_id)->first();
$rank = RankData::where('project_id', $project_id)->where('api_no', $api_no)->first();
if(empty($rank) && ($project['deploy_optimize']['api_no'] != 0)){
$data['langs_status'] = 1;
}
$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();
$rank_week = RankWeek::where('project_id', $project_id)->where('api_no', $api_no)->first();
$recomm_domain = RecommDomain::where('project_id', $project_id)->where('api_no', $api_no)->first();
$external_links = ExternalLinks::where('project_id', $project_id)->where('api_no', $api_no)->first();
$indexed_pages = IndexedPages::where('project_id', $project_id)->where('api_no', $api_no)->first();
$speed = Speed::where('project_id', $project_id)->first();
$api_no = $project['deploy_optimize']['api_no'] ?? '';
//排名数据
$data = [
'first_num' => $rank['first_num'] ?? 0,
... ... @@ -171,6 +177,13 @@ class RankDataLogic extends BaseLogic
'data' => $rank_week['data'] ?? [],
'labels' => $rank_week['date'] ?? [],
];
//多个api_no项目 切换api_no查看数据
if($project_id == 2104){
$data['other_api_no'] = $api_no == 10690 ? 11201 : 10690;
$data['other_api_no_source'] = $api_no == 10690 ? 'Yandex' : 'Google';
}
return $data;
}
... ... @@ -185,7 +198,12 @@ class RankDataLogic extends BaseLogic
$lang = $this->request['lang'] ?: '';
$project_id = $this->user['project_id'];
$project = (new ProjectLogic())->getProjectInfo($project_id);
$api_no = $project['deploy_optimize']['api_no'] ?? '';
if(request('api_no')){
$api_no = request('api_no');
}else{
$api_no = $project['deploy_optimize']['api_no'] ?? 0;
}
$domain = (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : '');
$domain_arr = parse_url($domain);
$domain = $domain_arr['host'] ?? $domain_arr['path'];
... ... @@ -197,7 +215,7 @@ class RankDataLogic extends BaseLogic
$ai_projects = $this->getAiProjects()['data'] ?? [];
$flg_ai = $this->getAiFlag($ai_projects, $domain);
$ai_domain = str_replace('www.', '', $this->getAiProjects($domain)['domain'] ?? '');
$list = RankData::where('project_id', $project_id)->where('lang', $lang)->value('data') ?: [];
$list = RankData::where('project_id', $project_id)->where('api_no', $api_no)->where('lang', $lang)->value('data') ?: [];
$list30 = []; //排名前三十的
$list30_0 = []; //排名前三十且近三天没有排名的
$list100 = []; //排名前100的
... ... @@ -389,6 +407,10 @@ class RankDataLogic extends BaseLogic
*/
public function syncRankData($api_no, $site_res, $force=false){
$project_ids = DeployOptimize::where('api_no', $api_no)->pluck('project_id');
//特殊处理
if($api_no == 11201){
$project_ids[] = 2104;
}
foreach ($project_ids as $project_id) {
Log::channel('rank_data')->info('开始查项目:' . $project_id);
$project = Project::find($project_id);
... ... @@ -406,7 +428,7 @@ class RankDataLogic extends BaseLogic
//收录数
$indexed_pages_num = $site_res[$api_no] ?? 0;
Log::channel('rank_data')->info('开始保存:' . $project_id);
$this->save_rank($project_id, $res, $indexed_pages_num);
$this->save_rank($project_id, $api_no, $res, $indexed_pages_num);
}
//有小语种的
$lang_list = $api->getLangList();
... ... @@ -436,7 +458,7 @@ class RankDataLogic extends BaseLogic
$data[Arr::last($v)['lang']][$keyword] = $v;
}
foreach ($data as $lang => $rank) {
$this->save_rank($project_id, $rank, 0, $lang);
$this->save_rank($project_id, $api_no, $rank, 0, $lang);
}
}
}
... ... @@ -453,7 +475,7 @@ class RankDataLogic extends BaseLogic
* @author zbj
* @date 2023/5/8
*/
public function save_rank($project_id, $data, $indexed_pages_num = null, string $lang = ''){
public function save_rank($project_id, $api_no, $data, $indexed_pages_num = null, string $lang = ''){
$without_project_ids = []; //不用处理排名的项目
$without_extension_project_ids = [658]; //是否达标只统计主词的
$extension_project_ids = [354]; //扩展词也到达标的
... ... @@ -461,6 +483,14 @@ class RankDataLogic extends BaseLogic
354,
1283
];//暂停项目id
//一个项目多个api_no
$multiple_api_no_project_ids = [
2104 => [
11201 => 50, //api_no => 关键词达标数
10690 => 100,
]
];
$first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0;
$first_page_without_extension_num = 0; //不算扩展词在首页的数量
$first_page_extension_num = 0; //扩展词在首页的数量
... ... @@ -503,6 +533,7 @@ class RankDataLogic extends BaseLogic
}
$where = [
'project_id' => $project_id,
'api_no' => $api_no,
'lang' => $lang
];
$model = RankData::where($where)->first();
... ... @@ -513,6 +544,10 @@ class RankDataLogic extends BaseLogic
$this->g_top_plan($project_id,$g_top_first_page_extension_num);
//保证关键词数
$keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');
//多api_no项目的保证关键词数
if(in_array($project_id, array_keys($multiple_api_no_project_ids))){
$keyword_num = $multiple_api_no_project_ids[$project_id][$api_no]??0;
}
$type = Project::where('id', $project_id)->value('type');
$model_is_compliance = $model->is_compliance;
$model->is_compliance = 0;
... ... @@ -530,8 +565,19 @@ class RankDataLogic extends BaseLogic
if (($model->updated_date != date('Y-m-d') || empty($model_is_compliance)) && !$lang) {
$compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0;
if(!in_array($project_id,$ceaseProjectId)){
//多api_no项目 要api_no都分别达标才算
if(in_array($project_id, array_keys($multiple_api_no_project_ids))){
$api_nos = array_keys($multiple_api_no_project_ids[$project_id]);
//今天其他api_no是否都达标了
$count = RankData::where('project_id', $project_id)->whereIn('api_no', $api_nos)->where('api_no', '<>', $api_no)->where('date', date('Y-m-d'))
->where('is_compliance', 1)->count();
if($count == count($api_nos) - 1){
Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day + 1]);
}
}else{
Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day + 1]);
Log::channel('rank_data')->info('项目' . $project_id . '达标天数+1:'. ($compliance_day + 1));
}
Log::channel('rank_data')->info('项目' . $project_id . '达标天数+1:' . ($compliance_day + 1));
}else{
Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day]);
Log::channel('rank_data')->info('项目' . $project_id . '暂停项目达标天数不加:'. ($compliance_day));
... ... @@ -543,6 +589,7 @@ class RankDataLogic extends BaseLogic
}
$model->compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0;
$model->project_id = $project_id;
$model->api_no = $api_no;
$model->first_num = $first_num;
$model->first_page_num = $first_page_num;
$model->first_three_pages_num = $first_three_pages_num;
... ... @@ -592,13 +639,17 @@ class RankDataLogic extends BaseLogic
*/
public function syncExternalLinks($api_no, $force=false){
$project_ids = DeployOptimize::where('api_no', $api_no)->pluck('domain', 'project_id');
//特殊处理
if($api_no == 11201){
$project_ids[2104] = 'www.xabcbiology.ru';
}
foreach ($project_ids as $project_id => $domain) {
if (!$domain) {
Log::channel('rank_data')->error('syncExternalLinks:未配置正式域名', ['project_id' => $project_id, 'api_no' => $api_no]);
continue;
}
$model = ExternalLinksModel::where('project_id', $project_id)->first();
$model = ExternalLinksModel::where('project_id', $project_id)->where('api_no', $api_no)->first();
if ($model && $model->updated_date >= getThisWeekStarDate() && !$force) {
//continue;
}
... ... @@ -630,6 +681,7 @@ class RankDataLogic extends BaseLogic
$data = $this->_data($project_id, $res['total']);
}
$model->project_id = $project_id;
$model->api_no = $api_no;
$model->total = $data['total'];
$model->data = $data['data'];
$model->updated_date = date('Y-m-d');
... ... @@ -679,12 +731,16 @@ class RankDataLogic extends BaseLogic
*/
public function syncRecommDomain($api_no, $force=false){
$project_ids = DeployOptimize::where('api_no', $api_no)->pluck('domain', 'project_id');
//特殊处理
if($api_no == 11201){
$project_ids[2104] = 'www.xabcbiology.ru';
}
foreach ($project_ids as $project_id => $domain) {
if (!$domain) {
Log::channel('rank_data')->error('syncRecommDomain:未配置正式域名', ['project_id' => $project_id, 'api_no' => $api_no]);
continue;
}
$model = RecommDomainModel::where('project_id', $project_id)->first();
$model = RecommDomainModel::where('project_id', $project_id)->where('api_no', $api_no)->first();
if ($model && $model->updated_date >= getThisWeekStarDate() && !$force) {
continue;
}
... ... @@ -716,6 +772,7 @@ class RankDataLogic extends BaseLogic
continue;
}
$model->project_id = $project_id;
$model->api_no = $api_no;
$model->data = $data;
$model->updated_date = date('Y-m-d');
$model->save();
... ... @@ -729,8 +786,12 @@ class RankDataLogic extends BaseLogic
*/
public function syncIndexedPages($api_no, $force=false){
$project_ids = DeployOptimize::where('api_no', $api_no)->pluck('domain', 'project_id');
//特殊处理
if($api_no == 11201){
$project_ids[2104] = 'www.xabcbiology.ru';
}
foreach ($project_ids as $project_id => $domain) {
$model = IndexedPagesModel::where('project_id', $project_id)->first();
$model = IndexedPagesModel::where('project_id', $project_id)->where('api_no', $api_no)->first();
if($model && $model->updated_date >= getThisWeekStarDate() && !$force){
continue;
}
... ... @@ -745,6 +806,7 @@ class RankDataLogic extends BaseLogic
continue;
}
$model->project_id = $project_id;
$model->api_no = $api_no;
$model->data = $res['data'];
$model->updated_date = date('Y-m-d');
$model->save();
... ... @@ -792,8 +854,12 @@ class RankDataLogic extends BaseLogic
*/
public function syncRankWeek($api_no, $force=false){
$project_ids = DeployOptimize::where('api_no', $api_no)->pluck('domain', 'project_id');
//特殊处理
if($api_no == 11201){
$project_ids[2104] = 'www.xabcbiology.ru';
}
foreach ($project_ids as $project_id => $domain) {
$rank_week = RankWeekModel::where('project_id', $project_id)->first();
$rank_week = RankWeekModel::where('project_id', $project_id)->where('api_no', $api_no)->first();
if ($rank_week && $rank_week->updated_date >= getThisWeekStarDate() && !$force) {
//本周数据已更新
continue;
... ... @@ -809,6 +875,7 @@ class RankDataLogic extends BaseLogic
$rank_week = new RankWeekModel();
}
$rank_week->project_id = $project_id;
$rank_week->api_no = $api_no;
$rank_week->data = $res['data'][$api_no] ?? [];
$rank_week->date = $res['date'];
$rank_week->updated_date = date('Y-m-d');
... ...
... ... @@ -33,7 +33,7 @@ class RatingLogic extends BaseLogic
$data = [
'company'=>$this->project['company'] ?? '',
'mobile'=>$this->user['mobile'],
'uptime'=>$this->project['uptime'],
'uptime'=>$this->project['uptime'] ?? '',
'domain'=>$this->user['domain'],
'question'=>$this->model->list(['type'=>$this->param['type']]),
'project_id'=>$this->user['project_id']
... ...
... ... @@ -56,6 +56,7 @@ class TranslateLogic extends BaseLogic
$param = $this->getRouteSource($this->param['url']);
$param['language_id'] = $this->param['language_id'];
$param['type'] = $this->param['type'];
$param['url'] = $this->param['url'];
$info = $this->model->with('translate_data')->where($param)->first();
//获取当前URl的所有文本内容
$text_array = $this->getUrlRead($url);
... ... @@ -279,7 +280,7 @@ class TranslateLogic extends BaseLogic
try {
$info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
if($info === false){
$sourceInfo = $this->getRouteSource($sendData['new_route']);
$sourceInfo = $this->getRouteSource($this->param['url']);
$param = [
'type'=>$this->param['type'] ?? 1,
'project_id'=>$this->user['project_id'],
... ... @@ -289,7 +290,8 @@ class TranslateLogic extends BaseLogic
'source'=>$sourceInfo['source'],
'source_id'=>$sourceInfo['source_id'],
'is_list'=>$sourceInfo['is_list'],
'is_custom'=>$sourceInfo['is_custom']
'is_custom'=>$sourceInfo['is_custom'],
'page'=>$sourceInfo['page'] ?? 0
];
$id = $this->model->addReturnId($param);
TranslateData::insert(['trans_id'=>$id,'data'=>json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]);
... ...
... ... @@ -30,7 +30,7 @@ class RankDataLog extends Base
public static function addTask($project_id, $api_no, $lang =''){
$date = date('Y-m-d');
$model = self::where('project_id', $project_id)->where('date', $date)->where('lang', $lang)->first();
$model = self::where('project_id', $project_id)->where('api_no', $api_no)->where('date', $date)->where('lang', $lang)->first();
if($model){
//已达标的
if($model->is_compliance){
... ...