作者 lyh

gx

... ... @@ -150,7 +150,7 @@ class AiBlogTask extends Command
}
$aiBlogTaskModel = new AiBlogTaskModel();
$finish_at = date('Y-m-d H:i:s', strtotime('-' . $finish_at . ' hour'));
$ids = $aiBlogTaskModel->formatQuery(['status'=>$aiBlogTaskModel::STATUS_RUNNING,'type'=>$aiBlogTaskModel::TYPE_BLOG,'created_at'=>['<=',$finish_at]])->limit(1000)->pluck('id');
$ids = $aiBlogTaskModel->formatQuery(['status'=>$aiBlogTaskModel::STATUS_RUNNING,'type'=>$aiBlogTaskModel::TYPE_BLOG,'updated_at'=>['<=',$finish_at]])->limit(1000)->pluck('id');
if(!empty($ids)){
foreach ($ids as $id) {
Redis::lpush('ai_blog_task', $id);
... ...
<?php
/**
* @remark :
* @name :AfterCount.php
* @author :lyh
* @method :post
* @time :2025/3/26 15:28
*/
namespace App\Console\Commands\DayCount;
use App\Models\Manage\ManageHr;
use App\Models\Project\Project;
use Carbon\Carbon;
use App\Models\HomeCount\AfterCount as AfterCountModel;
use Illuminate\Console\Command;
class AfterCount extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'after_count';
protected $managerHrModel;
public $after_manager = [
1 => ['许璐','王袁袁'],
2 => ['陈思蓓'],
3 => ['张国英']
];
/**
* The console command description.
*
* @var string
*/
protected $description = '统计昨日售后数据';
public function handle(){
echo date('Y-m-d H:i:s').'统计start->'.PHP_EOL;
$saveData = $this->_action();
$afterModel = new AfterCountModel();
$afterModel->insertAll($saveData);
echo date('Y-m-d H:i:s').'->统计end'.PHP_EOL;
return true;
}
/**
* @remark :执行方法
* @name :_action
* @author :lyh
* @method :post
* @time :2025/3/26 15:29
*/
public function _action(){
$this->managerHrModel = new ManageHr();
$projectModel = new Project();
$todayMidnight = date('Y-m-d 00:00:00', strtotime('today'));
$saveData = [];
foreach ($this->after_manager as $key => $valM){
$idArr = $this->managerHrModel->selectField(['name'=>['in',$valM]],'id');
$project_count = $projectModel->where('gl_project.extend_type',0)->where('gl_project.delete_status',0)->where('gl_project.created_at','<=',$todayMidnight)->whereIn('gl_project_deploy_optimize.optimist_mid',$idArr)->whereIn('gl_project.type',[2,4])->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')->count();
$qualified_count = $projectModel->where('gl_project.extend_type',0)->where('gl_project.delete_status',0)->where('gl_project.created_at','<=',$todayMidnight)->where('gl_project.is_remain_today',1)->whereIn('gl_project_deploy_optimize.optimist_mid',$idArr)->whereIn('gl_project.type',[2,4])->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')->count();
$rate = number_format($qualified_count / $project_count, 2);
$threeMonthsAgo = date('Y-m-d 00:00:00', strtotime('-3 months'));
$three_project_count = $projectModel->where('gl_project.extend_type',0)->where('gl_project.delete_status',0)->where('gl_project.created_at','<=',$threeMonthsAgo)->whereIn('gl_project_deploy_optimize.optimist_mid',$idArr)->whereIn('gl_project.type',[2,4])->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')->count();
$three_qualified_count = $projectModel->where('gl_project.extend_type',0)->where('gl_project.delete_status',0)->where('gl_project.created_at','<=',$threeMonthsAgo)->where('gl_project.is_remain_today',1)->whereIn('gl_project_deploy_optimize.optimist_mid',$idArr)->whereIn('gl_project.type',[2,4])->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')->count();
$three_rate = number_format($three_qualified_count / $three_project_count, 2);
$saveData[] = [
'date'=>date('Y-m-d', strtotime('yesterday')),
'type'=> $key,
'project_count'=>$project_count,
'qualified_count'=>$qualified_count,
'rate'=>$rate,
'three_project_count'=>$three_project_count,
'three_qualified_count'=>$three_qualified_count,
'three_rate'=>$three_rate,
];
}
return $saveData;
}
}
... ...
... ... @@ -38,7 +38,7 @@ class Count extends Command
*/
public function handle()
{
$list = DB::table('gl_project')->where('gl_project.extend_type','=',0)
$list = DB::table('gl_project')->where('gl_project.extend_type',0)->where('gl_project.delete_status',0)
->whereIn('gl_project.type',[1,2,3,4,6])
->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
... ...
<?php
/**
* @remark :
* @name :AfterCount.php
* @author :lyh
* @method :post
* @time :2025/3/26 15:31
*/
namespace App\Models\HomeCount;
use App\Models\Base;
/**
* @remark :售后日统计数据
* @name :AfterCount
* @author :lyh
* @method :post
* @time :2025/3/26 15:31
*/
class AfterCount extends Base
{
protected $table = 'gl_after_count';
}
... ...