You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Favorite.php 695 B

4 years ago
123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace addons\unishop\model;
  3. use addons\unishop\extend\Hashids;
  4. use think\Model;
  5. /**
  6. * Class Favorite 收藏表
  7. * @package addons\unishop\model
  8. */
  9. class Favorite extends Model
  10. {
  11. // 表名
  12. protected $name = 'unishop_favorite';
  13. // 开启自动写入时间戳字段
  14. protected $autoWriteTimestamp = 'int';
  15. // 定义时间戳字段名
  16. protected $createTime = 'createtime';
  17. protected $updateTime = false;
  18. protected $hidden = [
  19. 'product_id'
  20. ];
  21. /**
  22. * 关联商品表
  23. */
  24. public function product()
  25. {
  26. return $this->hasOne('product', 'id', 'product_id')->field('id,image,title,sales_price,market_price');
  27. }
  28. }