SaasGoodsSku.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace app\model\saas;
  3. use app\extra\basic\Model;
  4. /**
  5. * @property integer $id (主键)
  6. * @property integer $goods_id 来客商品ID
  7. * @property mixed $sku_id
  8. * @property mixed $product_id 本地商品ID
  9. * @property string $name
  10. * @property string $image
  11. * @property integer $line_price
  12. * @property integer $price
  13. * @property mixed $specs
  14. * @property integer $is_default
  15. * @property mixed $create_at
  16. */
  17. class SaasGoodsSku extends Model
  18. {
  19. /**
  20. * The connection name for the model.
  21. *
  22. * @var string|null
  23. */
  24. protected $connection = 'mysql';
  25. /**
  26. * The table associated with the model.
  27. *
  28. * @var string
  29. */
  30. protected string $table = "saas_goods_sku";
  31. /**
  32. * The primary key associated with the table.
  33. *
  34. * @var string
  35. */
  36. protected string $primaryKey = "id";
  37. /**
  38. * Indicates if the model should be timestamped.
  39. *
  40. * @var bool
  41. */
  42. public bool $timestamps = false;
  43. public function setPriceAttr($value): int
  44. {
  45. return $value * 100;
  46. }
  47. public function getPriceAttr($value): float
  48. {
  49. return $value / 100;
  50. }
  51. public function setLinePriceAttr($value): int
  52. {
  53. return $value * 100;
  54. }
  55. public function getLinePriceAttr($value): float
  56. {
  57. return $value / 100;
  58. }
  59. }