作者 张关杰

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate

... ... @@ -53,7 +53,6 @@ class HtmlCollect extends Command
protected function start_collect()
{
$tdk_project_ids = [714];
$task_id = $this->get_task();
if ($task_id === false) {
//所有项目采集完成
... ... @@ -109,9 +108,7 @@ class HtmlCollect extends Command
}
//提取页面tdk
if(in_array($project_id,$tdk_project_ids)){
$this->get_site_meta($new_html, $collect_info);
}
$this->get_site_meta($new_html, $collect_info);
$source_list = $this->html_preg($new_html, $project_id, $collect_info->domain, $old_info['web_url_domain'], $old_info['home_url']);
... ... @@ -218,7 +215,7 @@ class HtmlCollect extends Command
}
#Description
preg_match_all('/<meta name=[\'|\"]description[\'|\"]\s+[^>]*?content=[\'|\"]([\w\W]*?)[\'|\"]/', $html, $matches);
preg_match_all('/<meta\s+[^>]*?name=[\'|\"]description[\'|\"]\s+[^>]*?content=[\'|\"]([\w\W]*?)[\'|\"]/', $html, $matches);
if (!empty($matches[1])) {
$meta['description'] = substr($matches[1][0], 0, 255);
}
... ...
... ... @@ -55,10 +55,13 @@ class UpdateRoute extends Command
*/
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['id'=>426]);
$list = $projectModel->list(['id'=>433]);
$data = [];
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
// $this->delProductKeyword();
// $this->checkProduct($data,$v['id']);
// $this->getProduct();
$this->setProductKeyword();
// $this->getRouteMap();
... ... @@ -86,6 +89,18 @@ class UpdateRoute extends Command
}
}
public function delProductKeyword(){
$keywordModel = new Keyword();
$lists = $keywordModel->list(['status'=>1],'id',['id','title']);
foreach ($lists as $v){
echo date('Y-m-d H:i:s') . 'id:'.$v['id'] . PHP_EOL;
$info = $keywordModel->read(['id'=>['!=',$v['id'],'title'=>$v['title']]]);
if($info !== false){
$keywordModel->del(['id'=>$v['id']]);
}
}
}
/**
* @remark :写入
* @name :getProductKeyword
... ... @@ -152,12 +167,23 @@ class UpdateRoute extends Command
$lists = $productModel->list(['status'=>1]);
if(!empty($lists)){
foreach ($lists as $v){
$tag = "-product";
if (!(substr($v['route'], -strlen($tag)) === $tag)) {
echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL;
$route = $v['route'].$tag;
// 如果不是以 '-product' 结尾,则拼接上 '-product'
$route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
if(!empty($v['route'])){
$tag = "-product";
if (!(substr($v['route'], -strlen($tag)) === $tag)) {
echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL;
$route = $v['route'].$tag;
// 如果不是以 '-product' 结尾,则拼接上 '-product'
$route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
$productModel->edit(['route'=>$route],['id'=>$v['id']]);
}else{
// echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
// $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
// $productModel->edit(['route'=>$route],['id'=>$v['id']]);
}
}else{
echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
// $v['title'] = Translate::tran($v['title'], 'en');
$route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
$productModel->edit(['route'=>$route],['id'=>$v['id']]);
}
}
... ...
... ... @@ -317,7 +317,7 @@ class ProjectController extends BaseController
if($item['type'] != Project::TYPE_ZERO){
$data = APublicModel::getNumByProjectId($item['id']);
}
$manageModel = new Manage();
$manageModel = new ManageHr();
$item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0);
$item['build_leader'] = $manageModel->getName($item['leader_mid']);
$item['build_manager'] = $manageModel->getName($item['manager_mid']);
... ...
... ... @@ -114,7 +114,7 @@ class FileManageController extends BaseController
$hash = hash_file('md5', $file->getPathname());
$info = FileManage::where('hash', $hash)->first();
if($info){
$this->fail('文件已存在');
$this->fail('文件已存在'.$hash);
}
return [
... ...
... ... @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\Setting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\TranslateLogic;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\WebSetting\WebLanguage;
... ... @@ -94,16 +95,40 @@ class TranslateController extends BaseController
$routeMapModel = new RouteMap();
$list = $routeMapModel->list();
foreach ($list as $k => $v){
if(!empty($v['path'])){
if($v['path'] == 'blog'){
$v['path'] = $v['path'].'s';
//查看项目是5.0还是6.0
if($this->user['is_upgrade'] == Project::IS_UPGRADE_TRUE){//升级项目
if(!empty($v['path'])){
if($v['path'] == 'blog'){
$v['path'] = $v['path'].'s';
}
$route = $v['path'].'/'.$v['route'];
}else{
if($v['route'] == 'index'){
$v['route'] = '';
}
$route = $v['route'];
}
$route = $v['path'].'/'.$v['route'];
}else{
$route = $v['route'];
if(!empty($v['path'])){
if($v['path'] == 'blog'){
$v['path'] = $v['path'].'s';
}elseif ($v['path'] == RouteMap::PATH_NEWS_CATE){
$routeMapModel->edit(['path'=>''],['id'=>$v['id']]);
$v['path'] = '';
}elseif ($v['path'] == RouteMap::PATH_NEWS_CATE){
$routeMapModel->edit(['path'=>''],['id'=>$v['id']]);
$v['path'] = '';
}
$route = $v['path'].'/'.$v['route'];
}else{
if($v['route'] == 'index'){
$v['route'] = '';
}
$route = $v['route'];
}
}
$data[] = $this->user['domain'].$route;
}
$data[] = $this->user['domain'].$route;
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -510,7 +510,9 @@ class BTemplateLogic extends BaseLogic
$templateCommonModel->edit($data,['id'=>$commonInfo['id']]);
}
//更新所有界面的other
return $templateCommonModel->edit(['other'=>$handleInfo['other']],['project_id'=>$this->user['project_id'],'template_id'=>$template_id]);
if($template_id != 0){
return $templateCommonModel->edit(['other'=>$handleInfo['other']],['project_id'=>$this->user['project_id'],'template_id'=>$template_id]);
}
}
/**
... ...
... ... @@ -35,7 +35,7 @@ class TranslateLogic extends BaseLogic
*/
public function getTranslateList(){
$languageInfo = $this->getLanguage($this->param['language_id']);
$info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
$info = $this->model->read(['url'=>str_replace_url($this->param['url']),'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
//获取当前URl的所有文本内容
$new_key = $this->getUrlRead($this->param['url']);
if($info === false){
... ... @@ -64,6 +64,7 @@ class TranslateLogic extends BaseLogic
}
$this->success($data);
}
/**
* @remark :获取图片列表
* @name :imageList
... ... @@ -72,7 +73,7 @@ class TranslateLogic extends BaseLogic
* @time :2023/11/23 17:29
*/
public function getTranslateImageList(){
$info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
$info = $this->model->read(['url'=>str_replace_url($this->param['url']),'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
$data = [];
if($info === false){
$new_list = $this->getUrlImageRead($this->param['url']);
... ... @@ -213,7 +214,7 @@ class TranslateLogic extends BaseLogic
$param = [
'type'=>1,
'project_id'=>$this->user['project_id'],
'url'=>$this->param['url'],
'url'=>str_replace_url($this->param['url']),
'language_id'=>$this->param['language_id'],
'alias'=>$this->param['alias'],
];
... ...
... ... @@ -201,6 +201,7 @@ class UserLoginLogic
$info['domain'] = (!empty($project['deploy_optimize']['domain']) ?
((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? ''));
$info['is_customized'] = $project['is_customized'];
$info['is_upgrade'] = $project['is_upgrade'];
$info['is_upload_manage'] = $project['is_upload_manage'];
$info['is_show_blog'] = $project['is_show_blog'];
$info['upload_config'] = $project['upload_config'];
... ...