feat: 发布智能体版

This commit is contained in:
augushong
2026-03-26 20:22:34 +08:00
parent 7ee9e102a5
commit 8cc08bcb8c
138 changed files with 7964 additions and 660 deletions

View File

@@ -2,8 +2,8 @@
namespace base\common\command;
use app\common\console\Command;
use app\common\service\UploadService;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\facade\Filesystem;
@@ -13,37 +13,53 @@ class OssStaticBase extends Command
{
protected function configure()
{
parent::configure();
$this->setName('OssStatic')
->setDescription('将静态资源上传到oss上');
}
protected function execute(Input $input, Output $output)
{
$output->writeln('========正在上传静态资源到OSS上========' . date('Y-m-d H:i:s'));
try {
$start_time = date('Y-m-d H:i:s');
$list = Filesystem::disk('local_static')->listContents('/', true);
$upload_service = new UploadService();
$uploadPrefix = config('app.oss_static_prefix', 'oss_static_prefix');
$list = Filesystem::disk('local_static')->listContents('/', true);
$upload_service = new UploadService();
$uploadPrefix = config('app.oss_static_prefix', 'oss_static_prefix');
$success_count = 0;
$failed_count = 0;
foreach ($list as $file_item) {
if ($file_item['type'] != 'file') {
continue;
foreach ($list as $file_item) {
if ($file_item['type'] != 'file') {
continue;
}
$file_path = $file_item['path'];
$file_path = Filesystem::disk('local_static')->path($file_path);
$file = new File($file_path, false);
$save_name = $file_item['path'];
try {
$model_file = $upload_service->save($file, $save_name, true, $uploadPrefix, true);
$success_count++;
$output->info('文件上传成功:' . $save_name . '。上传地址:' . $model_file['url']);
} catch (\Throwable $th) {
$failed_count++;
$output->error('文件上传失败:' . $save_name . '。错误信息:' . $th->getMessage());
}
}
$file_path = $file_item['path'];
// 文本模式输出
$output->writeln('========正在上传静态资源到OSS上========' . $start_time);
$output->writeln('========已完成静态资源上传到OSS上========' . date('Y-m-d H:i:s'));
$output->writeln('总计: ' . ($success_count + $failed_count) . ' 个文件,成功: ' . $success_count . ' 个,失败: ' . $failed_count . ' 个');
$file_path = Filesystem::disk('local_static')->path($file_path);
$file = new File($file_path, false);
$save_name = $file_item['path'];
try {
$model_file = $upload_service->save($file, $save_name, true, $uploadPrefix, true);
$output->info('文件上传成功:' . $save_name . '。上传地址:' . $model_file['url']);
} catch (\Throwable $th) {
$output->error('文件上传失败:' . $save_name . '。错误信息:' . $th->getMessage());
}
return $failed_count > 0 ? 1 : 0;
} catch (\Throwable $e) {
throw $e;
}
$output->writeln('========已完成静态资源上传到OSS上========' . date('Y-m-d H:i:s'));
}
}