DataUserPurchaseAcceptance.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace app\data\model;
  3. use think\admin\Model;
  4. use think\helper\Arr;
  5. /**
  6. * 采购接单需求模型
  7. * Class DataUserPurchaseAcceptance
  8. * @package app\data\model
  9. */
  10. class DataUserPurchaseAcceptance extends Model
  11. {
  12. protected $autoWriteTimestamp=true;
  13. protected $createTime='create_at';
  14. protected $updateTime='update_at';
  15. protected $append=[
  16. 'addr',
  17. 'status_text',
  18. ];
  19. public static $status=[
  20. '待审核',
  21. '审核通过',
  22. '审核驳回',
  23. ];
  24. /**
  25. * @return string[]
  26. */
  27. public static function getStatus(): array
  28. {
  29. return self::$status;
  30. }
  31. public function getImgsAttr($_,$model){
  32. return array_filter(explode(',',$model['imgs']));
  33. }
  34. public function user(){
  35. return $this->belongsTo(DataUser::class,'uuid');
  36. }
  37. public function getAddrAttr($_,$model){
  38. return sprintf("%s%s%s",$model['province']??'',$model['city']??'',$model['area']??'');
  39. }
  40. public function getStatusTextAttr($_,$model){
  41. return Arr::get(self::$status,$model['status']);
  42. }
  43. }