StoreProductRelation.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\merchant\model\store;
  12. use traits\ModelTrait;
  13. use basic\ModelBasic;
  14. /**
  15. * 点赞and收藏 model
  16. * Class StoreProductRelation
  17. * @package app\merchant\model\store
  18. */
  19. class StoreProductRelation extends ModelBasic
  20. {
  21. use ModelTrait;
  22. public static function getCollect($pid)
  23. {
  24. $model = new self();
  25. $model = $model->where('r.product_id', $pid)->where('r.type', 'collect');
  26. $model = $model->alias('r')->join('__WECHAT_USER__ u', 'u.uid=r.uid');
  27. $model = $model->field('r.*,u.nickname');
  28. return self::page($model);
  29. }
  30. public static function getLike($pid)
  31. {
  32. $model = new self();
  33. $model = $model->where('r.product_id', $pid)->where('r.type', 'like');
  34. $model = $model->alias('r')->join('__WECHAT_USER__ u', 'u.uid=r.uid');
  35. $model = $model->field('r.*,u.nickname');
  36. return self::page($model);
  37. }
  38. }