作者 刘锟

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

... ... @@ -62,7 +62,7 @@ class RemainDay extends Command
$list = Project::whereIn('type', [Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR])->get();
foreach ($list as $item){
if(in_array($item->id,$this->ceaseProjectId)){//暂停的项目
if($item['type'] == Project::TYPE_TWO && $item->is_compliance == 1){
if(($item['type'] == Project::TYPE_TWO) && ($item->is_remain_today == 1)){
$item->pause_days = $item->pause_days + 1;
}
if($item['type'] != Project::TYPE_THREE){
... ... @@ -80,6 +80,9 @@ class RemainDay extends Command
}else{
if($item['type'] == Project::TYPE_TWO){
$compliance_day = $item->finish_remain_day ?? 0;
if($compliance_day == 0){
$item->pause_days = 0;
}
$remain_day = $item['deploy_build']['service_duration'] + $item->pause_days - $compliance_day;
}else{
if($item->uptime){
... ...
... ... @@ -189,11 +189,11 @@ class VideoTask extends Command
public function getProjectKeyword($number,$keywords = [])
{
$keyword_id = Keyword::where('video', null)->whereIn("title", $keywords)
$keyword_id = Keyword::where('video', null)->whereIn("title", $keywords)->whereNull('deleted_at')
->where('route', 'not like', '%-tag')->whereNotNull('keyword_content')->limit($number)->pluck('id')->toArray();
$need = $number - count($keyword_id);
if ($need > 0) {
$keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag')
$keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag')->whereNull('deleted_at')
->whereNotNull('keyword_content')->whereNotIn('id', $keyword_id)->orderBy('id','asc')->limit($need)->pluck('id')->toArray();
}
$keyword_arr_id = array_merge($keyword_id, $keyword_arr_id);
... ... @@ -318,8 +318,12 @@ class VideoTask extends Command
}
}
} else {
$image = $dom->find('.section-banner-wrap-block',0)->find('img', 0);
$image = $dom->find('.section-banner-wrap-block',0);
if($image != null){
$image = $image->find('img', 0);
}else{
$image = null;
}
}
if($image != null){
$bg = $image->src;
... ...
... ... @@ -10,8 +10,10 @@ namespace App\Console\Commands\Test;
use App\Helper\Arr;
use App\Models\Blog\Blog;
use App\Models\Blog\BlogCategory;
use App\Models\Com\KeywordVideoTask;
use App\Models\Com\KeywordVideoTaskLog;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\CustomModule\CustomModuleContent;
use App\Models\Devops\ServerConfig;
use App\Models\Devops\Servers;
... ... @@ -20,6 +22,8 @@ use App\Models\File\File;
use App\Models\File\File as FileModel;
use App\Models\File\Image;
use App\Models\File\Image as ImageModel;
use App\Models\News\News;
use App\Models\News\NewsCategory;
use App\Models\Product\Keyword;
use App\Models\Product\Product;
use App\Models\Project\DeployOptimize;
... ... @@ -52,25 +56,59 @@ class Demo extends Command
*/
protected $description = 'demo';
// public function handle(){
// $projectModel = new Project();
// $list = $projectModel->list(['id'=>503]);
// foreach ($list as $v){
// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
// ProjectServer::useProject($v['id']);
// $newsModel = new News();
// $blogList = $newsModel->list(['status'=>1],'id',['*'],'asc');
// foreach ($blogList as $blogV){
// $customContentModel = new CustomModuleContent();
// $id = $customContentModel->addReturnId([
// 'name'=>$blogV['name'],
// 'status'=>0,
// 'sort'=>$blogV['sort'],
// 'remark'=>$blogV['remark'],
// 'route'=>$blogV['url'],
// 'image'=>$blogV['image'],
// 'seo_title'=>$blogV['seo_title'],
// 'seo_keywords'=>$blogV['seo_keywords'],
// 'seo_description'=>$blogV['seo_description'],
// 'project_id'=>$blogV['project_id'],
// 'created_at'=>$blogV['created_at'],
// 'updated_at'=>$blogV['updated_at'],
// 'module_id'=>10,
// 'video'=>null,
// 'release_at'=>$blogV['release_at'],
// 'operator_id'=>$blogV['operator_id']
// ]);
// RouteMap::setRoute($blogV['url'],RouteMap::SOURCE_MODULE,$id,503);
// }
// DB::disconnect('custom_mysql');
// }
// }
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['type'=>['!=',0],'delete_status'=>0]);
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$templateComModel = new BTemplateCom();
$templateComModel->edit(['source'=>3,'is_list'=>1],['source'=>5,'is_list'=>0,'is_custom'=>0]);
$templateComModel->edit(['source'=>4,'is_list'=>1],['source'=>7,'is_list'=>0,'is_custom'=>0]);
DB::disconnect('custom_mysql');
ProjectServer::useProject(503);
$newsCate = new NewsCategory();
$newsList = $newsCate->list();
foreach ($newsList as $v){
$data = [
'name'=>$v['name'],
'status'=>0,
'sort'=>$v['sort'],
'pid'=>$v['pid'],
'route'=>$v['alias'],
'project_id'=>503,
'operator_id'=>$v['operator_id'],
'create_id'=>1101,
'module_id'=>10,
];
$moduleCateModel = new CustomModuleCategory();
$id = $moduleCateModel->addReturnId($data);
RouteMap::setRoute($v['alias'],RouteMap::SOURCE_MODULE_CATE,$id,503);
}
}
public function synchronizationFile($path_name){
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
DB::disconnect('custom_mysql');
}
}
... ...
... ... @@ -55,13 +55,13 @@ class UpdateRoute extends Command
*/
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['id'=>['in',[147]]]);
$list = $projectModel->list(['id'=>['in',[1535]]]);
$data = [];
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$this->getProduct();
// $this->setProductKeyword();
// $this->getProduct();
$this->setProductKeyword();
// $this->getBlog();
DB::disconnect('custom_mysql');
}
... ... @@ -215,7 +215,7 @@ class UpdateRoute extends Command
public function getProduct(){
$productModel = new Product();
$lists = $productModel->list(['status'=>2]);
$lists = $productModel->list(['status'=>['!=',2]]);
if(!empty($lists)){
foreach ($lists as $v){
if(!empty($v['route'])){
... ...
... ... @@ -177,4 +177,21 @@ class KeywordVideoController extends BaseController
$data['end_total'] = $keywordModel->formatQuery(['status'=>1])->count();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :当月视频总数量
* @name :getVideoCount
* @author :lyh
* @method :post
* @time :2024/8/14 9:58
*/
public function getVideoCount(){
// 当月的开始时间
$start_of_month = date("Y-m-01 00:00:00");
// 当月的结束时间:使用 strtotime() 计算最后一天
$end_of_month = date("Y-m-d 23:59:59", strtotime("last day of this month"));
$taskLogModel = new KeywordVideoTaskLog();
$count = $taskLogModel->formatQuery(['created_at'=>['between',[$start_of_month,$end_of_month]]])->count();
$this->response('success',Code::SUCCESS,['count'=>$count]);
}
}
... ...
... ... @@ -37,15 +37,19 @@ class LanguageTxtController extends BaseController
*/
public function saveLanguageTxt(){
$this->request->validate([
'name'=>'required',
'en_name'=>'required',
'data'=>'required',
],[
'name.required' => 'name不能为空',
'en_name'=>'自定义名称en_name不为空',
'data.required' => 'data不能为空',
]);
$languageTxtModel = new LanguageTxt();
$id = $languageTxtModel->addReturnId($this->param);
$this->response('success',Code::SUCCESS,['id'=>$id]);
foreach ($this->param['data'] as $v){
if(isset($v['id']) && !empty($v['id'])){
$languageTxtModel->edit(['en_name'=>$v['en_name']],['id'=>$v['id']]);
}else{
$languageTxtModel->addReturnId(['name'=>$v['name'], 'en_name'=>$v['en_name']]);
}
}
$this->response('success');
}
/**
... ...
... ... @@ -48,6 +48,11 @@ class AyrReleaseLogic extends BaseLogic
$info = $this->model->read(['platforms'=>$this->param['platforms'],'operator_id'=>$this->param['operator_id'],'project_id'=>$this->param['project_id'],'title'=>$this->param['title']]);
if($info === false){
$this->model->add($this->param);
}else{
$result_data = json_decode($this->param['result_data']);
if(isset($result_data['status']) && $result_data['status'] == 'success'){
$this->model->edit($this->param,['id'=>$info['id']]);
}
}
return $this->success();
}
... ...
... ... @@ -312,7 +312,8 @@ class TranslateLogic extends BaseLogic
* @time :2024/5/17 15:11
*/
public function getRouteSource($route){
$data = ['source'=>0,'source_id'=>0,'is_list'=>0,'is_custom'=>0];
$routes = $route;
$data = ['source'=>0,'source_id'=>0,'is_list'=>0,'is_custom'=>0,'page'=>0];
if(strtolower($route) == 'all'){
return $this->success($data);
}
... ... @@ -321,12 +322,20 @@ class TranslateLogic extends BaseLogic
return $this->success($data);
}
$route = basename($route);
$page = 0;
if (is_numeric($route)) {
$arr = explode('/',$routes);
$page = $arr[1];
$route = $arr[0];
}
$routeModel = new RouteMap();
$routeInfo = $routeModel->read(['route'=>$route]);
if($routeInfo === false){
return $data;
}
return $this->resultData($routeInfo,$data);
$data = $this->resultData($routeInfo,$data);
$data['page'] = $page;
return $data;
}
/**
... ...
<?php
/**
* @remark :
* @name :InquiryField.php
* @author :lyh
* @method :post
* @time :2024/8/13 9:57
*/
namespace App\Models\Inquiry;
use App\Models\Base;
class InquiryField extends Base
{
protected $connection = "custom_mysql";
protected $table = 'gl_inquiry_field';
}
... ...
... ... @@ -109,7 +109,6 @@ class InquiryFormData extends Base
*/
public static function getCount($submit_at = []){
return self::leftjoin('gl_inquiry_form', 'gl_inquiry_form.id', '=', 'gl_inquiry_form_data.form_id')
->where('gl_inquiry_form.is_default', 0)
->when($submit_at, function ($query, $submit_at) {
$query->whereBetween('submit_at',[$submit_at[0], $submit_at[1]]);
})
... ... @@ -123,7 +122,6 @@ class InquiryFormData extends Base
*/
public static function getCountryCount($submit_at = []){
return self::leftjoin('gl_inquiry_form', 'gl_inquiry_form.id', '=', 'gl_inquiry_form_data.form_id')
->where('gl_inquiry_form.is_default', 0)
->when($submit_at, function ($query, $submit_at) {
$query->whereBetween('submit_at',[$submit_at[0], $submit_at[1]]);
})
... ...
... ... @@ -351,6 +351,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/edit', [Aside\Com\KeywordVideoController::class, 'edit'])->name('keyword_video_edit');
Route::any('/getVideoTaskLog', [Aside\Com\KeywordVideoController::class, 'getVideoTaskLog'])->name('keyword_video_getVideoTaskLog');
Route::any('/taskNum', [Aside\Com\KeywordVideoController::class, 'taskNum'])->name('keyword_video_taskNum');
Route::any('/getVideoCount', [Aside\Com\KeywordVideoController::class, 'getVideoCount'])->name('keyword_video_getVideoCount');
});
// 公共主题模版
... ...