| 12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace app\common\model\orders;
- use app\common\model\BaseModel;
- use app\common\model\goods\Goods;
- use app\common\model\works\ServiceWork;
- /**
- * @author 林海涛
- * @date 2024/7/17 下午5:23
- */
- class OrderEffectiveLog extends BaseModel
- {
- protected $name = 'order_effective_log';
- public function goods()
- {
- return $this->hasOne(Goods::class, 'id', 'goods_id');
- }
- public function serviceWork()
- {
- return $this->hasOne(ServiceWork::class, 'order_effective_id', 'id');
- }
- public function getEndEffectiveTimeAttr($value,$data)
- {
- return !empty($data['end_effective_time'])?date('Y-m-d H:i:s',$data['end_effective_time']):'';
- }
- public static function getEffectiveUnitTextAttr($value,$data)
- {
- $type = [1 => '天',2=> '小时'];
- return $type[$data['effective_unit']];
- }
- }
|