StoreProductRelation.php 954 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\admin\model\store;
  3. use crmeb\traits\ModelTrait;
  4. use crmeb\basic\BaseModel;
  5. /**
  6. * 点赞and收藏 model
  7. * Class StoreProductRelation
  8. * @package app\admin\model\store
  9. */
  10. class StoreProductRelation extends BaseModel
  11. {
  12. /**
  13. * 模型名称
  14. * @var string
  15. */
  16. protected $name = 'store_product_relation';
  17. use ModelTrait;
  18. public static function getCollect($pid)
  19. {
  20. $model = new self();
  21. $model = $model->where('r.product_id', $pid)->where('r.type', 'collect');
  22. $model = $model->alias('r')->join('wechat_user u', 'u.uid=r.uid');
  23. $model = $model->field('r.*,u.nickname');
  24. return self::page($model);
  25. }
  26. public static function getLike($pid)
  27. {
  28. $model = new self();
  29. $model = $model->where('r.product_id', $pid)->where('r.type', 'like');
  30. $model = $model->alias('r')->join('wechat_user u', 'u.uid=r.uid');
  31. $model = $model->field('r.*,u.nickname');
  32. return self::page($model);
  33. }
  34. }