Active.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\api\model\sharing;
  10. use app\common\exception\BaseException;
  11. use app\common\model\sharing\Active as ActiveModel;
  12. /**
  13. * 拼团拼单模型
  14. * Class Active
  15. * @package app\api\model\sharing
  16. */
  17. class Active extends ActiveModel
  18. {
  19. /**
  20. * 隐藏字段
  21. * @var array
  22. */
  23. protected $hidden = [
  24. 'wxapp_id',
  25. 'create_time',
  26. 'update_time'
  27. ];
  28. /**
  29. * 新增拼单记录
  30. * @param $data
  31. * @return false|int
  32. */
  33. public function add($data)
  34. {
  35. return $this->save($data);
  36. }
  37. /**
  38. * 根据商品id获取进行中的拼单列表
  39. * @param $goods_id
  40. * @param int $limit
  41. * @return false|\PDOStatement|string|\think\Collection
  42. */
  43. public static function getActivityListByGoods($goods_id, $limit = 15)
  44. {
  45. return (new static)->with(['user'])
  46. ->where('goods_id', '=', $goods_id)
  47. ->where('status', '=', 10)
  48. ->limit($limit)
  49. ->select();
  50. }
  51. }