作者 刘锟

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

... ... @@ -35,7 +35,8 @@ class RemainDay extends Command
* @var 暂停的项目
*/
protected $ceaseProjectId = [
354
354,
1283
];//需要单独处理的项目
/**
* The console command description.
... ... @@ -77,14 +78,11 @@ class RemainDay extends Command
continue;
}
$diff = time() - strtotime($opInfo['start_date'] ?? $item->uptime);
$remain_day = $item['deploy_build']['service_duration'] + $item->pause_days - floor($diff / (60 * 60 * 24));
$remain_day = $item['deploy_build']['service_duration'] - floor($diff / (60 * 60 * 24));
}else{
if($item['type'] == Project::TYPE_TWO){
$compliance_day = ($item->finish_remain_day ?? 0);
if($item->finish_remain_day < $item->pause_days){
$item->pause_days = $item->finish_remain_day;
}
$remain_day = $item['deploy_build']['service_duration'] + $item->pause_days - $compliance_day;
$remain_day = $item['deploy_build']['service_duration'] - $compliance_day;
}else{
if($item->uptime){
$diff = time() - strtotime($item->uptime);
... ...
... ... @@ -99,7 +99,7 @@ class SendProduct extends Command
$start_date = date('Y-m-d H:i:s');
$end_date = date('Y-m-d 23:59:59');
$blogModel = new Blog();
$arr = $blogModel->formatQuery(['send_time'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url');
$arr = $blogModel->formatQuery(['release_at'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url');
$blogModel->edit(['status'=>1],['release_at'=>['between',[$start_date,$end_date]],'status'=>3]);
return $arr;
}
... ... @@ -115,7 +115,7 @@ class SendProduct extends Command
$start_date = date('Y-m-d H:i:s');
$end_date = date('Y-m-d 23:59:59');
$newsModel = new News();
$arr = $newsModel->formatQuery(['send_time'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url');
$arr = $newsModel->formatQuery(['release_at'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url');
$newsModel->edit(['status'=>1],['release_at'=>['between',[$start_date,$end_date]],'status'=>3]);
return $arr;
}
... ...
... ... @@ -9,6 +9,7 @@ namespace App\Console\Commands\Test;
use App\Helper\Arr;
use App\Helper\Translate;
use App\Models\Blog\Blog;
use App\Models\Blog\BlogCategory;
use App\Models\Com\KeywordVideoTask;
... ... @@ -58,65 +59,28 @@ class Demo extends Command
*/
protected $description = 'demo';
public static $main404Html = '<main>
<section data-section="section" data-screen="screen-large" class="section-404-wrap-block section-block-error404"
id="sectionIdyxqu938">
<div class="layout" data-unable="demo01-error404">
<img src="https://ecdn6.globalso.com/upload/m/image_other/2023-10/6528a87e594db30162.png" />
</div>
<p style="text-align: center">SORRY. THE PAGE HAS EITHER MOVED OR CANNOT BE FOUND.</p>
<style>
.section-block-error404 .layout {
height: 700px;
display: flex;
align-items: center;
justify-content: center;
}
.section-block-error404 img {
width: 400px;
}
@media only screen and (max-width:500) {
.section-block-error404 img {
max-width: 100%;
}
}
</style>
<script>
</script>
</section>
</main>';
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['is_upgrade'=>1]);
$data = [];
$list = $projectModel->list(['id'=>1659]);
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$this->init404Page($v['id']);
$this->getProduct();
DB::disconnect('custom_mysql');
}
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
public static function init404Page($project_id){
$time = date('Y-m-d H:i:s');
$info = DB::connection('custom_mysql')->table('gl_web_custom_template')->where('url',BCustomTemplate::NOT_FOUND_PAGE_URL)->first();
if(empty($info)) {
$data = [
'project_id' => $project_id,
'name' => BCustomTemplate::NOT_FOUND_PAGE_URL,
'status' => 1,
'url' => BCustomTemplate::NOT_FOUND_PAGE_URL,
'html' => self::$main404Html,
'html_style' => '<style id="globalsojs-styles"></style>',
'title' => '404-Page not found',
'description' => 'Sorry. The page has either moved or cannot be found.',
'created_at' => $time, 'updated_at' => $time];
$id = DB::connection('custom_mysql')->table('gl_web_custom_template')->insertGetId($data);
//路由
$info = DB::connection('custom_mysql')->table('gl_route_map')->first();
if(empty($info)) {
$data = ['project_id' => $project_id, 'source' => RouteMap::SOURCE_PAGE, 'source_id' => $id, 'route' => BCustomTemplate::NOT_FOUND_PAGE_URL, 'created_at' => $time, 'updated_at' => $time];
DB::connection('custom_mysql')->table('gl_route_map')->insert($data);
public function getProduct(){
$productModel = new Product();
$lists = $productModel->list(['status'=>['!=',2]]);
if(!empty($lists)){
foreach ($lists as $v){
if(!empty($v['route'])){
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']]);
}
}
}
}
... ...
... ... @@ -296,9 +296,10 @@ class WebTraffic extends Command
->leftJoin('gl_project_online_check as poc', 'poc.project_id', '=', 'gl_project.id')
->where('pdo.domain', '>', 0)
->where('poc.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)
->whereIn('gl_project.type', [Project::TYPE_TWO, Project::TYPE_FOUR])
->where('gl_project.type', Project::TYPE_TWO)
->where('gl_project.is_upgrade', 0) //非升级项目
->where('gl_project.main_lang_id', '<>', $ru_lang_id) //非俄语站
->WhereRaw("NOT FIND_IN_SET(2, `level`)") //非暂停优化
->where(function ($query) use ($type) {
if($type == 1){
//1-3个月项目
... ...
... ... @@ -329,9 +329,10 @@ class WebTrafficRussia extends Command
->leftJoin('gl_project_online_check as poc', 'poc.project_id', '=', 'gl_project.id')
->where('pdo.domain', '>', 0)
->where('poc.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)
->whereIn('gl_project.type', [Project::TYPE_TWO, Project::TYPE_FOUR])
->where('gl_project.type', Project::TYPE_TWO)
->where('gl_project.is_upgrade', 0) //非升级项目
->where('gl_project.main_lang_id', $ru_lang_id)// 俄语站
->WhereRaw("NOT FIND_IN_SET(2, `level`)") //非暂停优化
->where(function ($query) use ($type) {
if($type == 1){
//1-3个月项目
... ...
... ... @@ -325,10 +325,11 @@ class WebTrafficRussiaSpecial extends Command
->leftJoin('gl_project_online_check as poc', 'poc.project_id', '=', 'gl_project.id')
->where('pdo.domain', '>', 0)
->where('poc.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)
->whereIn('gl_project.type', [Project::TYPE_TWO, Project::TYPE_FOUR])
->where('gl_project.type', Project::TYPE_TWO)
->where('gl_project.is_upgrade', 0) //非升级项目
->where('gl_project.main_lang_id', $ru_lang_id)// 俄语站
->whereIn('gl_project.id', array_keys($projects))
->WhereRaw("NOT FIND_IN_SET(2, `level`)") //非暂停优化
->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->orderBy('project_id')->get();
//其他地方在引流的域名
// $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
... ...
... ... @@ -291,10 +291,11 @@ class WebTrafficSpecial extends Command
->leftJoin('gl_project_online_check as poc', 'poc.project_id', '=', 'gl_project.id')
->where('pdo.domain', '>', 0)
->where('poc.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)
->whereIn('gl_project.type', [Project::TYPE_TWO, Project::TYPE_FOUR])
->where('gl_project.type', Project::TYPE_TWO)
->where('gl_project.is_upgrade', 0) //非升级项目
->where('gl_project.main_lang_id', '<>', $ru_lang_id) //非俄语站
->whereIn('gl_project.id', array_keys($projects))
->WhereRaw("NOT FIND_IN_SET(2, `level`)") //非暂停优化
->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->orderBy('project_id')->get();
//其他地方在引流的域名
// $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
... ...
... ... @@ -35,7 +35,12 @@ class OaGlobalsoApi
public function order_info($order_id)
{
$api_url = $this->url . '/api/order_info?token='.$this->token.'&order_id='.$order_id;
$res = http_get($api_url,["charset" => "UTF-8"]);
// $res = http_get($api_url,["charset" => "UTF-8"]);
$client = new \GuzzleHttp\Client();
$data = $client->request('GET', $api_url, [
'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号
])->getBody()->getContents();
$res = json_decode($data, true);
return $res;
}
... ... @@ -53,7 +58,11 @@ class OaGlobalsoApi
];
try {
$res = HttpUtils::get($api_url, $params);
// $res = HttpUtils::get($api_url, $params);
$client = new \GuzzleHttp\Client();
$res = $client->request('GET', $api_url .'?'. http_build_query($params), [
'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号
])->getBody()->getContents();
$res = Arr::s2a($res);
} catch (\Exception | GuzzleException $e) {
errorLog('渠道信息', $params, $e);
... ...
... ... @@ -73,7 +73,11 @@ class BlogController extends BaseController
$query = $query->where('operator_id',$this->map['operator_id']);
}
if(isset($this->map['status'])){
$query = $query->where('status',$this->map['status']);
if($this->map['status'] == 0){
$query = $query->whereIn('status',[0,3]);
}else{
$query = $query->where('status',$this->map['status']);
}
}
if(isset($this->map['name']) && !empty($this->map['name'])){
$query = $query->where('name',$this->map['name'][0],'%'.$this->map['name'][1].'%');
... ...
... ... @@ -77,7 +77,11 @@ class NewsController extends BaseController
$query = $query->where('operator_id',$this->map['operator_id']);
}
if(isset($this->map['status'])){
$query = $query->where('status',$this->map['status']);
if($this->map['status'] == 0){
$query = $query->whereIn('status',[0,3]);
}else{
$query = $query->where('status',$this->map['status']);
}
}
if(isset($this->map['name']) && !empty($this->map['name'])){
$query = $query->where('name',$this->map['name'][0],'%'.$this->map['name'][1].'%');
... ...
... ... @@ -47,7 +47,7 @@ class ProductController extends BaseController
*/
public function index(Product $product)
{
$filed = ['id', 'project_id', 'title', 'sort' ,'thumb' ,'product_type' , 'route' ,
$filed = ['id', 'project_id', 'title', 'sort' ,'thumb' ,'product_type' , 'route' , 'intro' , 'content' ,
'category_id', 'keyword_id', 'status', 'created_uid', 'is_upgrade' ,'created_at', 'updated_at','six_read'];
$this->order = 'sort';
$query = $product->orderBy($this->order ,'desc')->orderBy('id','desc');
... ...
... ... @@ -219,7 +219,11 @@ class BlogLogic extends BaseLogic
if($v == 3){
$data[$k] = $this->model->where(['project_id'=>$this->user['project_id']])->count();
}else{
$data[$k] = $this->model->where(['status'=>$v,'project_id'=>$this->user['project_id']])->count();
if($v == 0){
$data[$k] = $this->model->formatQuery(['status' => ['in',[0,3]], 'project_id' => $this->user['project_id']])->count();
}else{
$data[$k] = $this->model->where(['status' => $v, 'project_id' => $this->user['project_id']])->count();
}
}
}
return $this->success($data);
... ...
... ... @@ -236,7 +236,11 @@ class NewsLogic extends BaseLogic
if ($v == 3) {
$data[$k] = $this->model->where(['project_id' => $this->user['project_id']])->count();
} else {
$data[$k] = $this->model->where(['status' => $v, 'project_id' => $this->user['project_id']])->count();
if($v == 0){
$data[$k] = $this->model->formatQuery(['status' => ['in',[0,3]], 'project_id' => $this->user['project_id']])->count();
}else{
$data[$k] = $this->model->where(['status' => $v, 'project_id' => $this->user['project_id']])->count();
}
}
}
return $this->success($data);
... ...
... ... @@ -447,7 +447,10 @@ class RankDataLogic extends BaseLogic
$without_project_ids = []; //不用处理排名的项目
$without_extension_project_ids = [658]; //是否达标只统计主词的
$extension_project_ids = [354]; //扩展词也到达标的
$ceaseProjectId = [
354,
1283
];//暂停项目id
$first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0;
$first_page_without_extension_num = 0; //不算扩展词在首页的数量
$first_page_extension_num = 0; //扩展词在首页的数量
... ... @@ -516,8 +519,13 @@ class RankDataLogic extends BaseLogic
//项目表更新
if (($model->updated_date != date('Y-m-d') || empty($model_is_compliance)) && !$lang) {
$compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0;
Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day + 1]);
Log::channel('rank_data')->info('项目' . $project_id . '达标天数+1:'. ($compliance_day + 1));
if(!in_array($project_id,$ceaseProjectId)){
Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day + 1]);
Log::channel('rank_data')->info('项目' . $project_id . '达标天数+1:'. ($compliance_day + 1));
}else{
Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day]);
Log::channel('rank_data')->info('项目' . $project_id . '暂停项目达标天数不加:'. ($compliance_day));
}
}
$model->is_compliance = 1;
} else {
... ...
... ... @@ -84,13 +84,14 @@ class Product extends Base
const STATUS_DRAFT = 0;
const STATUS_ON = 1;
const STATUS_RECYCLE = 2;
const STATUS_THREE = 3;
public static function statusMap(){
return [
self::STATUS_DRAFT => '草稿',
self::STATUS_ON => '已发布',
self::STATUS_RECYCLE => '回收站',
self::STATUS_THREE => '待发布',
];
}
... ...
... ... @@ -126,6 +126,19 @@ class SyncSubmitTaskService
//数组key转为小写
$data['data'] = array_change_key_case($data['data'], CASE_LOWER);
//特殊处理1986的表单
if($data['project_id'] == 1986){
$fields = ['乘用车', '商用车', '能源存储', '探索新业务'];
$form_fields = array_keys($data['data']);
if(array_intersect($form_fields, $fields)){
foreach ($fields as $field){
if (!isset($data['data'][$field])){
$data['data'][$field] = [];
}
}
}
}
$form_id = InquiryForm::getFromId($data['data']);
$data['referer'] = $this->handle_referer($data['referer']);
... ...