StoreCouponDao.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\dao\activity\coupon;
  12. use app\dao\BaseDao;
  13. use app\model\activity\coupon\StoreCoupon;
  14. /**
  15. * 优惠卷
  16. * Class StoreCouponDao
  17. * @package app\dao\coupon
  18. */
  19. class StoreCouponDao extends BaseDao
  20. {
  21. /**
  22. * 设置模型
  23. * @return string
  24. */
  25. protected function setModel(): string
  26. {
  27. return StoreCoupon::class;
  28. }
  29. /**
  30. * 获取文章列表
  31. * @param array $where
  32. * @param int $page
  33. * @param int $limit
  34. * @return mixed
  35. */
  36. public function getList(array $where, int $page, int $limit)
  37. {
  38. return $this->search($where)->page($page, $limit)->order('sort desc,id desc')->select()->toArray();
  39. }
  40. /**
  41. * 写入优惠卷
  42. * @param $cid
  43. * @param int $total_count
  44. * @param int $start_time
  45. * @param int $end_time
  46. * @param int $remain_count
  47. * @param int $status
  48. * @param int $is_permanent
  49. * @param int $full_reduction
  50. * @param int $is_give_subscribe
  51. * @param int $is_full_give
  52. * @return \crmeb\basic\BaseModel|\think\Model
  53. */
  54. public function setIssue($cid, $total_count = 0, $start_time = 0, $end_time = 0, $remain_count = 0, $status = 0, $is_permanent = 0, $full_reduction = 0, $is_give_subscribe = 0, $is_full_give = 0)
  55. {
  56. $add_time = time();
  57. $data['cid'] = $cid;
  58. $data['start_time'] = $start_time;
  59. $data['end_time'] = $end_time;
  60. $data['total_count'] = $total_count;
  61. $data['remain_count'] = $remain_count;
  62. $data['is_permanent'] = $is_permanent;
  63. $data['status'] = $status;
  64. $data['is_give_subscribe'] = $is_give_subscribe;
  65. $data['is_full_give'] = $is_full_give;
  66. $data['full_reduction'] = $full_reduction;
  67. $data['add_time'] = $add_time;
  68. //TODO $data 参数没有使用
  69. return $this->getModel()->create(compact('cid', 'start_time', 'end_time', 'total_count', 'remain_count', 'is_permanent', 'status', 'is_give_subscribe', 'is_full_give', 'full_reduction', 'add_time'));
  70. }
  71. }