This commit is contained in:
2026-01-05 14:33:21 +08:00
commit ee348b4925
451 changed files with 39954 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
<?php
namespace app\ticket\model;
use app\common\model\Resource;
use app\common\model\Role;
use app\common\model\Systems;
use support\Model;
/**
* users 用户表
* @property integer $id 用户ID(主键)
* @property string $ticket_id 工单编号
* @property string $user_id 分类id
* @property string $original_name 内容
* @property string $storage_path 排序
* @property string $mime_type 状态
* @property integer $file_size 创建人id
* @property string $created_at
* @property string $updated_at
*/
class Attachment extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'tkt_ticket_attachment';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = true;
protected $dateFormat = 'U';
protected $fillable = [
'ticket_id',
'user_id',
'original_name',
'storage_path',
'mime_type',
'file_size'
];
public function ticket(){
return $this->belongsTo(Ticket::class, 'ticket_id', 'id');
}
}
+54
View File
@@ -0,0 +1,54 @@
<?php
namespace app\ticket\model;
use Illuminate\Database\Eloquent\SoftDeletes;
use support\Model;
/**
* ticket_categorie 工单分类表
* @property integer $id 主键
* @property string $name 分类名称
* @property string $description 分类描述
* @property string $created_at 创建时间
* @property string $updated_at 更新时间
* @property string $deleted_at 删除时间
*/
class Categorie extends Model
{
use SoftDeletes;
protected $connection = 'mysql';
protected $table = 'tkt_ticket_categorie';
protected $primaryKey = 'id';
public $timestamps = true;
protected $dateFormat = 'U';
protected $dates = ['created_at', 'updated_at'];
protected $casts = [
'updated_at' => 'datetime:Y-m-d H:i:s',
'created_at' => 'datetime:Y-m-d H:i:s',
];
protected $fillable = [
'name',
'description',
];
/**
* 单条翻译
*/
public function translation()
{
return $this->hasOne(CategorieTranslation::class, 'categorie_id')->where('locale', locale());
}
/**
* 多条翻译
*/
public function translations()
{
return $this->hasMany(CategorieTranslation::class, 'categorie_id');
}
public function ticket(){
return $this->hasOne(Ticket::class, 'categorie_id', 'id');
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace app\ticket\model;
use support\Model;
/**
* ticket_categorie_translation 工单分类多语言表
* @property integer $id 主键
* @property integer $categorie_id 分类ID
* @property string $locale 语言
* @property string $name 分类名称
* @property string $description 分类描述
* @property string $created_at 创建时间
* @property string $updated_at 更新时间
*/
class CategorieTranslation extends Model
{
protected $connection = 'mysql';
protected $table = 'tkt_ticket_categorie_translation';
protected $primaryKey = 'id';
public $timestamps = true;
protected $dateFormat = 'U';
protected $dates = ['created_at', 'updated_at'];
protected $casts = [
'updated_at' => 'datetime:Y-m-d H:i:s',
'created_at' => 'datetime:Y-m-d H:i:s',
];
protected $fillable = [
'categorie_id',
'locale',
'name',
'description',
];
}
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace app\ticket\model;
use support\Model;
/**
* ticket_conversation 工单会话表
* @property integer $id 主键
* @property integer $ticket_id 工单ID
* @property integer $user_id 用户ID
* @property string $content 会话内容
* @property string $created_at 创建时间
* @property string $updated_at 更新时间
*/
class Conversation extends Model
{
protected $connection = 'mysql';
protected $table = 'tkt_ticket_conversation';
protected $primaryKey = 'id';
public $timestamps = true;
protected $dateFormat = 'U';
protected $fillable = [
'ticket_id',
'user_id',
'content',
'attachment',
];
}
+95
View File
@@ -0,0 +1,95 @@
<?php
namespace app\ticket\model;
use app\common\model\Resource;
use app\common\model\Role;
use app\common\model\Systems;
use support\Model;
/**
* users 用户表
* @property integer $id 用户ID(主键)
* @property string $code 工单编号
* @property string $categorie_id 分类id
* @property string $content 内容
* @property string $sort 排序
* @property integer $status 状态
* @property string $user_id 创建人id
* @property string $created_at
* @property string $updated_at
*/
class Ticket extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'tkt_ticket';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
protected $dateFormat = 'U';
/**
* 在保存时手动设置时间戳
*/
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
$model->created_at = time();
$model->updated_at = time();
});
static::updating(function ($model) {
$model->updated_at = time();
});
}
/**
* 指定哪些字段自动转换为 Carbon 实例
*/
public function getDates()
{
return [];
}
protected $fillable = [
'code',
'categorie_id',
'content',
'sort',
'status',
'user_id'
];
public function attachments(){
return $this->hasMany(Attachment::class, 'ticket_id', 'id');
}
public function categorie(){
return $this->belongsTo(Categorie::class, 'categorie_id', 'id');
}
}