| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\admin\model\ps;
- use think\Model;
- class Print_job extends Model
- {
-
-
- // 表名
- protected $name = 'ps_print_job';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'integer';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = false;
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- 'status_text'
- ];
-
-
- public function getStatusList()
- {
- return ['previewed' => __('Previewed'), 'printed' => __('Printed'), 'canceled' => __('Canceled')];
- }
- public function getBizTypeList()
- {
- return ['product' => __('Product'), 'workorder' => __('Workorder')];
- }
- public function getLodopModeList()
- {
- return ['preview' => __('Preview'), 'print' => __('Print')];
- }
- 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] ?? '';
- }
- }
|