保存的表
This commit is contained in:
parent
f47d58a2f9
commit
f84b1877ad
@ -22,11 +22,14 @@ abstract class AbstractExport implements WithEvents, WithTitle
|
||||
|
||||
public $sn;
|
||||
|
||||
public $tag;
|
||||
|
||||
public $filename;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->sn = $this->sn();
|
||||
$this->tag = $this->tag();
|
||||
$this->filename = $this->filename();
|
||||
}
|
||||
|
||||
@ -53,6 +56,7 @@ abstract class AbstractExport implements WithEvents, WithTitle
|
||||
{
|
||||
$data = [
|
||||
'sn' => $event->getConcernable()->sn,
|
||||
'tag' => $event->getConcernable()->tag,
|
||||
'filename' => $event->getConcernable()->filename,
|
||||
'filesize' => 0,
|
||||
'conditions' => $event->getConcernable()->conditions ?: null,
|
||||
@ -146,4 +150,18 @@ abstract class AbstractExport implements WithEvents, WithTitle
|
||||
|
||||
return "export/{$filename}.xlsx";
|
||||
}
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function tag()
|
||||
{
|
||||
$className = get_class($this);
|
||||
|
||||
$baseName = array_last(explode('\\', $className));
|
||||
|
||||
return str_replace('Export', '', $baseName);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ class Export extends Model
|
||||
{
|
||||
protected $table = 'stats_exports';
|
||||
|
||||
protected $fillable = ['id', 'sn', 'filename' , 'filesize', 'conditions', 'status', 'progress'];
|
||||
protected $fillable = ['id', 'sn', 'tag', 'filename' , 'filesize', 'conditions', 'status', 'progress'];
|
||||
|
||||
protected $casts = [
|
||||
'conditions' => 'array',
|
||||
|
@ -15,7 +15,8 @@ class CreateStatsExportsTable extends Migration
|
||||
{
|
||||
Schema::create('stats_exports', function (Blueprint $table) {
|
||||
$table->increments('id')->comment('自增ID');
|
||||
$table->string('sn', 32)->comment('命令编号');
|
||||
$table->string('sn', 32)->default('')->comment('命令编号');
|
||||
$table->string('tag', 20)->default('')->comment('标记');
|
||||
$table->string('filename')->default('')->comment('文件名');
|
||||
$table->integer('filesize')->unsigned()->default(0)->comment('文件大小');
|
||||
$table->text('conditions')->nullable()->comment('查询条件');
|
||||
@ -23,6 +24,7 @@ class CreateStatsExportsTable extends Migration
|
||||
$table->tinyInteger('progress')->unsigned()->default(0)->comment('进度');
|
||||
$table->timestamps();
|
||||
$table->unique('sn');
|
||||
$table->index('tag');
|
||||
$table->comment('VD统计导出表');
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user