StoreBargainUser.php 894 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace app\admin\model\ump;
  3. use crmeb\basic\BaseModel;
  4. use crmeb\traits\ModelTrait;
  5. /**
  6. * 参与砍价Model
  7. * Class StoreBargainUser
  8. * @package app\admin\model\ump
  9. */
  10. class StoreBargainUser extends BaseModel
  11. {
  12. /**
  13. * 数据表主键
  14. * @var string
  15. */
  16. protected $pk = 'id';
  17. /**
  18. * 模型名称
  19. * @var string
  20. */
  21. protected $name = 'store_bargain_user';
  22. use ModelTrait;
  23. /**
  24. * 获取参与人数
  25. * @param int $bargainId $bargainId 砍价产品ID
  26. * @param int $status $status 状态
  27. * @return int|string
  28. */
  29. public static function getCountPeopleAll($bargainId = 0,$status = 0){
  30. if(!$bargainId) return 0;
  31. $model = new self();
  32. $model = $model->where('bargain_id',$bargainId);
  33. if($status) $model = $model->where('status',$status);
  34. return $model->count();
  35. }
  36. }