作者 张关杰

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

@@ -55,7 +55,7 @@ class UpdateRoute extends Command @@ -55,7 +55,7 @@ class UpdateRoute extends Command
55 */ 55 */
56 public function handle(){ 56 public function handle(){
57 $projectModel = new Project(); 57 $projectModel = new Project();
58 - $list = $projectModel->list(['id'=>358]); 58 + $list = $projectModel->list(['id'=>951]);
59 $data = []; 59 $data = [];
60 foreach ($list as $v){ 60 foreach ($list as $v){
61 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 61 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
@@ -266,7 +266,7 @@ class WebTraffic extends Command @@ -266,7 +266,7 @@ class WebTraffic extends Command
266 $page++; 266 $page++;
267 } 267 }
268 }catch (\Exception $e){ 268 }catch (\Exception $e){
269 - Log::channel('traffic')->error($e->getMessage()); 269 + Log::channel('traffic')->error("line" . $e->getLine() . ',error:' . $e->getMessage(), $e->getTrace());
270 } 270 }
271 } 271 }
272 272
@@ -299,22 +299,22 @@ class WebTraffic extends Command @@ -299,22 +299,22 @@ class WebTraffic extends Command
299 ->where('gl_project.is_upgrade', 0) //非升级项目 299 ->where('gl_project.is_upgrade', 0) //非升级项目
300 ->where('gl_project.main_lang_id', '<>', $ru_lang_id) //非俄语站 300 ->where('gl_project.main_lang_id', '<>', $ru_lang_id) //非俄语站
301 ->where(function ($query) use ($type) { 301 ->where(function ($query) use ($type) {
302 - if($type == 1){  
303 - //1-3个月项目  
304 - $startTime = Carbon::now()->addMonths(-4)->toDateString();  
305 - $endTime = Carbon::now()->addMonths(-1)->toDateString();  
306 - $query->whereBetween('pdo.start_date', [$startTime,$endTime]);  
307 - }elseif($type == 2){  
308 - //4-8个月项目  
309 - $startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();  
310 - $endTime = Carbon::now()->addMonths(-4)->endOfDay()->toDateTimeString();  
311 - $query->whereBetween('pdo.start_date', [$startTime,$endTime]);  
312 - }else{  
313 - //大于9个月项目  
314 - $startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();  
315 - $query->where('pdo.start_date', '<', $startTime);  
316 - }  
317 - })->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->get(); 302 + if($type == 1){
  303 + //1-3个月项目
  304 + $startTime = Carbon::now()->addMonths(-4)->toDateString();
  305 + $endTime = Carbon::now()->addMonths(-1)->toDateString();
  306 + $query->whereBetween('pdo.start_date', [$startTime,$endTime]);
  307 + }elseif($type == 2){
  308 + //4-8个月项目
  309 + $startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();
  310 + $endTime = Carbon::now()->addMonths(-4)->endOfDay()->toDateTimeString();
  311 + $query->whereBetween('pdo.start_date', [$startTime,$endTime]);
  312 + }else{
  313 + //大于9个月项目
  314 + $startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();
  315 + $query->where('pdo.start_date', '<', $startTime);
  316 + }
  317 + })->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->get();
318 //其他地方在引流的域名 318 //其他地方在引流的域名
319 $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray(); 319 $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
320 $data = []; 320 $data = [];
@@ -391,8 +391,8 @@ class WebTraffic extends Command @@ -391,8 +391,8 @@ class WebTraffic extends Command
391 foreach ($project_ids as $project_id){ 391 foreach ($project_ids as $project_id){
392 //引流配置 392 //引流配置
393 $config = WebTrafficConfig::getCacheInfoByProjectId($project_id); 393 $config = WebTrafficConfig::getCacheInfoByProjectId($project_id);
394 - $main_countries = $config->main_countries ? explode(',',$config->main_countries) : [];  
395 - $filter_countries = $config->filter_countries ? explode(',',$config->filter_countries) : []; 394 + $main_countries = !empty($config->main_countries) ? explode(',',$config->main_countries) : [];
  395 + $filter_countries = !empty($config->filter_countries) ? explode(',',$config->filter_countries) : [];
396 396
397 //根据地区随机取该地区的IP 397 //根据地区随机取该地区的IP
398 $ipdata = DB::table('gl_xunpan_ipdata')->whereIn('ip_area', $areas) 398 $ipdata = DB::table('gl_xunpan_ipdata')->whereIn('ip_area', $areas)
@@ -301,7 +301,7 @@ class WebTrafficRussia extends Command @@ -301,7 +301,7 @@ class WebTrafficRussia extends Command
301 $page++; 301 $page++;
302 } 302 }
303 }catch (\Exception $e){ 303 }catch (\Exception $e){
304 - Log::channel('traffic')->error("ru:line" . $e->getLine() . ',error:' . $e->getMessage()); 304 + Log::channel('traffic')->error("ru:line" . $e->getLine() . ',error:' . $e->getMessage(), $e->getTrace());
305 } 305 }
306 } 306 }
307 307
@@ -435,8 +435,8 @@ class WebTrafficRussia extends Command @@ -435,8 +435,8 @@ class WebTrafficRussia extends Command
435 $project_country = $country_ratio; 435 $project_country = $country_ratio;
436 //引流配置 436 //引流配置
437 $config = WebTrafficConfig::getCacheInfoByProjectId($project_id); 437 $config = WebTrafficConfig::getCacheInfoByProjectId($project_id);
438 - $main_countries = $config->main_countries ? explode(',', $config->main_countries) : [];  
439 - $filter_countries = $config->filter_countries ? explode(',', $config->filter_countries) : []; 438 + $main_countries = !empty($config->main_countries) ? explode(',',$config->main_countries) : [];
  439 + $filter_countries = !empty($config->filter_countries) ? explode(',',$config->filter_countries) : [];
440 //设置了主推的 440 //设置了主推的
441 if($main_countries){ 441 if($main_countries){
442 foreach ($project_country as $k => $v){ 442 foreach ($project_country as $k => $v){
@@ -301,7 +301,7 @@ class WebTrafficRussiaSpecial extends Command @@ -301,7 +301,7 @@ class WebTrafficRussiaSpecial extends Command
301 $page++; 301 $page++;
302 } 302 }
303 }catch (\Exception $e){ 303 }catch (\Exception $e){
304 - Log::channel('traffic')->error("ru:line" . $e->getLine() . ',error:' . $e->getMessage()); 304 + Log::channel('traffic')->error("ru special:line" . $e->getLine() . ',error:' . $e->getMessage(), $e->getTrace());
305 } 305 }
306 } 306 }
307 307
@@ -427,8 +427,8 @@ class WebTrafficRussiaSpecial extends Command @@ -427,8 +427,8 @@ class WebTrafficRussiaSpecial extends Command
427 $project_country = $country_ratio; 427 $project_country = $country_ratio;
428 //引流配置 428 //引流配置
429 $config = WebTrafficConfig::getCacheInfoByProjectId($project_id); 429 $config = WebTrafficConfig::getCacheInfoByProjectId($project_id);
430 - $main_countries = $config->main_countries ? explode(',', $config->main_countries) : [];  
431 - $filter_countries = $config->filter_countries ? explode(',', $config->filter_countries) : []; 430 + $main_countries = !empty($config->main_countries) ? explode(',',$config->main_countries) : [];
  431 + $filter_countries = !empty($config->filter_countries) ? explode(',',$config->filter_countries) : [];
432 //设置了主推的 432 //设置了主推的
433 if($main_countries){ 433 if($main_countries){
434 foreach ($project_country as $k => $v){ 434 foreach ($project_country as $k => $v){
@@ -265,7 +265,7 @@ class WebTrafficSpecial extends Command @@ -265,7 +265,7 @@ class WebTrafficSpecial extends Command
265 $page++; 265 $page++;
266 } 266 }
267 }catch (\Exception $e){ 267 }catch (\Exception $e){
268 - Log::channel('traffic')->error($e->getMessage()); 268 + Log::channel('traffic')->error("special line" . $e->getLine() . ',error:' . $e->getMessage(), $e->getTrace());
269 } 269 }
270 } 270 }
271 271
@@ -382,8 +382,8 @@ class WebTrafficSpecial extends Command @@ -382,8 +382,8 @@ class WebTrafficSpecial extends Command
382 foreach ($project_ids as $project_id){ 382 foreach ($project_ids as $project_id){
383 //引流配置 383 //引流配置
384 $config = WebTrafficConfig::getCacheInfoByProjectId($project_id); 384 $config = WebTrafficConfig::getCacheInfoByProjectId($project_id);
385 - $main_countries = $config->main_countries ? explode(',',$config->main_countries) : [];  
386 - $filter_countries = $config->filter_countries ? explode(',',$config->filter_countries) : []; 385 + $main_countries = !empty($config->main_countries) ? explode(',',$config->main_countries) : [];
  386 + $filter_countries = !empty($config->filter_countries) ? explode(',',$config->filter_countries) : [];
387 387
388 //根据地区随机取该地区的IP 388 //根据地区随机取该地区的IP
389 $ipdata = DB::table('gl_xunpan_ipdata')->whereIn('ip_area', $areas) 389 $ipdata = DB::table('gl_xunpan_ipdata')->whereIn('ip_area', $areas)
@@ -28,7 +28,7 @@ class DomainInfoController extends BaseController @@ -28,7 +28,7 @@ class DomainInfoController extends BaseController
28 { 28 {
29 $domainModel = new DomainInfo(); 29 $domainModel = new DomainInfo();
30 if(isset($this->map['domain']) && !empty($this->map['domain'])){ 30 if(isset($this->map['domain']) && !empty($this->map['domain'])){
31 - $this->map['domain'] = ['like','%'.$this->map['domain'],'%']; 31 + $this->map['domain'] = ['like','%'.$this->map['domain'].'%'];
32 } 32 }
33 $lists = $domainModel->lists($this->map,$this->page,$this->row,$this->order); 33 $lists = $domainModel->lists($this->map,$this->page,$this->row,$this->order);
34 if(!empty($lists)){ 34 if(!empty($lists)){
@@ -123,30 +123,43 @@ class BTemplateLogLogic extends BaseLogic @@ -123,30 +123,43 @@ class BTemplateLogLogic extends BaseLogic
123 $this->fail('当前数据不存在,或已被删除'); 123 $this->fail('当前数据不存在,或已被删除');
124 } 124 }
125 if($this->user['is_customized'] != BTemplate::IS_VISUALIZATION){ 125 if($this->user['is_customized'] != BTemplate::IS_VISUALIZATION){
126 - if(empty($info['other'])){  
127 - $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s'));  
128 - $info['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);  
129 - }  
130 - $html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other'].  
131 - $info['head_html'].$info['main_html'].$info['footer_html'];  
132 - $serviceSettingModel = new ServiceSettingModel();  
133 - $list = $serviceSettingModel->list(['type'=>2],'created_at');  
134 - //拼接html  
135 - foreach ($list as $v){  
136 - if($v['key'] == 'head'){  
137 - $html = $v['values'].$html;  
138 - }  
139 - if($v['key'] == 'footer'){  
140 - $html = $html.$v['values'];  
141 - }  
142 - } 126 + $html = $this->getTemplateHtml($info);
143 }else{ 127 }else{
144 $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 128 $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
145 if (in_array(1, $page_array)) {//首页是定制界面 129 if (in_array(1, $page_array)) {//首页是定制界面
146 $html = $info['text']; 130 $html = $info['text'];
  131 + }else{
  132 + $html = $this->getTemplateHtml($info);
147 } 133 }
148 } 134 }
149 return $this->success(['html'=>$html]); 135 return $this->success(['html'=>$html]);
150 } 136 }
151 137
  138 + /**
  139 + * @remark :生成界面
  140 + * @name :getTemplateHtml
  141 + * @author :lyh
  142 + * @method :post
  143 + * @time :2024/4/3 17:11
  144 + */
  145 + public function getTemplateHtml($info){
  146 + if(empty($info['other'])){
  147 + $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s'));
  148 + $info['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
  149 + }
  150 + $html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other'].
  151 + $info['head_html'].$info['main_html'].$info['footer_html'];
  152 + $serviceSettingModel = new ServiceSettingModel();
  153 + $list = $serviceSettingModel->list(['type'=>2],'created_at');
  154 + //拼接html
  155 + foreach ($list as $v){
  156 + if($v['key'] == 'head'){
  157 + $html = $v['values'].$html;
  158 + }
  159 + if($v['key'] == 'footer'){
  160 + $html = $html.$v['values'];
  161 + }
  162 + }
  163 + return $this->success($html);
  164 + }
152 } 165 }
@@ -5,6 +5,7 @@ namespace App\Http\Logic\Bside\HomeCount; @@ -5,6 +5,7 @@ namespace App\Http\Logic\Bside\HomeCount;
5 5
6 use App\Http\Logic\Bside\BaseLogic; 6 use App\Http\Logic\Bside\BaseLogic;
7 use App\Models\RouteMap\RouteMap; 7 use App\Models\RouteMap\RouteMap;
  8 +use App\Models\Template\BCustomTemplate;
8 use App\Models\Visit\Visit; 9 use App\Models\Visit\Visit;
9 use App\Models\Visit\VisitItem; 10 use App\Models\Visit\VisitItem;
10 use App\Models\HomeCount\Count; 11 use App\Models\HomeCount\Count;
@@ -117,7 +118,7 @@ class CountLogic extends BaseLogic @@ -117,7 +118,7 @@ class CountLogic extends BaseLogic
117 public function with_data_count(){ 118 public function with_data_count(){
118 $product_count = (new Product())->where(['project_id' => $this->user['project_id']])->count(); 119 $product_count = (new Product())->where(['project_id' => $this->user['project_id']])->count();
119 $news_count = (new News())->where(['project_id' => $this->user['project_id']])->count(); 120 $news_count = (new News())->where(['project_id' => $this->user['project_id']])->count();
120 - $page_count = (new RouteMap())->where(['project_id' => $this->user['project_id']])->count(); 121 + $page_count = (new BCustomTemplate())->where(['project_id' => $this->user['project_id'],'status'=>1])->count();
121 $data = [ 122 $data = [
122 'product_count' => $product_count, 123 'product_count' => $product_count,
123 'news_count' => $news_count, 124 'news_count' => $news_count,
@@ -81,8 +81,6 @@ class RatingLogic extends BaseLogic @@ -81,8 +81,6 @@ class RatingLogic extends BaseLogic
81 $str = trim($str,'&'); 81 $str = trim($str,'&');
82 $url = "http://www.quanqiusou.cn/extend_api/api/service_score.php?postid=$postId&token=$token&ftype=$fType&$str"; 82 $url = "http://www.quanqiusou.cn/extend_api/api/service_score.php?postid=$postId&token=$token&ftype=$fType&$str";
83 $rs = http_get($url,['charset=utf-8']); 83 $rs = http_get($url,['charset=utf-8']);
84 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($url, true) . PHP_EOL, FILE_APPEND);  
85 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($rs, true) . PHP_EOL, FILE_APPEND);  
86 return $rs; 84 return $rs;
87 } 85 }
88 } 86 }
@@ -56,7 +56,7 @@ class RouteMap extends Base @@ -56,7 +56,7 @@ class RouteMap extends Base
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 }else{ 58 }else{
59 - if(!preg_match('/^[a-zA-Z\s]+$/', $title)){ 59 + if(!preg_match('/[a-zA-Z]/', $title)){
60 $title = Translate::tran($title, 'en'); 60 $title = Translate::tran($title, 'en');
61 } 61 }
62 } 62 }