#feature: some update

This commit is contained in:
2026-08-12 18:00:09 +08:00
parent ba916f5ce1
commit 103340536b
39 changed files with 2916 additions and 227 deletions
@@ -0,0 +1,40 @@
<?php
namespace App\Console\Commands;
use App\Services\ErpRequestReportService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
class ErpRequestReportCommand extends Command
{
protected $signature = 'erp-request-report:send
{--date= : 统计单日(Y-m-d;与 --from/--to 互斥,默认昨天)}
{--from= : 开始时间(Y-m-d Y-m-d H:i:s,含)}
{--to= : 结束时间(Y-m-d Y-m-d H:i:s;仅日期时含整天)}';
protected $description = '汇总指定时间段 ERP OpenAPI 请求并发送钉钉日报(默认昨天)';
public function handle(ErpRequestReportService $service): int
{
try {
$result = $service->sendReport(
$this->option('date'),
$this->option('from'),
$this->option('to')
);
Log::channel('erp-request-report')->info('ERP 请求日报已发送', $result);
$this->info("ERP 请求日报已发送:{$result['date']}{$result['company_count']} 家公司,{$result['request_count']} 次请求。");
return self::SUCCESS;
} catch (\Throwable $e) {
Log::channel('erp-request-report')->error('ERP 请求日报发送失败', [
'message' => $e->getMessage(),
]);
$this->error($e->getMessage());
return self::FAILURE;
}
}
}