StoreProductRelation.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\admin\model\store;
  12. use traits\ModelTrait;
  13. use basic\ModelBasic;
  14. /**
  15. * 点赞and收藏 model
  16. * Class StoreProductRelation
  17. * @package app\admin\model\store
  18. */
  19. class StoreProductRelation extends ModelBasic
  20. {
  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. }