StoreCouponIssue.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * @author: xaboy<365615158@qq.com>
  4. * @day: 2018/01/17
  5. */
  6. namespace app\admin\model\ump;
  7. use crmeb\basic\BaseModel;
  8. use crmeb\traits\ModelTrait;
  9. class StoreCouponIssue extends BaseModel
  10. {
  11. /**
  12. * 数据表主键
  13. * @var string
  14. */
  15. protected $pk = 'id';
  16. /**
  17. * 模型名称
  18. * @var string
  19. */
  20. protected $name = 'store_coupon_issue';
  21. use ModelTrait;
  22. protected $insert = ['add_time'];
  23. public static function stsypage($where){
  24. $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');
  25. if(isset($where['status']) && $where['status']!=''){
  26. $model=$model->where('A.status',$where['status']);
  27. }
  28. if(isset($where['coupon_title']) && $where['coupon_title']!=''){
  29. $model=$model->where('B.title','LIKE',"%$where[coupon_title]%");
  30. }
  31. return self::page($model);
  32. }
  33. protected function setAddTimeAttr()
  34. {
  35. return time();
  36. }
  37. public static function setIssue($cid,$total_count = 0,$start_time = 0,$end_time = 0,$remain_count = 0,$status = 0,$is_permanent=0)
  38. {
  39. return self::create(compact('cid','start_time','end_time','total_count','remain_count','status','is_permanent'));
  40. }
  41. }