StoreCouponIssueUserDao.php 1.7 KB

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