作者 刘锟

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

... ... @@ -20,7 +20,8 @@ use App\Models\HomeCount\Count;
class CountAll extends Command
{
const STATUS_ERROR = 400;
public $error = 0;
/**
* The name and signature of the console command.
*
... ...
... ... @@ -77,9 +77,7 @@ class MonthAllCount extends Command
->groupBy('month')->get()->toArray();
foreach ($list as $k=>$v){
$v = (array)$v;
if($v['month'] == date('Y-m')){
continue;
}
$arr = [];
$monthCountModel = new MonthCount();
$info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]);
// 获取当月开始时间
... ... @@ -88,7 +86,7 @@ class MonthAllCount extends Command
$end = date('Y-m-t', strtotime($v['month']));
$arr['project_id'] = $project_id;
$res = $this->inquiry($url,$v['month']);
$arr['total'] = 0;
$arr['total'] = $arr['month_total'] = 0;
if(isset($res['data']['count'])){
echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
$arr['month_total'] = $res['data']['count'];
... ...
... ... @@ -99,6 +99,7 @@ class MonthCount extends Command
* @time :2024/1/8 9:05
*/
public function count($project_id,$url){
$arr = [];
$v = ['month'=>date('Y-m')];
$monthCountModel = new MonthCountModel();
$info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]);
... ... @@ -108,7 +109,7 @@ class MonthCount extends Command
$end = date('Y-m-t', strtotime($v['month']));
$arr['project_id'] = $project_id;
$res = $this->inquiry($url,$v['month']);
// $arr['month_total'] = 0;
$arr['total'] = $arr['month_total'] = 0;
if(isset($res['data']['count'])){
echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
$arr['month_total'] = $res['data']['count'];
... ...
... ... @@ -65,10 +65,8 @@ class MonthProjectCount extends Command
->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month'))
->groupBy('month')->get()->toArray();
foreach ($list as $k=>$v){
$arr = [];
$v = (array)$v;
// if($v['month'] == date('Y-m')){
// continue;
// }
$monthCountModel = new MonthCount();
$info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]);
// 获取当月开始时间
... ... @@ -77,7 +75,7 @@ class MonthProjectCount extends Command
$end = date('Y-m-t', strtotime($v['month']));
$arr['project_id'] = $project_id;
$res = $this->inquiry($url,$v['month']);
// $arr['month_total'] = 0;
$arr['total'] = $arr['month_total'] = 0;
if(isset($res['data']['count'])){
echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
$arr['month_total'] = $res['data']['count'];
... ...
... ... @@ -13,6 +13,7 @@ use App\Models\Com\KeywordVideoTaskLog;
use App\Models\Domain\DomainInfo;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* @remark :通知C端生成界面
... ... @@ -65,6 +66,7 @@ class Notice extends Command
}
foreach ($domainList as $v1){
//TODO::通知C端
@file_put_contents(storage_path('logs/notice_c'.'.log'), var_export($v1['domain'], true) . PHP_EOL, FILE_APPEND);
$this->curlDelRoute($v1['domain'],$v1['project_id']);
}
return true;
... ...
... ... @@ -23,7 +23,7 @@ class UpdateKeyword extends Command
*
* @var string
*/
protected $signature = 'update_keyword';
protected $signature = 'update_keyword_content';
/**
* The console command description.
... ... @@ -51,6 +51,7 @@ class UpdateKeyword extends Command
if($domainInfo !== false){
$this->curlDelRoute($domainInfo['domain'],$v['project_id']);
}
$keywordPageModel->edit(['status'=>1],['id'=>$v['id']]);
}
sleep(10);
}
... ... @@ -71,7 +72,7 @@ class UpdateKeyword extends Command
if(empty($text)){
return false;
}
$number = count($info['text']);
$number = count($text);
$randomNumber = rand(0, $number - 1);
if($updateObject['type'] == 0){//更新所有关键字
$keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['status'=>1]);
... ...
... ... @@ -48,8 +48,8 @@ class Kernel extends ConsoleKernel
$schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次
$schedule->command('update_keyword_route')->dailyAt('01:00')->withoutOverlapping(1); //升级项目--清除路由相同的关键字
$schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商
// 每日推送视频任务
$schedule->command('update_keyword')->hourly()->withoutOverlapping(1);
$schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1);
// 每日推送视频任务
$schedule->command('video_task')->hourly()->withoutOverlapping(1);
// 每日推送已完成视频任务项目生成对应界面
... ...
... ... @@ -139,9 +139,12 @@ class CategoryController extends BaseController
*/
public function sort(CategoryLogic $logic){
$this->request->validate([
'id'=>['required'],
'id'=>'required',
'sort'=>'numeric|min:0',
],[
'id.required' => 'ID不能为空',
'sort.numeric' => 'sort位数字',
'sort.min' => 'sort最小值为0',
]);
$logic->categorySort();
$this->response('success');
... ...
... ... @@ -148,7 +148,7 @@ class ProjectLogic extends BaseLogic
//初始化项目
$this->createProjectData($this->param);
//双向绑定服务器,需放到保存项目的上方
$this->setServers($this->param['serve_id'],$this->param['id']);
$this->setServers($this->param['serve_id'] ?? 0,$this->param['id']);
//保存项目信息
$this->saveProject($this->param);
//保存建站部署信息
... ... @@ -192,6 +192,9 @@ class ProjectLogic extends BaseLogic
$serversModel->where(['id'=>$oldServerIpInfo['servers_id']])->decrement('being_number',1);
}
}
if(empty($servers_id)){
return $this->success();
}
$serversIpInfo = $serversIpModel->read(['id'=>$servers_id]);
$serversInfo = $serversModel->read(['id'=>$serversIpInfo['servers_id']]);
if($serversIpInfo['total'] >= $serversInfo['ip_total']){
... ...
... ... @@ -124,11 +124,11 @@ class ATemplateLogic extends BaseLogic
if(!empty($info['image'])){
$info['image_link'] = getImageUrl($info['image']);
}
if(!empty($info['design_manager'])){
$info['design_manager'] = (new Manage())->getName($info['design_manager']);
if(!empty($info['design_msg'])){
$info['design_msg'] = json_decode($info['design_msg']);
}
if(!empty($info['front_manager'])){
$info['front_manager'] = (new Manage())->getName($info['front_manager']);
if(!empty($info['front_msg'])){
$info['front_msg'] = json_decode($info['front_msg']);
}
return $this->success($info);
}
... ... @@ -261,15 +261,11 @@ class ATemplateLogic extends BaseLogic
*/
public function auditingStatus(){
//获取当前数据详情
$info = $this->model->read(['id'=>$this->param['id']]);
if(isset($this->param['front_status']) && $this->param['front_status'] == 1){
if($info['design_status'] == 0){
$this->fail('请先提交设计审核');
}
$this->param['design_manager'] = $this->manager['id'];
$this->param['test_model'] = 0;
}else{
$this->param['front_manager'] = $this->manager['id'];
if(isset($this->param['design_msg']) && !empty($this->param['design_msg'])){
$this->param['design_msg'] = json_encode($this->param['design_msg']);
}
if(isset($this->param['front_msg']) && !empty($this->param['front_msg'])){
$this->param['front_msg'] = json_encode($this->param['front_msg']);
}
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
... ...
... ... @@ -20,6 +20,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
class CopyProjectJob implements ShouldQueue
... ... @@ -52,6 +53,7 @@ class CopyProjectJob implements ShouldQueue
$projectModel = new Project();
DB::beginTransaction();
try {
$this->output('CopyProjectJob start, project_id: ' . $this->param['project_id']);
//复制初始项目
$data = $projectModel::where('id', $this->param['project_id'])->first();
$data = $data->getAttributes();
... ... @@ -61,6 +63,7 @@ class CopyProjectJob implements ShouldQueue
$data['finish_remain_day'] = 0;
$data['title'] = $data['title'].'-copy';
$data['delete_status'] = 1;
$data['uptime'] = null;
unset($data['id']);
$project_id = $projectModel->insertGetId($data);
$hashids = new Hashids($data['from_order_id'], 13, 'abcdefghjkmnpqrstuvwxyz1234567890');
... ... @@ -95,7 +98,6 @@ class CopyProjectJob implements ShouldQueue
unset($optimizeData['id'],$optimizeData['domain']);
$optimizeData['project_id'] = $project_id;
$optimizeData['api_no'] = 0;
$optimizeData['minor_languages'] = json_encode([]);
$optimizeModel->insert($optimizeData);
}
//复制付费表
... ... @@ -128,6 +130,7 @@ class CopyProjectJob implements ShouldQueue
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->output('CopyProjectJob error, error message: ' . $e->getMessage());
$this->fail('error');
}
if($type != 0){
... ... @@ -135,6 +138,7 @@ class CopyProjectJob implements ShouldQueue
}
//修改项目状态
$projectModel->edit(['delete_status'=>0],['id'=>$project_id]);
$this->output('CopyProjectJob end, old project_id: ' . $this->param['project_id'] . ', new project_id: ' . $project_id);
return true;
}
... ... @@ -170,7 +174,7 @@ class CopyProjectJob implements ShouldQueue
if($table == 'gl_customer_visit' || $table == 'gl_customer_visit_item' || $table == 'gl_inquiry_other' || $table == 'gl_inquiry_form_data' || $table == 'gl_inquiry_form'){
continue;
}
// DB::connection('custom_mysql')->table($table)->truncate(); // 清空目标表数据
DB::connection('custom_mysql')->table($table)->truncate(); // 清空目标表数据
DB::connection('custom_mysql')->table($table)->insertUsing(
[], // 列名数组,留空表示插入所有列
function ($query) use ($table,$project_id) {
... ... @@ -184,4 +188,17 @@ class CopyProjectJob implements ShouldQueue
}
return true;
}
/**
* @param $message
* @return bool
*/
public function output($message)
{
$date = date('Y-m-d H:i:s');
$output = $date . ', ' . $message . PHP_EOL;
echo $output;
Log::info($output);
return true;
}
}
... ...
... ... @@ -79,6 +79,12 @@ return [
'prefix' => 'test',
],
//日记录日志
'copy_project' => [
'driver' => 'custom',
'via' => \App\Factory\LogFormatterFactory::class,
'prefix' => 'copy_project',
],
//日记录日志
'day_count' => [
'driver' => 'custom',
'via' => \App\Factory\LogFormatterFactory::class,
... ...