作者 刘锟

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

@@ -143,7 +143,6 @@ class Count extends Command @@ -143,7 +143,6 @@ class Count extends Command
143 } 143 }
144 } 144 }
145 } 145 }
146 -  
147 //加上其他询盘 146 //加上其他询盘
148 ProjectServer::useProject($project_id); 147 ProjectServer::useProject($project_id);
149 $arr['inquiry_num'] += InquiryFormData::getCount(); 148 $arr['inquiry_num'] += InquiryFormData::getCount();
@@ -155,8 +154,6 @@ class Count extends Command @@ -155,8 +154,6 @@ class Count extends Command
155 $countryArr[$v1['country']] = $v1['count']; 154 $countryArr[$v1['country']] = $v1['count'];
156 } 155 }
157 } 156 }
158 -  
159 -  
160 arsort($countryArr); 157 arsort($countryArr);
161 $top20 = array_slice($countryArr, 0, 20, true); 158 $top20 = array_slice($countryArr, 0, 20, true);
162 $arr['country'] = json_encode($top20); 159 $arr['country'] = json_encode($top20);
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Console\Commands\Project; 3 namespace App\Console\Commands\Project;
4 4
  5 +use App\Helper\Translate;
5 use App\Models\Com\NoticeLog; 6 use App\Models\Com\NoticeLog;
6 use App\Models\Product\Keyword; 7 use App\Models\Product\Keyword;
7 use App\Models\RouteMap\RouteMap; 8 use App\Models\RouteMap\RouteMap;
@@ -80,7 +81,12 @@ class InitKeyword extends Command @@ -80,7 +81,12 @@ class InitKeyword extends Command
80 foreach ($keyword as $val) { 81 foreach ($keyword as $val) {
81 $this->output(' keywordID: ' . $val->id . ', title: ' . $val->title); 82 $this->output(' keywordID: ' . $val->id . ', title: ' . $val->title);
82 try { 83 try {
83 - $route = RouteMap::setRoute($val['title'],RouteMap::SOURCE_PRODUCT_KEYWORD, $val->id, $notice['data']['project_id']); 84 + if(contains_russian($val['title'])){
  85 + $title = Translate::tran($val['title'], 'en');
  86 + }else{
  87 + $title = $val['title'];
  88 + }
  89 + $route = RouteMap::setRoute($title,RouteMap::SOURCE_PRODUCT_KEYWORD, $val->id, $notice['data']['project_id']);
84 $val->route = $route; 90 $val->route = $route;
85 $val->save(); 91 $val->save();
86 } catch (\Exception $e) { 92 } catch (\Exception $e) {
@@ -199,7 +199,7 @@ class UpdateSeoTdk extends Command @@ -199,7 +199,7 @@ class UpdateSeoTdk extends Command
199 if($table == 'gl_product'){ 199 if($table == 'gl_product'){
200 foreach ($map as $field){ 200 foreach ($map as $field){
201 $field_arr = explode('.', $field); 201 $field_arr = explode('.', $field);
202 - $query->orWhereRaw('JSON_EXTRACT('.$field_arr[0].', "$.'.$field_arr[1].'") IS NULL OR JSON_EXTRACT('.$field_arr[0].', "$.'.$field_arr[1].'") = ""'); 202 + $query->orWhereRaw('JSON_CONTAINS('.$field_arr[0].', "null", "$.'.$field_arr[1].'") OR JSON_EXTRACT('.$field_arr[0].', "$.'.$field_arr[1].'") = ""');
203 } 203 }
204 }else{ 204 }else{
205 foreach ($map as $field){ 205 foreach ($map as $field){
@@ -16,8 +16,8 @@ class Kernel extends ConsoleKernel @@ -16,8 +16,8 @@ class Kernel extends ConsoleKernel
16 protected function schedule(Schedule $schedule) 16 protected function schedule(Schedule $schedule)
17 { 17 {
18 // 每日更新最新模块 18 // 每日更新最新模块
19 -// $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块  
20 -// $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块 19 + $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块
  20 + $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块
21 // $schedule->command('inspire')->hourly(); 21 // $schedule->command('inspire')->hourly();
22 $schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长 22 $schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长
23 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 23 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
@@ -119,6 +119,45 @@ if (!function_exists('http_get')) { @@ -119,6 +119,45 @@ if (!function_exists('http_get')) {
119 } 119 }
120 } 120 }
121 121
  122 +
  123 +if (!function_exists('curl_get')) {
  124 + function curl_get($url,$is_array=true)
  125 + {
  126 + $header = array(
  127 + 'Expect:',
  128 + 'Content-Type: application/json; charset=utf-8'
  129 + );
  130 + $ch = curl_init($url);
  131 + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  132 + curl_setopt($ch, CURLOPT_HEADER, false);
  133 + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  134 + curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246');
  135 + curl_setopt($ch, CURLOPT_AUTOREFERER, true);
  136 + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
  137 + curl_setopt($ch, CURLOPT_TIMEOUT, 120);
  138 + curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
  139 + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  140 + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  141 + curl_setopt($ch, CURLOPT_SSLVERSION, 'all');
  142 + curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  143 + $content = curl_exec($ch);
  144 + curl_close($ch);
  145 + return $is_array ? json_decode($content, true) : $content;
  146 + }
  147 +}
  148 +/**
  149 + * @remark :判断是否为俄语
  150 + * @name :contains_russian
  151 + * @author :lyh
  152 + * @method :post
  153 + * @time :2024/6/5 10:38
  154 + */
  155 +function contains_russian($text) {
  156 + // 使用正则表达式检查是否包含俄语字符
  157 + return preg_match('/[\x{0400}-\x{04FF}]/u', $text) > 0;
  158 +
  159 +}
  160 +
122 if (!function_exists('curl_c')) { 161 if (!function_exists('curl_c')) {
123 /** 162 /**
124 * @param $url 163 * @param $url
@@ -148,7 +187,6 @@ if (!function_exists('curl_c')) { @@ -148,7 +187,6 @@ if (!function_exists('curl_c')) {
148 $content = curl_exec($ch); 187 $content = curl_exec($ch);
149 $http_code = curl_getinfo($ch,CURLINFO_HTTP_CODE); 188 $http_code = curl_getinfo($ch,CURLINFO_HTTP_CODE);
150 curl_close($ch); 189 curl_close($ch);
151 -  
152 if($http_code == 200){ 190 if($http_code == 200){
153 return $is_array ? json_decode($content, true) : $content; 191 return $is_array ? json_decode($content, true) : $content;
154 }else{ 192 }else{
@@ -40,7 +40,8 @@ class PrivateController extends BaseController @@ -40,7 +40,8 @@ class PrivateController extends BaseController
40 $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id') 40 $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id')
41 ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id') 41 ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id')
42 ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') 42 ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id')
43 - ->whereIn('gl_project.type', [Project::TYPE_TWO, Project::TYPE_FOUR]) 43 + ->where('gl_project.type', Project::TYPE_TWO)
  44 + ->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制
44 ->where(function ($subQuery) { 45 ->where(function ($subQuery) {
45 $subQuery->orwhere('c.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE); 46 $subQuery->orwhere('c.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE);
46 }) 47 })
@@ -60,7 +60,7 @@ class KeywordVideoController extends BaseController @@ -60,7 +60,7 @@ class KeywordVideoController extends BaseController
60 * @time :2023/8/18 10:58 60 * @time :2023/8/18 10:58
61 */ 61 */
62 public function searchParam(&$query){ 62 public function searchParam(&$query){
63 - if(isset($this->map['title']) && is_array($this->map['title'])){ 63 + if(isset($this->map['title'])){
64 $query->where('gl_project.title','like','%'.$this->map['title'].'%'); 64 $query->where('gl_project.title','like','%'.$this->map['title'].'%');
65 } 65 }
66 if(isset($this->map['status'])){ 66 if(isset($this->map['status'])){
@@ -108,7 +108,6 @@ class KeywordVideoController extends BaseController @@ -108,7 +108,6 @@ class KeywordVideoController extends BaseController
108 if($info === false){ 108 if($info === false){
109 $this->response('请先设置域名',Code::SYSTEM_ERROR); 109 $this->response('请先设置域名',Code::SYSTEM_ERROR);
110 } 110 }
111 - $this->param['num'] = $this->param['number'];  
112 $rs = $keywordModel->add($this->param); 111 $rs = $keywordModel->add($this->param);
113 if($rs === false){ 112 if($rs === false){
114 $this->response('添加失败',Code::SYSTEM_ERROR); 113 $this->response('添加失败',Code::SYSTEM_ERROR);
@@ -262,7 +262,7 @@ class OptimizeController extends BaseController @@ -262,7 +262,7 @@ class OptimizeController extends BaseController
262 if(isset($this->map['test_domain']) && !empty($this->map['test_domain'])){ 262 if(isset($this->map['test_domain']) && !empty($this->map['test_domain'])){
263 $query = $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['test_domain'].'%'); 263 $query = $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['test_domain'].'%');
264 } 264 }
265 - $query = $query->whereIn('gl_project.type',[2,4]);//TODO::2,4代表优化项目 265 + $query = $query->where('gl_project.type',2);//TODO::2,4代表优化项目; 2024-06-05修改项目中台只显示为类型为2
266 $query->where(function ($subQuery) { 266 $query->where(function ($subQuery) {
267 $subQuery->orwhere('gl_project_online_check.qa_status',1)->orwhere('gl_project.is_upgrade',1); 267 $subQuery->orwhere('gl_project_online_check.qa_status',1)->orwhere('gl_project.is_upgrade',1);
268 }); 268 });
@@ -63,8 +63,7 @@ class ProjectController extends BaseController @@ -63,8 +63,7 @@ class ProjectController extends BaseController
63 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') 63 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
64 ->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id') 64 ->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id')
65 ->leftJoin('gl_web_setting_template', 'gl_project.id', '=', 'gl_web_setting_template.project_id') 65 ->leftJoin('gl_web_setting_template', 'gl_project.id', '=', 'gl_web_setting_template.project_id')
66 - ->where('gl_project.delete_status',Project::TYPE_ZERO)  
67 - ->where('gl_project.extend_type',Project::TYPE_ZERO); 66 + ->where('gl_project.delete_status',Project::TYPE_ZERO);
68 $query = $this->searchParam($query); 67 $query = $this->searchParam($query);
69 $query = $this->orderByList($query); 68 $query = $this->orderByList($query);
70 $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray(); 69 $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray();
@@ -368,7 +367,7 @@ class ProjectController extends BaseController @@ -368,7 +367,7 @@ class ProjectController extends BaseController
368 $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN); 367 $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN);
369 $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]); 368 $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]);
370 $item['collect_time'] = $item['is_upgrade'] ? UpdateLog::getProjectUpdate($item['id']) : ''; 369 $item['collect_time'] = $item['is_upgrade'] ? UpdateLog::getProjectUpdate($item['id']) : '';
371 - 370 +
372 return $item; 371 return $item;
373 } 372 }
374 373
@@ -87,6 +87,7 @@ class MonthReportController extends BaseController @@ -87,6 +87,7 @@ class MonthReportController extends BaseController
87 ])->count(); 87 ])->count();
88 $info['service_duration'] = $this->user['service_duration'];//服务天数 88 $info['service_duration'] = $this->user['service_duration'];//服务天数
89 $info['ip_total'] = (new Visit())->count();//ip总数 89 $info['ip_total'] = (new Visit())->count();//ip总数
  90 +
90 $info['remain_day'] = $this->user['remain_day'];//剩余服务天数 91 $info['remain_day'] = $this->user['remain_day'];//剩余服务天数
91 $info['speed'] = round((0.3 + mt_rand()/mt_getrandmax() * (1-0.3)),2); 92 $info['speed'] = round((0.3 + mt_rand()/mt_getrandmax() * (1-0.3)),2);
92 $this->response('success',Code::SUCCESS,$info); 93 $this->response('success',Code::SUCCESS,$info);
@@ -257,4 +257,25 @@ class BaseController extends Controller @@ -257,4 +257,25 @@ class BaseController extends Controller
257 } 257 }
258 return 0; 258 return 0;
259 } 259 }
  260 +
  261 + /**
  262 + * @remark :批量通知C端
  263 + * @name :sendHttpC
  264 + * @author :lyh
  265 + * @method :post
  266 + * @time :2024/6/6 10:26
  267 + */
  268 + public function sendHttpC($url = []){
  269 + //其他服务器:请求对应C端接口
  270 + $c_url = $this->user['domain'].'api/update_page/';
  271 + $param = [
  272 + 'project_id' => $this->user['project_id'],
  273 + 'type' => 1,
  274 + 'route' => 3,
  275 + 'url' => $url,
  276 + 'language'=> [],
  277 + 'is_sitemap' => 0
  278 + ];
  279 + return http_post($c_url, json_encode($param));
  280 + }
260 } 281 }
@@ -313,7 +313,7 @@ class NewsController extends BaseController @@ -313,7 +313,7 @@ class NewsController extends BaseController
313 ],[ 313 ],[
314 'keyword.required' => 'keyword不能为空', 314 'keyword.required' => 'keyword不能为空',
315 ]); 315 ]);
316 - $data = curl_c('http://gnews.globalso.com/gnews_news.php?keyword='.$this->param['keyword'],false); 316 + $data = curl_get('http://gnews.globalso.com/gnews_news.php?keyword='.$this->param['keyword'],true);
317 $this->response('success',Code::SUCCESS,$data); 317 $this->response('success',Code::SUCCESS,$data);
318 } 318 }
319 319
@@ -218,8 +218,17 @@ class KeywordController extends BaseController @@ -218,8 +218,17 @@ class KeywordController extends BaseController
218 'title.max' => '批量操作不能超过500条数据' 218 'title.max' => '批量操作不能超过500条数据'
219 ]); 219 ]);
220 $keywordModel = new Keyword(); 220 $keywordModel = new Keyword();
221 - foreach ($this->param['title'] as $v){  
222 - $keywordModel->edit(['is_video_keyword'=>$this->param['is_video_keyword']],['title'=>$v]); 221 + $rs = $keywordModel->edit(['is_video_keyword'=>$this->param['is_video_keyword']],['title'=>['in',$this->param['title']]]);
  222 + if($rs === false){
  223 + $this->fail('编辑失败,请联系管理员');
  224 + }
  225 + if($this->param['is_video_keyword'] == 1){
  226 + $url = [];
  227 + $keywordList = $keywordModel->list(['title'=>['in',$this->param['title']]],'id',['id','route','is_video_keyword']);
  228 + foreach ($keywordList as $v){
  229 + $url[] = $v['route'];
  230 + }
  231 + $this->sendHttpC($url);
223 } 232 }
224 $this->response('success'); 233 $this->response('success');
225 } 234 }
@@ -32,10 +32,8 @@ class BTemplateLabelController extends BaseController @@ -32,10 +32,8 @@ class BTemplateLabelController extends BaseController
32 */ 32 */
33 public function getUserLists(TemplateLabel $templateLabel){ 33 public function getUserLists(TemplateLabel $templateLabel){
34 $this->request->validate([ 34 $this->request->validate([
35 - 'template_id'=>'required',  
36 'type'=>'required', 35 'type'=>'required',
37 ],[ 36 ],[
38 - 'template_id.required' => '模版id不能为空',  
39 'type.required' => '模版类型不能为空不能为空', 37 'type.required' => '模版类型不能为空不能为空',
40 ]); 38 ]);
41 $data = $templateLabel->list($this->map); 39 $data = $templateLabel->list($this->map);
@@ -8,6 +8,7 @@ use App\Http\Logic\Bside\BTemplate\BTemplateModuleLogic; @@ -8,6 +8,7 @@ use App\Http\Logic\Bside\BTemplate\BTemplateModuleLogic;
8 use App\Http\Logic\Bside\BTemplate\BTemplateModuleProjectLogic; 8 use App\Http\Logic\Bside\BTemplate\BTemplateModuleProjectLogic;
9 use App\Models\Template\BModuleProject; 9 use App\Models\Template\BModuleProject;
10 use App\Models\Template\TemplateLabel; 10 use App\Models\Template\TemplateLabel;
  11 +use App\Models\Template\TemplateModule;
11 12
12 /** 13 /**
13 * @remark :左侧模块管理 14 * @remark :左侧模块管理
@@ -29,6 +30,8 @@ class BTemplateModuleController extends BaseController @@ -29,6 +30,8 @@ class BTemplateModuleController extends BaseController
29 $this->map['test_model'] = ['in',[0,1]]; 30 $this->map['test_model'] = ['in',[0,1]];
30 $this->map['project_id'] = 0; 31 $this->map['project_id'] = 0;
31 } 32 }
  33 + $templateLabel = new TemplateLabel();
  34 + $this->searchLabelName($templateLabel);
32 $data = []; 35 $data = [];
33 $list = $bTemplateModuleLogic->ModuleList($this->map,$this->order); 36 $list = $bTemplateModuleLogic->ModuleList($this->map,$this->order);
34 $data['list'] = $list; 37 $data['list'] = $list;
@@ -38,6 +41,22 @@ class BTemplateModuleController extends BaseController @@ -38,6 +41,22 @@ class BTemplateModuleController extends BaseController
38 } 41 }
39 42
40 /** 43 /**
  44 + * @remark :搜索label
  45 + * @name :searchLabelName
  46 + * @author :lyh
  47 + * @method :post
  48 + * @time :2024/6/3 11:11
  49 + */
  50 + public function searchLabelName($templateLabel){
  51 + if(isset($this->map['label_name']) && !empty($this->map['label_name'])){
  52 + $id_arr = $templateLabel->formatQuery(['name'=>['like','%'.$this->map['label_name'].'%'],'type'=>2])->pluck('template_id')->toArray();
  53 + $this->map['id'] = ['in',$id_arr];
  54 + unset($this->map['label_name']);
  55 + }
  56 + return true;
  57 + }
  58 +
  59 + /**
41 * @remark :获取详情 60 * @remark :获取详情
42 * @name :read 61 * @name :read
43 * @author :lyh 62 * @author :lyh
@@ -77,7 +96,8 @@ class BTemplateModuleController extends BaseController @@ -77,7 +96,8 @@ class BTemplateModuleController extends BaseController
77 ],[ 96 ],[
78 'id.required' => 'id不能为空', 97 'id.required' => 'id不能为空',
79 ]); 98 ]);
80 - $this->model->where('id', $this->param['id'])->increment('number'); 99 + $moduleModel = new TemplateModule();
  100 + $moduleModel->where('id', $this->param['id'])->increment('number');
81 $this->response('success'); 101 $this->response('success');
82 } 102 }
83 } 103 }
@@ -284,17 +284,19 @@ class ProjectLogic extends BaseLogic @@ -284,17 +284,19 @@ class ProjectLogic extends BaseLogic
284 $deploy_optimize['special'] = !empty($deploy_optimize['special']) ? ','.trim($deploy_optimize['special'],',').',' : ''; 284 $deploy_optimize['special'] = !empty($deploy_optimize['special']) ? ','.trim($deploy_optimize['special'],',').',' : '';
285 //是否更新了api_no 285 //是否更新了api_no
286 $api_no = DeployOptimize::where('id', $deploy_optimize['id'])->value('api_no'); 286 $api_no = DeployOptimize::where('id', $deploy_optimize['id'])->value('api_no');
287 - if($api_no != $deploy_optimize['api_no']){  
288 - if($deploy_optimize['api_no']){  
289 - NoticeLog::createLog(NoticeLog::TYPE_RANK_DATA, ['api_no' => $deploy_optimize['api_no'] ?: 0]);  
290 - }else{  
291 - //清空已有排名数据  
292 - RankData::where('project_id', $deploy_optimize['project_id'])->delete();  
293 - ExternalLinks::where('project_id', $deploy_optimize['project_id'])->delete();  
294 - IndexedPages::where('project_id', $deploy_optimize['project_id'])->delete();  
295 - RecommDomain::where('project_id', $deploy_optimize['project_id'])->delete();  
296 - Speed::where('project_id', $deploy_optimize['project_id'])->delete();  
297 - RankWeek::where('project_id', $deploy_optimize['project_id'])->delete(); 287 + if(!empty($api_no)){
  288 + if($api_no != $deploy_optimize['api_no']){
  289 + if($deploy_optimize['api_no']){
  290 + NoticeLog::createLog(NoticeLog::TYPE_RANK_DATA, ['api_no' => $deploy_optimize['api_no'] ?: 0]);
  291 + }else{
  292 + //清空已有排名数据
  293 + RankData::where('project_id', $deploy_optimize['project_id'])->delete();
  294 + ExternalLinks::where('project_id', $deploy_optimize['project_id'])->delete();
  295 + IndexedPages::where('project_id', $deploy_optimize['project_id'])->delete();
  296 + RecommDomain::where('project_id', $deploy_optimize['project_id'])->delete();
  297 + Speed::where('project_id', $deploy_optimize['project_id'])->delete();
  298 + RankWeek::where('project_id', $deploy_optimize['project_id'])->delete();
  299 + }
298 } 300 }
299 } 301 }
300 $deployOptimizeModel->edit($deploy_optimize,['id'=>$deploy_optimize['id']]); 302 $deployOptimizeModel->edit($deploy_optimize,['id'=>$deploy_optimize['id']]);
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 9
10 namespace App\Http\Logic\Bside\BTemplate; 10 namespace App\Http\Logic\Bside\BTemplate;
11 11
12 -use App\Http\Logic\Aside\BaseLogic; 12 +use App\Http\Logic\Bside\BaseLogic;
13 use App\Models\Template\TemplateLabel; 13 use App\Models\Template\TemplateLabel;
14 14
15 /** 15 /**
@@ -49,7 +49,7 @@ class BTemplateLabelLogic extends BaseLogic @@ -49,7 +49,7 @@ class BTemplateLabelLogic extends BaseLogic
49 }else{ 49 }else{
50 $info = $this->model->read(['name'=>$this->param['name'],'template_id'=>$this->param['template_id']],['id']); 50 $info = $this->model->read(['name'=>$this->param['name'],'template_id'=>$this->param['template_id']],['id']);
51 if($info === false){ 51 if($info === false){
52 - $this->param['manager_id'] = $this->manager['id']; 52 + $this->param['manager_id'] = $this->user['manager_id'] ?? 0;
53 $id = $this->model->addReturnId($this->param); 53 $id = $this->model->addReturnId($this->param);
54 }else{ 54 }else{
55 $id = $info['id']; 55 $id = $info['id'];
@@ -29,7 +29,7 @@ class BTemplateModuleLogic extends BaseLogic @@ -29,7 +29,7 @@ class BTemplateModuleLogic extends BaseLogic
29 $list = $this->model->list($map,$order,$filed); 29 $list = $this->model->list($map,$order,$filed);
30 $templateLabel = new TemplateLabel(); 30 $templateLabel = new TemplateLabel();
31 foreach ($list as $k => $v){ 31 foreach ($list as $k => $v){
32 - $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc',5); 32 + $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc');
33 $list[$k] = $v; 33 $list[$k] = $v;
34 } 34 }
35 return $this->success($list); 35 return $this->success($list);
@@ -11,6 +11,7 @@ namespace App\Http\Logic\Bside\BTemplate; @@ -11,6 +11,7 @@ namespace App\Http\Logic\Bside\BTemplate;
11 11
12 use App\Http\Logic\Bside\BaseLogic; 12 use App\Http\Logic\Bside\BaseLogic;
13 use App\Models\Template\BModuleProject; 13 use App\Models\Template\BModuleProject;
  14 +use App\Models\Template\TemplateLabel;
14 use App\Models\Template\TemplateModule; 15 use App\Models\Template\TemplateModule;
15 16
16 class BTemplateModuleProjectLogic extends BaseLogic 17 class BTemplateModuleProjectLogic extends BaseLogic
@@ -33,6 +34,11 @@ class BTemplateModuleProjectLogic extends BaseLogic @@ -33,6 +34,11 @@ class BTemplateModuleProjectLogic extends BaseLogic
33 $map['deleted_status'] = 0; 34 $map['deleted_status'] = 0;
34 $map['project_id'] = $this->user['project_id']; 35 $map['project_id'] = $this->user['project_id'];
35 $lists = $this->model->list($map,$order,$filed); 36 $lists = $this->model->list($map,$order,$filed);
  37 + $templateLabel = new TemplateLabel();
  38 + foreach ($lists as $k => $v){
  39 + $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc');
  40 + $lists[$k] = $v;
  41 + }
36 return $this->success($lists); 42 return $this->success($lists);
37 } 43 }
38 44
@@ -186,4 +186,25 @@ class BaseLogic extends Logic @@ -186,4 +186,25 @@ class BaseLogic extends Logic
186 } 186 }
187 return $this->success(); 187 return $this->success();
188 } 188 }
  189 +
  190 + /**
  191 + * @remark :批量通知C端
  192 + * @name :sendHttpC
  193 + * @author :lyh
  194 + * @method :post
  195 + * @time :2024/6/6 10:26
  196 + */
  197 + public function sendHttpC($url = []){
  198 + //其他服务器:请求对应C端接口
  199 + $c_url = $this->user['domain'].'api/update_page/';
  200 + $param = [
  201 + 'project_id' => $this->user['project_id'],
  202 + 'type' => 1,
  203 + 'route' => 3,
  204 + 'url' => $url,
  205 + 'language'=> [],
  206 + 'is_sitemap' => 0
  207 + ];
  208 + return http_post($c_url, json_encode($param));
  209 + }
189 } 210 }
@@ -61,9 +61,15 @@ class KeywordLogic extends BaseLogic @@ -61,9 +61,15 @@ class KeywordLogic extends BaseLogic
61 if($info !== false){ 61 if($info !== false){
62 $this->fail('当前title已存在'); 62 $this->fail('当前title已存在');
63 } 63 }
64 - //TODO::不能修改路由  
65 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_KEYWORD, $this->param['id'], $this->user['project_id']); 64 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_KEYWORD, $this->param['id'], $this->user['project_id']);
66 $this->param['route'] = $route; 65 $this->param['route'] = $route;
  66 + //todo::通知C端生成
  67 + if(isset($this->param['is_video_keyword']) && ($this->param['is_video_keyword'] == 1)){
  68 + $info = $this->model->read(['id'=>$this->param['id']],['id','is_video_keyword','video']);
  69 + if(($info['is_video_keyword'] != $this->param['is_video_keyword']) && ($info['video'] != null || $info['video'] != '')){
  70 + $this->sendHttpC([$route]);
  71 + }
  72 + }
67 $this->model->edit($this->param,['id'=>$this->param['id']]); 73 $this->model->edit($this->param,['id'=>$this->param['id']]);
68 $data = ['id'=>$this->param['id']]; 74 $data = ['id'=>$this->param['id']];
69 }else{ 75 }else{
@@ -125,10 +131,11 @@ class KeywordLogic extends BaseLogic @@ -125,10 +131,11 @@ class KeywordLogic extends BaseLogic
125 } 131 }
126 132
127 /** 133 /**
128 - * 批量添加关键词任务, 异步处理  
129 - * @return array  
130 - * @throws BsideGlobalException  
131 - * @throws \App\Exceptions\AsideGlobalException 134 + * @remark :批量添加关键词任务, 异步处理
  135 + * @name :batchAdd
  136 + * @author :lyh
  137 + * @method :post
  138 + * @time :2024/6/6 10:27
132 */ 139 */
133 public function batchAdd(){ 140 public function batchAdd(){
134 try { 141 try {
@@ -482,7 +482,7 @@ class RankDataLogic extends BaseLogic @@ -482,7 +482,7 @@ class RankDataLogic extends BaseLogic
482 $model = new RankData(); 482 $model = new RankData();
483 } 483 }
484 //g-top方案达标天数 484 //g-top方案达标天数
485 - $this->g_top_plan($project_id,$first_page_num); 485 + $this->g_top_plan($project_id,$first_page_without_extension_num);
486 //保证关键词数 486 //保证关键词数
487 $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num'); 487 $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');
488 $type = Project::where('id', $project_id)->value('type'); 488 $type = Project::where('id', $project_id)->value('type');
@@ -263,7 +263,7 @@ class TranslateLogic extends BaseLogic @@ -263,7 +263,7 @@ class TranslateLogic extends BaseLogic
263 if($info === false){ 263 if($info === false){
264 $sourceInfo = $this->getRouteSource($sendData['new_route']); 264 $sourceInfo = $this->getRouteSource($sendData['new_route']);
265 $param = [ 265 $param = [
266 - 'type'=>$this->param['type'], 266 + 'type'=>$this->param['type'] ?? 1,
267 'project_id'=>$this->user['project_id'], 267 'project_id'=>$this->user['project_id'],
268 'url'=>str_replace_url($this->param['url']), 268 'url'=>str_replace_url($this->param['url']),
269 'language_id'=>$this->param['language_id'], 269 'language_id'=>$this->param['language_id'],
@@ -55,10 +55,11 @@ class RouteMap extends Base @@ -55,10 +55,11 @@ class RouteMap extends Base
55 public static function generateRoute($title, $source, $source_id, $project_id){ 55 public static function generateRoute($title, $source, $source_id, $project_id){
56 if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $title)){ 56 if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $title)){
57 $title = Translate::tran($title, 'en'); 57 $title = Translate::tran($title, 'en');
58 - }elseif(preg_match('/^[\x{0400}-\x{04FF}]+$/u', $title)){  
59 - $title = Translate::tran($title, 'en'); 58 + }else{
  59 + if(contains_russian($title)){
  60 + $title = Translate::tran($title, 'en');
  61 + }
60 } 62 }
61 -  
62 $i=1; 63 $i=1;
63 $sign = generateRoute($title); 64 $sign = generateRoute($title);
64 $length = strlen($sign); 65 $length = strlen($sign);