MemberShip.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\admin\model\user;
  12. use traits\ModelTrait;
  13. use basic\ModelBasic;
  14. /**
  15. * 会员设置 model
  16. * Class User
  17. * @package app\admin\model\user
  18. */
  19. class MemberShip extends ModelBasic
  20. {
  21. use ModelTrait;
  22. public static function setWhere($where){
  23. $model=self::where('is_del',0);
  24. if($where['is_publish']!='') $model->where('is_publish',$where['is_publish']);
  25. if($where['title']!='') $model->where('title','like',"%$where[title]%");
  26. return $model;
  27. }
  28. public static function getSytemVipList($where){
  29. $model=self::setWhere($where)->order('sort DESC,add_time DESC');
  30. $data=($list=$model->page((int)$where['page'],(int)$where['limit'])
  31. ->select()) && count($list) ? $list->toArray() : [];
  32. foreach ($data as &$item){
  33. if($item['vip_day']==-1) $item['vip_day']='永久';
  34. }
  35. $count=self::setWhere($where)->count();
  36. return compact('data','count');
  37. }
  38. public static function getSytemVipSelect(){
  39. return self::where('mer_id',0)->where('is_del',0)->where('is_show',1)->column('title','id');
  40. }
  41. }