OrderRefund.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\common\model;
  13. use cores\BaseModel;
  14. /**
  15. * 售后单模型
  16. * Class OrderRefund
  17. * @package app\common\model\wxapp
  18. */
  19. class OrderRefund extends BaseModel
  20. {
  21. // 定义表名
  22. protected $name = 'order_refund';
  23. // 定义主键
  24. protected $pk = 'order_refund_id';
  25. /**
  26. * 关联用户表
  27. * @return \think\model\relation\BelongsTo
  28. */
  29. public function user()
  30. {
  31. return $this->belongsTo('User');
  32. }
  33. /**
  34. * 关联订单主表
  35. * @return \think\model\relation\BelongsTo
  36. */
  37. public function orderData()
  38. {
  39. return $this->belongsTo('Order');
  40. }
  41. /**
  42. * 关联订单商品表
  43. * @return \think\model\relation\BelongsTo
  44. */
  45. public function orderGoods()
  46. {
  47. return $this->belongsTo('OrderGoods')->withoutField(['content']);
  48. }
  49. /**
  50. * 关联图片记录表
  51. * @return \think\model\relation\HasMany
  52. */
  53. public function images()
  54. {
  55. return $this->hasMany('OrderRefundImage');
  56. }
  57. /**
  58. * 关联物流公司表
  59. * @return \think\model\relation\BelongsTo
  60. */
  61. public function express()
  62. {
  63. return $this->belongsTo('Express');
  64. }
  65. /**
  66. * 关联用户表
  67. * @return \think\model\relation\HasOne
  68. */
  69. public function address()
  70. {
  71. return $this->hasOne('OrderRefundAddress');
  72. }
  73. /**
  74. * 获取器:用户发货时间
  75. * @param $value
  76. * @return false|string
  77. */
  78. public function getSendTimeAttr($value)
  79. {
  80. return format_time($value);
  81. }
  82. /**
  83. * 售后单详情
  84. * @param array|int $where
  85. * @param array $with
  86. * @return null|static
  87. */
  88. public static function detail($where, array $with = [])
  89. {
  90. return static::get($where, $with);
  91. }
  92. }