作者 刘锟

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

... ... @@ -2,6 +2,7 @@
namespace App\Console\Commands\Domain;
use App\Models\Project\DeployOptimize;
use App\Models\Project\OnlineCheck;
use App\Models\Project\Project;
use Illuminate\Console\Command;
... ... @@ -22,6 +23,9 @@ class RemainDay extends Command
*/
protected $signature = 'remain_day';
protected $projectId = [
1434
];//需要单独处理的项目
/**
* The console command description.
*
... ... @@ -44,20 +48,29 @@ class RemainDay extends Command
*/
public function handle()
{
$list = Project::whereIn('type', [2,3,4])->get();
$list = Project::whereIn('type', [Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR])->get();
foreach ($list as $item){
if($item['type'] == Project::TYPE_TWO){
//获取当前项目的达标天数
$compliance_day = Project::where(['id' => $item['id']])->value('finish_remain_day') ?: 0;
$remain_day = $item['deploy_build']['service_duration'] - $compliance_day;
if(in_array($item->id,$this->projectId)){//已开始优化的时间结算
$optimizeModel = new DeployOptimize();
$opInfo = $optimizeModel->read(['project_id'=>$item->id],['start_date']);
if($opInfo === false){
continue;
}
$diff = time() - strtotime($opInfo['start_date'] ?? $item->uptime);
$remain_day = $item['deploy_build']['service_duration'] - floor($diff / (60 * 60 * 24));
}else{
//审核上线后开始
$check_time = OnlineCheck::where('project_id', $item['id'])->where('status', 1)->value('created_at') ?: '';
if(!$check_time){
$remain_day = $item['deploy_build']['service_duration'];
if($item['type'] == Project::TYPE_TWO){
//获取当前项目的达标天数
$compliance_day = $item->finish_remain_day ?? 0;
$remain_day = $item['deploy_build']['service_duration'] - $compliance_day;
}else{
$diff = time() - strtotime($check_time);
$remain_day = floor($diff / (60 * 60 * 24));
if($item->uptime){
$diff = time() - strtotime($item->uptime);
$item->finish_remain_day = floor($diff / (60 * 60 * 24));
$remain_day = $item['deploy_build']['service_duration'] - floor($diff / (60 * 60 * 24));
}else{
$remain_day = $item['deploy_build']['service_duration'];
}
}
}
$item->remain_day = $remain_day > 0 ? $remain_day : 0;
... ...
... ... @@ -10,6 +10,7 @@ use App\Models\Domain\DomainInfo;
use App\Models\Mail\Mail;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\ProjectKeyword;
use App\Models\Project\ProjectUpdateTdk;
use App\Models\User\User;
use App\Models\WebSetting\WebLanguage;
... ... @@ -375,7 +376,13 @@ class UpdateSeoTdk extends Command
$info = Cache::get($cache_key);
if(!$info){
$projectOptimizeModel = new DeployOptimize();
$info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description', 'main_keywords']);
$info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description']);
$projectKeywordModel = new ProjectKeyword();
$keywordInfo = $projectKeywordModel->read(['project_id'=>$project_id]);
$info['main_keyword'] = '';
if($keywordInfo === false){
$info['main_keyword'] = $keywordInfo['main_keyword'];
}
Cache::put($cache_key, $info, 600);
}
return $info;
... ... @@ -412,12 +419,12 @@ class UpdateSeoTdk extends Command
{
$str = '';
$info = $this->getDeployOptimize($project_id);
if (!empty($info['main_keywords'])) {
$main_keywords = explode("\r\n", $info['main_keywords']);
if (!empty($info['main_keyword'])) {
$main_keyword = explode("\r\n", $info['main_keyword']);
//随机取
shuffle($main_keywords);
$main_keywords = array_slice($main_keywords, 0, $num);
$str = implode(", ", $main_keywords);
shuffle($main_keyword);
$main_keyword = array_slice($main_keyword, 0, $num);
$str = implode(", ", $main_keyword);
}
return $str;
}
... ...
... ... @@ -10,6 +10,7 @@ use App\Models\Domain\DomainInfo;
use App\Models\Mail\Mail;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\ProjectKeyword;
use App\Models\Project\ProjectUpdateTdk;
use App\Models\User\User;
use App\Models\WebSetting\WebLanguage;
... ... @@ -373,7 +374,13 @@ class UpdateSeoTdkByTaskId extends Command
$info = Cache::get($cache_key);
if(!$info){
$projectOptimizeModel = new DeployOptimize();
$info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description', 'main_keywords']);
$info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description']);
$projectKeywordModel = new ProjectKeyword();
$keywordInfo = $projectKeywordModel->read(['project_id'=>$project_id]);
$info['main_keyword'] = '';
if($keywordInfo === false){
$info['main_keyword'] = $keywordInfo['main_keyword'];
}
Cache::put($cache_key, $info, 600);
}
return $info;
... ... @@ -410,12 +417,12 @@ class UpdateSeoTdkByTaskId extends Command
{
$str = '';
$info = $this->getDeployOptimize($project_id);
if (!empty($info['main_keywords'])) {
$main_keywords = explode("\r\n", $info['main_keywords']);
if (!empty($info['main_keyword'])) {
$main_keyword = explode("\r\n", $info['main_keyword']);
//随机取
shuffle($main_keywords);
$main_keywords = array_slice($main_keywords, 0, $num);
$str = implode(", ", $main_keywords);
shuffle($main_keyword);
$main_keyword = array_slice($main_keyword, 0, $num);
$str = implode(", ", $main_keyword);
}
return $str;
}
... ...
... ... @@ -48,7 +48,7 @@ class Demo extends Command
protected $description = 'demo';
public function handle(){
$this->synchronizationFile('/upload/p/1720/file/2024-07/4d.mp4');
$this->synchronizationFile('/upload/m/file/2024-07/tongli-haiyuan-keywords.pdf');
}
public function synchronizationFile($path_name){
... ...
... ... @@ -93,4 +93,9 @@ class TdkTest extends Command
}
}
}
public function ceshi(){
//under_ceshi
$model = new Cesjo();
}
}
... ...
... ... @@ -19,7 +19,7 @@ class Kernel extends ConsoleKernel
$schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块
$schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块
// $schedule->command('inspire')->hourly();
$schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长
$schedule->command('remain_day')->dailyAt('06:00')->withoutOverlapping(1); // 项目剩余服务时长
$schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
$schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次
$schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
... ...
... ... @@ -13,6 +13,7 @@ use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
use App\Models\Project\ProjectKeyword;
class KeywordsController extends BaseController
{
... ... @@ -24,9 +25,9 @@ class KeywordsController extends BaseController
* @time :2023/9/4 10:13
*/
public function lists(){
$projectDeployOptimizeModel = new DeployOptimize();
$ids = $projectDeployOptimizeModel->where('customer_keywords','like','%'.$this->map['search'].'%')
->orWhere('main_keywords', 'like' , '%'.$this->map['search'].'%')->pluck('project_id')->toArray();
$projectKeywordModel = new ProjectKeyword();
$ids = $projectKeywordModel->where('customer_keywords','like','%'.$this->map['search'].'%')
->orWhere('main_keyword', 'like' , '%'.$this->map['search'].'%')->pluck('project_id')->toArray();
$projectModel = new Project();
$lists = $projectModel->formatQuery(['id'=>['in',$ids]])->with('payment')->with('deploy_build')
->with('deploy_optimize')->with('domainInfo')->get()->toArray();
... ...
... ... @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\Keyword;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Models\Project\DeployOptimize;
use App\Models\Project\ProjectKeyword;
class ProjectKeywordController extends BaseController
{
... ... @@ -28,9 +29,16 @@ class ProjectKeywordController extends BaseController
if($info === false){
$this->response('success');
}
$data['search_keywords'] = $info['search_keywords'];
$data['customer_keywords'] = $info['customer_keywords'];
$data['brand_keyword'] = $info['brand_keyword'];
$projectKeywordModel = new ProjectKeyword();
$keywordInfo = $projectKeywordModel->read(['project_id'=>$this->user['project_id']]);
if($keywordInfo === false){
$data['search_keywords'] = '';
$data['customer_keywords'] = '';
$this->response('success',Code::SUCCESS,$data);
}
$data['search_keywords'] = $keywordInfo['search_keywords'];
$data['customer_keywords'] = $keywordInfo['customer_keywords'];
$this->response('success',Code::SUCCESS,$data);
}
... ...
... ... @@ -571,8 +571,8 @@ class ProductController extends BaseController
}
/**
* @remark :Ai发布新闻
* @name :sendAiNews
* @remark :Ai发布
* @name :sendAiProduct
* @author :lyh
* @method :post
* @time :2024/1/26 15:33
... ...
... ... @@ -236,8 +236,9 @@ class InquiryInfoLogic extends BaseLogic
public function getKeywordUrl($map){
$projectModel = new Project();
$lists = $projectModel->leftJoin('gl_project_deploy_optimize', 'gl_project_deploy_optimize.project_id', '=', 'gl_project.id')
->where('gl_project_deploy_optimize.main_keywords','like','%'.$map['keyword'].'%')
->orWhere('gl_project_deploy_optimize.customer_keywords','like','%'.$map['keyword'].'%')
->leftJoin('gl_project_keyword', 'gl_project_keyword.project_id', '=', 'gl_project.id')
->where('gl_project_keyword.main_keyword','like','%'.$map['keyword'].'%')
->orWhere('gl_project_keyword.customer_keywords','like','%'.$map['keyword'].'%')
->select($this->selectParam())->get();
if(!empty($lists)){
$lists = $lists->toArray();
... ...
... ... @@ -30,6 +30,7 @@ use App\Models\Project\InquiryFilterConfig;
use App\Models\Project\MinorLanguages;
use App\Models\Project\Payment;
use App\Models\Project\Project;
use App\Models\Project\ProjectKeyword;
use App\Models\Project\ProjectRenew;
use App\Models\Project\WebTrafficConfig;
use App\Models\RankData\ExternalLinks;
... ... @@ -71,7 +72,8 @@ class ProjectLogic extends BaseLogic
* @time :2023/7/28 17:11
*/
public function getProjectInfo($id){
$info = $this->model->with(['payment', 'deploy_build', 'deploy_optimize', 'online_check', 'project_after','inquiry_filter_config','web_traffic_config'])->where(['id'=>$id])->first()->toArray();
$info = $this->model->with(['payment', 'deploy_build', 'deploy_optimize', 'online_check',
'project_after','inquiry_filter_config','web_traffic_config','project_keyword'])->where(['id'=>$id])->first()->toArray();
$info['online_check']['name'] = (new Manage())->getName($info['online_check']['created_manage_id'] ?? 0);
$info['init_domain'] = $this->getInitDomain($info['serve_id'])['domain'];
if($info['extend_type'] != 0){
... ... @@ -157,6 +159,8 @@ class ProjectLogic extends BaseLogic
$this->saveProjectPayment($this->param['payment']);
//保存优化信息
$this->saveProjectDeployOptimize($this->param['deploy_optimize']);
//保存项目关键字
$this->saveProjectKeyword($this->param['project_keyword'] ?? [],$this->param['id']);
//保存售后信息
$this->saveProjectAfter($this->param['project_after']);
//单独保存小语种配置
... ... @@ -354,6 +358,30 @@ class ProjectLogic extends BaseLogic
}
/**
* @remark :保存项目关键字
* @name :saveProjectKeyword
* @author :lyh
* @method :post
* @time :2024/7/22 11:45
*/
public function saveProjectKeyword($project_keyword,$project_id){
$projectKeywordModel = new ProjectKeyword();
$info = $projectKeywordModel->read(['project_id'=>$project_id]);
$data = [
'main_keyword'=>$project_keyword['main_keyword'] ?? '',
'customer_keywords'=>$project_keyword['customer_keywords'] ?? '',
'search_keywords'=>$project_keyword['search_keywords'] ?? '',
];
if($info === false){
$data['project_id'] = $project_id;
$projectKeywordModel->addReturnId($data);
}else{
$projectKeywordModel->edit($data,['id'=>$info['id']]);
}
return $this->success();
}
/**
* @remark :保存为售后部署
* @name :saveProjectAfter
* @author :lyh
... ...
... ... @@ -8,6 +8,7 @@ use App\Helper\Translate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ai\AiCommand;
use App\Models\Project\DeployOptimize;
use App\Models\Project\ProjectKeyword;
use App\Models\WebSetting\WebLanguage;
use Illuminate\Support\Facades\Cache;
... ... @@ -43,14 +44,14 @@ class AiCommandLogic extends BaseLogic
$prompt = str_replace('{company name}', $company_name, $prompt);
}
if(strpos($prompt, '{core keywords 8}') !== false) {
$main_keywords = $this->getDeployOptimize('main_keywords');
if ($main_keywords) {
$main_keywords = explode("\r\n", $main_keywords);
$main_keyword = $this->getDeployOptimize('main_keyword');
if ($main_keyword) {
$main_keyword = explode("\r\n", $main_keyword);
//随机取
shuffle($main_keywords);
$main_keywords = array_slice($main_keywords, 0, 8);
$main_keywords = implode(", ", $main_keywords);
$prompt = str_replace('{core keywords 8}', $main_keywords, $prompt);
shuffle($main_keyword);
$main_keyword = array_slice($main_keyword, 0, 8);
$main_keyword = implode(", ", $main_keyword);
$prompt = str_replace('{core keywords 8}', $main_keyword, $prompt);
}else{
$prompt = '';
}
... ... @@ -99,7 +100,13 @@ class AiCommandLogic extends BaseLogic
$info = Cache::get($cache_key);
if(!$info){
$projectOptimizeModel = new DeployOptimize();
$info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description', 'main_keywords']);
$info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description']);
$projectKeywordModel = new ProjectKeyword();
$keywordInfo = $projectKeywordModel->read(['project_id'=>$project_id]);
$info['main_keyword'] = '';
if($keywordInfo === false){
$info['main_keyword'] = $keywordInfo['main_keyword'];
}
Cache::put($cache_key, $info, 600);
}
if($key){
... ...
... ... @@ -442,6 +442,24 @@ class BTemplateLogic extends BaseLogic
*/
public function handleVisualizationParam($html,$source, $is_list,$is_custom,$data){
if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//定制项目
//TODO::扩展模块定制单独处理
if($is_custom == BTemplate::IS_CUSTOM){
$customModuleModel = new CustomModule();
$info = $customModuleModel->read(['id'=>$source]);
if($info === false){
$this->fail('当前扩展模块不存在或已被删除');
}
//todo::扩展模块(列表页/详情页)定制
if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION) {
$data['html'] = $html;
$data['type'] = BTemplate::ALL_HTML;
}else{
$mainInfo = $this->handleTemplateHtml($html);
$data['main_html'] = $mainInfo['main_html'];
$data['main_css'] = $mainInfo['main_css'];
}
return $this->success($data);
}
$type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
//查看当前页面是否定制,是否开启可视化
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
... ... @@ -449,19 +467,6 @@ class BTemplateLogic extends BaseLogic
$data['html'] = $html;
$data['type'] = BTemplate::ALL_HTML;
}else{
//TODO::扩展模块定制单独处理
if($is_custom == BTemplate::IS_CUSTOM){
$customModuleModel = new CustomModule();
$info = $customModuleModel->read(['id'=>$source]);
if($info === false){
$this->fail('当前扩展模块不存在或已被删除');
}
//todo::扩展模块(列表页/详情页)定制
if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION) {
$data['html'] = $html;
$data['type'] = BTemplate::ALL_HTML;
}
}
$mainInfo = $this->handleTemplateHtml($html);
$data['main_html'] = $mainInfo['main_html'];
$data['main_css'] = $mainInfo['main_css'];
... ...
... ... @@ -424,7 +424,7 @@ class BlogLogic extends BaseLogic
public function copyBlogInfo(){
$info = $this->model->read(['id'=>$this->param['id']]);
$param = [
'name'=>$info['name']."-copy",
'name'=>$info['name']."-1",
'status'=>0,
'sort'=>$info['sort'],
'category_id'=>$info['category_id'],
... ...
... ... @@ -8,6 +8,7 @@ use App\Models\HomeCount\Count;
use App\Models\HomeCount\MonthCount;
use App\Models\Inquiry\InquiryFormData;
use App\Models\Project\DeployOptimize;
use App\Models\Project\ProjectKeyword;
use App\Services\ProjectServer;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
... ... @@ -85,8 +86,14 @@ class MonthCountLogic extends BaseLogic
* @time :2023/7/4 10:19
*/
public function getKeywordLists(){
$optimizeModel = new DeployOptimize();
$info = $optimizeModel->read(['project_id'=>$this->user['project_id']],['main_keywords','customer_keywords']);
$projectKeywordModel = new ProjectKeyword();
$info = $projectKeywordModel->read(['project_id'=>$this->user['project_id']],['main_keyword','customer_keywords']);
if($info === false){
$info = [
'main_keyword'=>'',
'customer_keywords'=>''
];
}
return $this->success($info);
}
}
... ...
... ... @@ -462,7 +462,7 @@ class NewsLogic extends BaseLogic
public function copyNewsInfo(){
$info = $this->model->read(['id'=>$this->param['id']]);
$param = [
'name'=>$info['name']."-copy",
'name'=>$info['name']."-1",
'status'=>0,
'sort'=>$info['sort'],
'category_id'=>$info['category_id'],
... ...
... ... @@ -299,6 +299,8 @@ class ProductLogic extends BaseLogic
}
if(isset($param['keyword_id']) && !empty($param['keyword_id'])){
$param['keyword_id'] = ','.Arr::arrToSet($param['keyword_id']).',';
}else{
$param['keyword_id'] = '';
}
$param['attrs'] = Arr::a2s($param['attrs'] ?? []);
$param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? '');
... ... @@ -434,8 +436,8 @@ class ProductLogic extends BaseLogic
public function setCopyProduct(){
$info = $this->model->read(['id'=>$this->param['id']]);
$param = $this->setProductParams($info);
DB::beginTransaction();
try {
// DB::beginTransaction();
// try {
$save_id = $this->model->insertGetId($param);
CategoryRelated::saveRelated($save_id, $info['category_id']);
$route = preg_replace('/-product.*/', '', $param['route']);
... ... @@ -446,11 +448,11 @@ class ProductLogic extends BaseLogic
$this->copyTemplate($this->param['id'],$info['project_id'],$save_id);
//同步扩展字段
$this->copyExtendInfo($info['id'],$save_id);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('复制失败,请联系管理员');
}
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('复制失败,请联系管理员');
// }
return $this->success(['id'=>$save_id]);
}
... ... @@ -537,7 +539,7 @@ class ProductLogic extends BaseLogic
public function setProductParams($info){
$param = [
'project_id'=>$info['project_id'],
'title'=>$info['title']."-copy",
'title'=>$info['title']."-1",
'attrs'=>Arr::a2s($info['attrs']),
'attr_id'=>Arr::arrToSet($info['attr_id']),
'category_id'=>!empty($info['category_id']) ? ','.Arr::arrToSet($info['category_id']).',' : '',
... ...
... ... @@ -316,7 +316,7 @@ class TranslateLogic extends BaseLogic
if(strtolower($route) == 'all'){
return $this->success($data);
}
if($route == 'index'){
if($route == 'index' || $route == '/'){
$data['source'] = 1;
return $this->success($data);
}
... ...
... ... @@ -231,7 +231,17 @@ class Project extends Base
return self::hasOne(After::class, 'project_id', 'id');
}
/**
* @remark :项目关键字
* @name :project_keyword
* @author :lyh
* @method :post
* @time :2024/7/22 11:38
*/
public function project_keyword()
{
return self::hasOne(ProjectKeyword::class, 'project_id', 'id');
}
/**
* 询盘过滤配置
* @return \Illuminate\Database\Eloquent\Relations\HasOne
... ...
<?php
/**
* @remark :
* @name :ProjectKeyword.php
* @author :lyh
* @method :post
* @time :2024/7/22 11:35
*/
namespace App\Models\Project;
use App\Models\Base;
class ProjectKeyword extends Base
{
//设置关联表名
protected $table = 'gl_project_keyword';
}
... ...
<?php
/**
* @remark :
* @name :toH.php
* @author :lyh
* @method :post
* @time :2024/7/23 14:14
*/
class toH
{
}
... ...