SaasOrderLife.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. namespace app\model\saas;
  3. use app\extra\basic\Model;
  4. use think\model\relation\HasOne;
  5. /**
  6. * @property integer $id (主键)
  7. * @property string $open_id
  8. * @property integer $agent_id 代理id
  9. * @property integer $store_id 店铺id
  10. * @property string $order_id
  11. * @property string $product_name
  12. * @property integer $out_id 来客商品ID
  13. * @property integer $order_amount 订单金额
  14. * @property integer $pay_amount 实际支付金额
  15. * @property mixed $pay_at 支付时间
  16. * @property mixed $refund_at 退款时间
  17. * @property mixed $refund_apply_at 退款申请时间
  18. * @property integer $intention_poi_id 下单门店
  19. * @property string $mobile
  20. * @property integer $count
  21. * @property integer $status
  22. * @property integer $is_send 1已发送过短信
  23. * @property string $remark
  24. * @property mixed $create_at
  25. */
  26. class SaasOrderLife extends Model
  27. {
  28. /**
  29. * The connection name for the model.
  30. *
  31. * @var string|null
  32. */
  33. protected $connection = 'mysql';
  34. /**
  35. * The table associated with the model.
  36. *
  37. * @var string
  38. */
  39. protected string $table = "saas_order_life";
  40. /**
  41. * The primary key associated with the table.
  42. *
  43. * @var string
  44. */
  45. protected string $primaryKey = "id";
  46. /**
  47. * Indicates if the model should be timestamped.
  48. *
  49. * @var bool
  50. */
  51. public bool $timestamps = false;
  52. public function getOrderAmountAttr($data): string
  53. {
  54. if ($data == 0) return 0;
  55. return format_money($data/100);
  56. }
  57. public function getPayAmountAttr($data): string
  58. {
  59. if ($data == 0) return 0;
  60. return format_money($data/100);
  61. }
  62. public function store(): HasOne
  63. {
  64. return $this->hasOne("app\model\saas\SaasStore","store_id","store_id");
  65. }
  66. public function agent(): HasOne
  67. {
  68. return $this->hasOne("app\model\saas\SaasAgent","agent_id","agent_id");
  69. }
  70. }