UserApply.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. *
  4. * @author: xaboy<365615158@qq.com>
  5. * @day: 2017/12/25
  6. */
  7. namespace app\admin\model\user;
  8. use crmeb\basic\BaseModel;
  9. use crmeb\traits\ModelTrait;
  10. /**
  11. * TODO 用户申请
  12. * Class UserAddress
  13. * @package app\models\user
  14. */
  15. class UserApply extends BaseModel
  16. {
  17. /**
  18. * 数据表主键
  19. * @var string
  20. */
  21. protected $pk = 'id';
  22. /**
  23. * 模型名称
  24. * @var string
  25. */
  26. protected $name = 'user_apply';
  27. use ModelTrait;
  28. protected $autoWriteTimestamp = true;
  29. public static function list($where)
  30. {
  31. $model = self::alias('a')->field('a.*,u.nickname')
  32. ->leftJoin('user u', 'a.uid = u.uid')
  33. ->order('a.id DESC');
  34. if ($where['name'])$model->where('a.name' , 'like', '%'.$where['name'],'%');
  35. if ($where['type']) $model->where('a.type', $where['type']);
  36. if ($where['status']) {
  37. if ($where['status'] == 1) $model->where('a.status', '=', -1);
  38. if ($where['status'] == 2) $model->where('a.status', '=', 0);
  39. if ($where['status'] == 3) $model->where('a.status', '=', 1);
  40. }
  41. $data['count'] = $model->count();
  42. if ($where['page'] && $where['limit']){
  43. $model->page($where['page'], $where['limit']);
  44. }else{
  45. $model->page(20, 1);
  46. }
  47. $list = $model->select()->toArray();
  48. $data['data'] = $list;
  49. return $data;
  50. }
  51. }