作者 张关杰

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

... ... @@ -55,7 +55,7 @@ class UpdateRoute extends Command
*/
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['id'=>358]);
$list = $projectModel->list(['id'=>951]);
$data = [];
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
... ...
... ... @@ -266,7 +266,7 @@ class WebTraffic extends Command
$page++;
}
}catch (\Exception $e){
Log::channel('traffic')->error($e->getMessage());
Log::channel('traffic')->error("line" . $e->getLine() . ',error:' . $e->getMessage(), $e->getTrace());
}
}
... ... @@ -299,22 +299,22 @@ class WebTraffic extends Command
->where('gl_project.is_upgrade', 0) //非升级项目
->where('gl_project.main_lang_id', '<>', $ru_lang_id) //非俄语站
->where(function ($query) use ($type) {
if($type == 1){
//1-3个月项目
$startTime = Carbon::now()->addMonths(-4)->toDateString();
$endTime = Carbon::now()->addMonths(-1)->toDateString();
$query->whereBetween('pdo.start_date', [$startTime,$endTime]);
}elseif($type == 2){
//4-8个月项目
$startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();
$endTime = Carbon::now()->addMonths(-4)->endOfDay()->toDateTimeString();
$query->whereBetween('pdo.start_date', [$startTime,$endTime]);
}else{
//大于9个月项目
$startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();
$query->where('pdo.start_date', '<', $startTime);
}
})->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->get();
if($type == 1){
//1-3个月项目
$startTime = Carbon::now()->addMonths(-4)->toDateString();
$endTime = Carbon::now()->addMonths(-1)->toDateString();
$query->whereBetween('pdo.start_date', [$startTime,$endTime]);
}elseif($type == 2){
//4-8个月项目
$startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();
$endTime = Carbon::now()->addMonths(-4)->endOfDay()->toDateTimeString();
$query->whereBetween('pdo.start_date', [$startTime,$endTime]);
}else{
//大于9个月项目
$startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();
$query->where('pdo.start_date', '<', $startTime);
}
})->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->get();
//其他地方在引流的域名
$other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
$data = [];
... ... @@ -391,8 +391,8 @@ class WebTraffic extends Command
foreach ($project_ids as $project_id){
//引流配置
$config = WebTrafficConfig::getCacheInfoByProjectId($project_id);
$main_countries = $config->main_countries ? explode(',',$config->main_countries) : [];
$filter_countries = $config->filter_countries ? explode(',',$config->filter_countries) : [];
$main_countries = !empty($config->main_countries) ? explode(',',$config->main_countries) : [];
$filter_countries = !empty($config->filter_countries) ? explode(',',$config->filter_countries) : [];
//根据地区随机取该地区的IP
$ipdata = DB::table('gl_xunpan_ipdata')->whereIn('ip_area', $areas)
... ...
... ... @@ -301,7 +301,7 @@ class WebTrafficRussia extends Command
$page++;
}
}catch (\Exception $e){
Log::channel('traffic')->error("ru:line" . $e->getLine() . ',error:' . $e->getMessage());
Log::channel('traffic')->error("ru:line" . $e->getLine() . ',error:' . $e->getMessage(), $e->getTrace());
}
}
... ... @@ -435,8 +435,8 @@ class WebTrafficRussia extends Command
$project_country = $country_ratio;
//引流配置
$config = WebTrafficConfig::getCacheInfoByProjectId($project_id);
$main_countries = $config->main_countries ? explode(',', $config->main_countries) : [];
$filter_countries = $config->filter_countries ? explode(',', $config->filter_countries) : [];
$main_countries = !empty($config->main_countries) ? explode(',',$config->main_countries) : [];
$filter_countries = !empty($config->filter_countries) ? explode(',',$config->filter_countries) : [];
//设置了主推的
if($main_countries){
foreach ($project_country as $k => $v){
... ...
... ... @@ -301,7 +301,7 @@ class WebTrafficRussiaSpecial extends Command
$page++;
}
}catch (\Exception $e){
Log::channel('traffic')->error("ru:line" . $e->getLine() . ',error:' . $e->getMessage());
Log::channel('traffic')->error("ru special:line" . $e->getLine() . ',error:' . $e->getMessage(), $e->getTrace());
}
}
... ... @@ -427,8 +427,8 @@ class WebTrafficRussiaSpecial extends Command
$project_country = $country_ratio;
//引流配置
$config = WebTrafficConfig::getCacheInfoByProjectId($project_id);
$main_countries = $config->main_countries ? explode(',', $config->main_countries) : [];
$filter_countries = $config->filter_countries ? explode(',', $config->filter_countries) : [];
$main_countries = !empty($config->main_countries) ? explode(',',$config->main_countries) : [];
$filter_countries = !empty($config->filter_countries) ? explode(',',$config->filter_countries) : [];
//设置了主推的
if($main_countries){
foreach ($project_country as $k => $v){
... ...
... ... @@ -265,7 +265,7 @@ class WebTrafficSpecial extends Command
$page++;
}
}catch (\Exception $e){
Log::channel('traffic')->error($e->getMessage());
Log::channel('traffic')->error("special line" . $e->getLine() . ',error:' . $e->getMessage(), $e->getTrace());
}
}
... ... @@ -382,8 +382,8 @@ class WebTrafficSpecial extends Command
foreach ($project_ids as $project_id){
//引流配置
$config = WebTrafficConfig::getCacheInfoByProjectId($project_id);
$main_countries = $config->main_countries ? explode(',',$config->main_countries) : [];
$filter_countries = $config->filter_countries ? explode(',',$config->filter_countries) : [];
$main_countries = !empty($config->main_countries) ? explode(',',$config->main_countries) : [];
$filter_countries = !empty($config->filter_countries) ? explode(',',$config->filter_countries) : [];
//根据地区随机取该地区的IP
$ipdata = DB::table('gl_xunpan_ipdata')->whereIn('ip_area', $areas)
... ...
... ... @@ -28,7 +28,7 @@ class DomainInfoController extends BaseController
{
$domainModel = new DomainInfo();
if(isset($this->map['domain']) && !empty($this->map['domain'])){
$this->map['domain'] = ['like','%'.$this->map['domain'],'%'];
$this->map['domain'] = ['like','%'.$this->map['domain'].'%'];
}
$lists = $domainModel->lists($this->map,$this->page,$this->row,$this->order);
if(!empty($lists)){
... ...
... ... @@ -123,30 +123,43 @@ class BTemplateLogLogic extends BaseLogic
$this->fail('当前数据不存在,或已被删除');
}
if($this->user['is_customized'] != BTemplate::IS_VISUALIZATION){
if(empty($info['other'])){
$footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s'));
$info['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
}
$html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other'].
$info['head_html'].$info['main_html'].$info['footer_html'];
$serviceSettingModel = new ServiceSettingModel();
$list = $serviceSettingModel->list(['type'=>2],'created_at');
//拼接html
foreach ($list as $v){
if($v['key'] == 'head'){
$html = $v['values'].$html;
}
if($v['key'] == 'footer'){
$html = $html.$v['values'];
}
}
$html = $this->getTemplateHtml($info);
}else{
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
if (in_array(1, $page_array)) {//首页是定制界面
$html = $info['text'];
}else{
$html = $this->getTemplateHtml($info);
}
}
return $this->success(['html'=>$html]);
}
/**
* @remark :生成界面
* @name :getTemplateHtml
* @author :lyh
* @method :post
* @time :2024/4/3 17:11
*/
public function getTemplateHtml($info){
if(empty($info['other'])){
$footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s'));
$info['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
}
$html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other'].
$info['head_html'].$info['main_html'].$info['footer_html'];
$serviceSettingModel = new ServiceSettingModel();
$list = $serviceSettingModel->list(['type'=>2],'created_at');
//拼接html
foreach ($list as $v){
if($v['key'] == 'head'){
$html = $v['values'].$html;
}
if($v['key'] == 'footer'){
$html = $html.$v['values'];
}
}
return $this->success($html);
}
}
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Http\Logic\Bside\HomeCount;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BCustomTemplate;
use App\Models\Visit\Visit;
use App\Models\Visit\VisitItem;
use App\Models\HomeCount\Count;
... ... @@ -117,7 +118,7 @@ class CountLogic extends BaseLogic
public function with_data_count(){
$product_count = (new Product())->where(['project_id' => $this->user['project_id']])->count();
$news_count = (new News())->where(['project_id' => $this->user['project_id']])->count();
$page_count = (new RouteMap())->where(['project_id' => $this->user['project_id']])->count();
$page_count = (new BCustomTemplate())->where(['project_id' => $this->user['project_id'],'status'=>1])->count();
$data = [
'product_count' => $product_count,
'news_count' => $news_count,
... ...
... ... @@ -81,8 +81,6 @@ class RatingLogic extends BaseLogic
$str = trim($str,'&');
$url = "http://www.quanqiusou.cn/extend_api/api/service_score.php?postid=$postId&token=$token&ftype=$fType&$str";
$rs = http_get($url,['charset=utf-8']);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($url, true) . PHP_EOL, FILE_APPEND);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($rs, true) . PHP_EOL, FILE_APPEND);
return $rs;
}
}
... ...
... ... @@ -56,7 +56,7 @@ class RouteMap extends Base
if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $title)){
$title = Translate::tran($title, 'en');
}else{
if(!preg_match('/^[a-zA-Z\s]+$/', $title)){
if(!preg_match('/[a-zA-Z]/', $title)){
$title = Translate::tran($title, 'en');
}
}
... ...