parent
726376efea
commit
6d5ca78b51
@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
|
||||||
|
|
||||||
use App\Services\TestData\SupplyDemandTestDataGenerator;
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
|
|
||||||
class GenerateSupplyDemandDemo extends Command
|
|
||||||
{
|
|
||||||
protected $signature = 'demo:generate-supply-demand {--count=50} {--users=20}';
|
|
||||||
|
|
||||||
protected $description = '生成供需模块演示数据(含附件、会话、消息、收藏等)';
|
|
||||||
|
|
||||||
public function handle(): int
|
|
||||||
{
|
|
||||||
$count = (int)$this->option('count');
|
|
||||||
$users = (int)$this->option('users');
|
|
||||||
|
|
||||||
$this->info("开始生成:供需 {$count} 条,最少用户 {$users} 个...");
|
|
||||||
$generator = new SupplyDemandTestDataGenerator();
|
|
||||||
$generator->generate($count, $users, function (string $msg) {
|
|
||||||
$this->line($msg);
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->info('生成完成');
|
|
||||||
return self::SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
|
||||||
|
|
||||||
use App\Services\TestData\CourseContentEvaluationTestDataGenerator;
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
|
|
||||||
class SeedCourseContentEvaluations extends Command
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name and signature of the console command.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $signature = 'seed:course-evaluations
|
|
||||||
{--evaluations=20 : 生成评价问卷数量}
|
|
||||||
{--users=50 : 最少用户数量}';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The console command description.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $description = '生成课程内容评价模块的测试数据,包括问卷、问题字段和用户提交数据';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the console command.
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
$evaluationCount = (int) $this->option('evaluations');
|
|
||||||
$minUsers = (int) $this->option('users');
|
|
||||||
|
|
||||||
$this->info("开始生成课程内容评价测试数据...");
|
|
||||||
$this->info("计划生成 {$evaluationCount} 个评价问卷,确保至少 {$minUsers} 个用户");
|
|
||||||
|
|
||||||
$generator = new CourseContentEvaluationTestDataGenerator();
|
|
||||||
|
|
||||||
$startTime = microtime(true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$generator->generate($evaluationCount, $minUsers, function (string $message) {
|
|
||||||
$this->line(" → {$message}");
|
|
||||||
});
|
|
||||||
|
|
||||||
$duration = round(microtime(true) - $startTime, 2);
|
|
||||||
$this->info("✅ 数据生成完成!耗时 {$duration} 秒");
|
|
||||||
|
|
||||||
return Command::SUCCESS;
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$this->error("❌ 数据生成失败:" . $e->getMessage());
|
|
||||||
return Command::FAILURE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Illuminate\Support\Facades\Mail;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
|
|
||||||
class TestEmailCommand extends Command
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name and signature of the console command.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $signature = 'test:email';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The console command description.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $description = '测试邮件发送功能是否正常';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the console command.
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
// 写死的收件人地址
|
|
||||||
$to = 'tanyuan@langye.net';
|
|
||||||
$subject = '系统测试邮件';
|
|
||||||
$content = '这是一封测试邮件,用于验证邮件发送功能是否正常工作。';
|
|
||||||
|
|
||||||
$this->info("开始测试邮件发送功能...");
|
|
||||||
$this->info("收件人: {$to}");
|
|
||||||
$this->info("主题: {$subject}");
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
// 使用 Laravel 的 Mail 门面发送邮件
|
|
||||||
Mail::raw($content, function ($message) use ($to, $subject) {
|
|
||||||
$message->to($to)->subject($subject);
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->info("✅ 邮件发送成功!");
|
|
||||||
$this->info("邮件已记录到日志文件中,请检查 storage/logs/laravel.log");
|
|
||||||
|
|
||||||
return Command::SUCCESS;
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$this->error("❌ 邮件发送失败!");
|
|
||||||
$this->error("错误信息: " . $e->getMessage());
|
|
||||||
return Command::FAILURE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* 缴费通知
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Notifications;
|
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class BirthdayNotify extends Notification
|
|
||||||
{
|
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public $data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct($data)
|
|
||||||
{
|
|
||||||
$this->data = $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
|
||||||
{
|
|
||||||
return ['database'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
|
||||||
{
|
|
||||||
return $this->data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in new issue