StoreProductRelation.php 1.0 KB

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