DeliveryBatch.php 538 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. use think\model\concern\SoftDelete;
  5. class DeliveryBatch extends BaseModel
  6. {
  7. use SoftDelete;
  8. protected $deleteTime = 'delete_time';
  9. protected $defaultSoftDelete = 0;
  10. protected $autoWriteTimestamp = true;
  11. function getProgressAttr($value, $data)
  12. {
  13. return floor(($data['success'] + $data['fail']) / $data['nums'] * 100);
  14. }
  15. function items()
  16. {
  17. return $this->hasMany(DeliveryBatchInfo::class, 'batch_id', 'id');
  18. }
  19. }