SaasGoods.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. namespace app\model\saas;
  3. use app\extra\basic\Model;
  4. use think\model\relation\HasMany;
  5. use think\model\relation\HasOne;
  6. /**
  7. * @property integer $id (主键)
  8. * @property mixed $product_id 本地商品ID
  9. * @property mixed $goods_id 来客商品ID
  10. * @property mixed $store_id 来客id
  11. * @property mixed $poi_id
  12. * @property string $product_name
  13. * @property mixed $image_list 商品头图
  14. * @property mixed $category 商品ID组
  15. * @property mixed $category_id
  16. * @property integer $settle_type 收款方式
  17. * @property integer $show_channel 投放渠道
  18. * @property integer $limit_use_rule 库存类型
  19. * @property integer $auto_renew 自动延期
  20. * @property integer $use_date_type 顾客可消费日期类型
  21. * @property integer $day_duration 指定天数
  22. * @property integer $can_no_use_date 顾客不可消费日期类型
  23. * @property integer $code_source_type 券码类型
  24. * @property integer $limit_rule_type 限购规则
  25. * @property integer $limit_rule 限购数量
  26. * @property integer $booking_date 预约时间
  27. * @property integer $booking_type 预约规则
  28. * @property integer $booking_unit 预约单位
  29. * @property integer $rec_person_type 使用张数限制
  30. * @property integer $rec_person_num_max 限制数量
  31. * @property integer $mult_sku 多SKU开关
  32. * @property integer $product_type 商品类型
  33. * @property string $sold_start_time 售卖日期
  34. * @property string $sold_end_time 售卖日期
  35. * @property integer $line_price 划线价
  36. * @property integer $price 销售价
  37. * @property mixed $detail_image_list 辅助图
  38. * @property mixed $environment_image_list 环境图
  39. * @property mixed $specs 商品搭配
  40. * @property integer $status 状态
  41. * @property mixed $create_at
  42. */
  43. class SaasGoods extends Model
  44. {
  45. /**
  46. * The connection name for the model.
  47. *
  48. * @var string|null
  49. */
  50. protected $connection = 'mysql';
  51. /**
  52. * The table associated with the model.
  53. *
  54. * @var string
  55. */
  56. protected string $table = "saas_goods";
  57. /**
  58. * The primary key associated with the table.
  59. *
  60. * @var string
  61. */
  62. protected string $primaryKey = "id";
  63. /**
  64. * Indicates if the model should be timestamped.
  65. *
  66. * @var bool
  67. */
  68. public bool $timestamps = false;
  69. public function setPriceAttr($value): int
  70. {
  71. return $value * 100;
  72. }
  73. public function getPriceAttr($value): float
  74. {
  75. return $value / 100;
  76. }
  77. public function getLinePriceAttr($value): float
  78. {
  79. return $value / 100;
  80. }
  81. public function skuSpecs(): HasMany
  82. {
  83. return $this->hasMany(SaasGoodsSku::class, 'product_id', 'product_id');
  84. }
  85. public function poi(): HasOne
  86. {
  87. return $this->hasOne(SaasStore::class, 'poi_id', 'poi_id');
  88. }
  89. }