SaasGoods.php 2.7 KB

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