作者 刘锟

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

... ... @@ -16,8 +16,12 @@ use App\Models\Domain\DomainInfo;
use App\Models\Product\Keyword;
use App\Models\Product\Product;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BSettingTemplate;
use App\Models\Template\BTemplateCommon;
use App\Models\Template\Setting;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
... ... @@ -97,6 +101,7 @@ class VideoTask extends Command
$task_project->save();
continue;
}
$logo_bg = $this->getImage($domainInfo);
foreach ($keyword as $val) {
$log = KeywordVideoTaskLog::where(['project_id' => $task_project->project_id, 'keyword_id' => $val->id])->first();
if ($log){
... ... @@ -109,7 +114,7 @@ class VideoTask extends Command
'keyword' => $val->title,
'data' => json_encode(['url' => $keywordInfo['url'],'title' => $keywordInfo['title'],
'description' => $keywordInfo['keyword_content'], 'images' => $keywordInfo['product_list'],
'keywords' => $keywordInfo['keyword_list']]),
'keywords' => $keywordInfo['keyword_list'], 'logo_bg' => $logo_bg]),
'status' => KeywordVideoTaskLog::STATUS_INIT,
'updated_at' => date('Y-m-d H:i:s'),
'created_at' => date('Y-m-d H:i:s'),
... ... @@ -130,10 +135,11 @@ class VideoTask extends Command
public function sendSubTask()
{
$subTask = KeywordVideoTaskLog::where(['status' => KeywordVideoTaskLog::STATUS_INIT])->orderBy('id', 'asc')->limit($this->max_sub_task)->get();
if ($subTask->isEmpty())
if ($subTask->isEmpty()){
return true;
}
foreach ($subTask as $val) {
$valData = (array)json_decode($val->data);
$valData = json_decode($val->data,true);
$task_id = 'v6-' . uniqid();
$data = [
'project_data' => [
... ... @@ -141,7 +147,9 @@ class VideoTask extends Command
'title' => $valData['title'],
'keywords' => $valData['keywords'],
'description' => $valData['description'],
'images' => $valData['images']
'images' => $valData['images'],
'logo'=> $valData['logo_bg']['logo'] ?? '',
'bg'=> $valData['logo_bg']['bg'] ?? ''
],
'task_id' => $task_id,
'callback_url' => env('APP_URL') . '/api/video_task_callback',
... ... @@ -262,4 +270,24 @@ class VideoTask extends Command
return $data;
}
/**
* @remark :获取图片
* @name :getImage
* @author :lyh
* @method :post
* @time :2024/3/12 15:29
*/
public function getImage($domainInfo){
$dom = file_get_html('https://'.$domainInfo['domain'].'/');
$logoDom = $dom->find('.logo', 0)->find("img",0);
if($logoDom != null){
$logo = $logoDom->src;
}
$bgDom = $dom->find('.section-banner-wrap-block',0)->find('img', 0);
if($bgDom != null){
$bg = $bgDom->src;
}
$dom->clear();
return ['logo'=>$logo ?? '','bg'=>$bg ?? ''];
}
}
... ...
... ... @@ -265,7 +265,24 @@ class Demo extends Command
// print_r($include);
// }
public function handle(){
echo '加密字符串:'.md5('company_list+2024-03-05+prod_desc=led&total=10');
$domainModel = new DomainInfo();
$domainInfo = $domainModel->read(['project_id'=>1]);
if($domainInfo === false){
dd('11111');
}
$bg = '';
$logo = '';
$dom = file_get_html('https://'.$domainInfo['domain'].'/');
$logoDom = $dom->find('.logo', 0)->find("img",0);
if($logoDom != null){
$logo = $logoDom->src;
}
$bgDom = $dom->find('.section-banner-wrap-block',0)->find('img', 0);
if($bgDom != null){
$bg = $bgDom->src;
}
// return $logo;
dd(['logo'=>$logo ?? '','ng'=>$bg ?? '']);
// $projectModel = new Project();
// $list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]);
// foreach ($list as $v1){
... ...
... ... @@ -25,13 +25,13 @@ class Kernel extends ConsoleKernel
$schedule->command('rank_data_recomm_domain')->dailyAt('01:40')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次
$schedule->command('rank_data_week')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次
// $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次
$schedule->command('count')->dailyAt('00:30')->withoutOverlapping(1); //每天凌晨1点执行一次
// $schedule->command('count')->dailyAt('00:30')->withoutOverlapping(1); //每天凌晨1点执行一次
$schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次
$schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
$schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
$schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次
$schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次
$schedule->command('month_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计记录
// $schedule->command('month_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计记录
$schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录
$schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次
$schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次
... ... @@ -45,9 +45,9 @@ class Kernel extends ConsoleKernel
$schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商
// 每日推送视频任务
$schedule->command('video_task')->dailyAt('01:30')->withoutOverlapping(1);
$schedule->command('video_task')->dailyAt('03:30')->withoutOverlapping(1);
// 每日推送已完成视频任务项目生成对应界面
$schedule->command('notice_c')->dailyAt('02:00')->withoutOverlapping(1);
$schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1);
}
/**
... ...
... ... @@ -264,8 +264,8 @@ class ProjectController extends BaseController
if(isset($this->map['tech_mid'])){
$query = $query->where('gl_project_deploy_optimize.tech_mid',$this->map['tech_mid']);
}
if(isset($this->map['optimist_mid'])){
$query = $query->where('gl_project_deploy_optimize.optimist_mid',$this->map['optimist_mid']);
if(isset($this->map['optimize_optimist_mid'])){
$query = $query->where('gl_project_deploy_optimize.optimist_mid',$this->map['optimize_optimist_mid']);
}
return $query;
}
... ...
... ... @@ -34,7 +34,7 @@ class TranslateLogic extends BaseLogic
if($this->param['url'] == 'All'){
$info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
if(!empty($info) && !empty($info['data'])){
$translateInfo = json_decode($info['data'],JSON_UNESCAPED_UNICODE);
$translateInfo = json_decode($info['data']);
foreach ($translateInfo as $k => $v){
$data[] = [$k=>$v];
}
... ... @@ -52,13 +52,17 @@ class TranslateLogic extends BaseLogic
// 原始校对程序
$old_key = [];//key值组成数据
if($info !== false){
$data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE);
$data_read = json_decode($info['data']);
foreach ($data_read as $k => $v){
$old_key[] = trim($k);
// if(!in_array($k,$text_array)){
// $arr2[] = $k;
// }
// $old_key[] = $k;
$data[] = [$k => $v];
}
}else{
$arr2 = array_values(array_diff($text_array, $old_key));
}
$arr2 = array_values(array_diff($text_array, $old_key));
if(!empty($arr2)){
$i = 0;
TranslateText:
... ... @@ -77,10 +81,9 @@ class TranslateLogic extends BaseLogic
}else{
foreach ($arr2 as $k => $v){
$data[] = [
trim($v)=>$translate_list[$k]
$v=>$translate_list[$k]
];
}
}
}
return $this->success($data);
... ... @@ -99,7 +102,7 @@ class TranslateLogic extends BaseLogic
$info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
$data = [];
if(!empty($info) && !empty($info['data'])){
$translateInfo = json_decode($info['data'],JSON_UNESCAPED_UNICODE);
$translateInfo = json_decode($info['data']);
foreach ($translateInfo as $k => $v){
$data[] = [$k=>$v];
}
... ... @@ -120,7 +123,7 @@ class TranslateLogic extends BaseLogic
}
$new_list = $this->getUrlImageRead($url);
$old_list = [];
$data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE);
$data_read = json_decode($info['data']);
foreach ($data_read as $k=>$v){
$old_list[] = $k;
$data[] = [
... ... @@ -182,11 +185,12 @@ class TranslateLogic extends BaseLogic
if(FALSE !== strpos($country_class, 'country-flag')) {
continue;
}
$need_tran[] = trim(htmlspecialchars_decode(html_entity_decode($string)));
if(!in_array(htmlspecialchars_decode(html_entity_decode($string)),$need_tran)){
$need_tran[] = htmlspecialchars_decode(html_entity_decode($string));
}
}
$need_tran[] = $description ? $description->attr['content'] : '';
$need_tran[] = $keywords ? $keywords->attr['content'] : '';
$need_tran = array_unique($need_tran);
return $need_tran;
}
... ... @@ -250,10 +254,10 @@ class TranslateLogic extends BaseLogic
'language_id'=>$this->param['language_id'],
'alias'=>$this->param['alias'],
];
$param['data'] = json_encode($data,JSON_UNESCAPED_UNICODE);
$param['data'] = json_encode($data);
$this->model->add($param);
}else{
$data = json_encode($data,JSON_UNESCAPED_UNICODE);
$data = json_encode($data);
$this->model->edit(['data'=>$data],['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]);
}
}catch (\Exception $e){
... ...
... ... @@ -7,11 +7,8 @@
*/
namespace App\Services\Html;
use App\Enums\Common\Code;
use App\Models\Product\Keyword;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\WebSetting\WebSettingSeo;
use App\Services\TdkService;
class CreateHtmlService
... ...
... ... @@ -389,7 +389,6 @@ class TdkService{
$webSeoInfo = $webSeoModel->read(['project_id'=>$projectInfo['id']]);
//网站设置
$webSetting = $this->getWebSetting($projectInfo);
$titleContent = "";
$descriptionContent = "";
$keywordsContent = "";
if ($webCustomInfo !== false){
... ... @@ -434,7 +433,7 @@ class TdkService{
/**
* 新闻博客详情通用版块
*/
public function newsBlogTdk($info, $projectInfo, string $titleContent, $descriptionContent, $keywordsContent, array $tdkInfo): array
public function newsBlogTdk($info, $projectInfo, $titleContent, $descriptionContent, $keywordsContent, array $tdkInfo): array
{
if (!empty($info)) {
//seo拼接
... ...