StoreCouponIssue.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. *
  4. * @author: xaboy<365615158@qq.com>
  5. * @day: 2018/01/17
  6. */
  7. namespace app\admin\model\ump;
  8. use basic\ModelBasic;
  9. use traits\ModelTrait;
  10. class StoreCouponIssue extends ModelBasic
  11. {
  12. use ModelTrait;
  13. protected $insert = ['add_time'];
  14. public static function stsypage($where){
  15. $model = self::alias('A')->field('A.*,B.title')->join('__STORE_COUPON__ B','A.cid = B.id')->where('A.is_del',0)->order('A.add_time DESC');
  16. if(isset($where['status']) && $where['status']!=''){
  17. $model=$model->where('A.status',$where['status']);
  18. }
  19. if(isset($where['coupon_title']) && $where['coupon_title']!=''){
  20. $model=$model->where('B.title','LIKE',"%$where[coupon_title]%");
  21. }
  22. return self::page($model);
  23. }
  24. protected function setAddTimeAttr()
  25. {
  26. return time();
  27. }
  28. public static function setIssue($cid,$total_count = 0,$start_time = 0,$end_time = 0,$remain_count = 0,$status = 0)
  29. {
  30. return self::set(compact('cid','start_time','end_time','total_count','remain_count','status'));
  31. }
  32. }