StoreCouponIssueUserDao.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 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. * 查询发布的优惠券
  35. * @param array $where
  36. * @return BaseQuery
  37. * @author xaboy
  38. * @day 2020/6/2
  39. */
  40. public function search(array $where)
  41. {
  42. return StoreCouponIssueUser::getDB()->when(isset($where['coupon_id']) && $where['coupon_id'] != '', function ($query) use ($where) {
  43. $query->where('coupon_id', $where['coupon_id']);
  44. })->when(isset($where['uid']) && $where['uid'] != '', function ($query) use ($where) {
  45. $query->where('uid', $where['uid']);
  46. })->order('create_time');
  47. }
  48. }