StoreCouponIssueUserDao.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020/6/1
  7. *
  8. *
  9. */
  10. namespace app\common\dao\store\coupon;
  11. use app\common\dao\BaseDao;
  12. use app\common\model\BaseModel;
  13. use app\common\model\store\coupon\StoreCouponIssueUser;
  14. use think\db\BaseQuery;
  15. /**
  16. * Class StoreCouponIssueUserDao
  17. * @package app\common\dao\store\coupon
  18. * @author xaboy
  19. * @day 2020/6/2
  20. */
  21. class StoreCouponIssueUserDao extends BaseDao
  22. {
  23. /**
  24. * @return string
  25. * @author xaboy
  26. * @day 2020/6/2
  27. */
  28. protected function getModel(): string
  29. {
  30. return StoreCouponIssueUser::class;
  31. }
  32. /**
  33. * @param array $where
  34. * @return BaseQuery
  35. * @author xaboy
  36. * @day 2020/6/2
  37. */
  38. public function search(array $where)
  39. {
  40. return StoreCouponIssueUser::getDB()->when(isset($where['coupon_id']) && $where['coupon_id'] != '', function ($query) use ($where) {
  41. $query->where('coupon_id', $where['coupon_id']);
  42. })->when(isset($where['uid']) && $where['uid'] != '', function ($query) use ($where) {
  43. $query->where('uid', $where['uid']);
  44. })->order('create_time');
  45. }
  46. }