| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace app\admin\model\ps;
- use think\Model;
- class Ai_job extends Model
- {
-
-
- // 表名
- protected $name = 'ps_ai_job';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'integer';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- 'status_text'
- ];
-
-
- public function getStatusList()
- {
- return ['pending' => __('Pending'), 'running' => __('Running'), 'success' => __('Success'), 'fail' => __('Fail')];
- }
- public function getFileTypeList()
- {
- return ['image' => __('Image'), 'pdf' => __('Pdf')];
- }
- public function factory()
- {
- return $this->belongsTo('Factory', 'factory_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- public function getStatusTextAttr($value, $data)
- {
- $value = $value ?: ($data['status'] ?? '');
- $list = $this->getStatusList();
- return $list[$value] ?? '';
- }
- }
|