123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace app\common\model;
- use think\Model;
- class DemandSnatch extends Model
- {
- // 设置字段信息
- protected $schema = [
- 'id' => 'int',
- 'demand_id' => 'int',
- 'worker_id' => 'int',
- 'num' => 'int',
- 'status' => 'int',
- 'createtime' => 'int',
- ];
- // 设置字段自动转换类型
- protected $type = [
- 'createtime' => 'timestamp:Y-m-d H:i:s',
- ];
- public function demand()
- {
- return $this->hasOne(Demand::class, 'id', 'demand_id');
- }
- public function worker()
- {
- return $this->hasOne(Worker::class, 'id', 'worker_id');
- }
- public function getStatusTextAttr($value,$data)
- {
- $fstatus = [1=>'待审核', 2=>'审核通过', 3=>'已完成'];
- return $fstatus[$data['status']];
- }
- }
|