1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace app\admin\model\user;
- use crmeb\traits\ModelTrait;
- use crmeb\basic\BaseModel;
- use think\model\concern\SoftDelete;
- class UserApply extends BaseModel
- {
-
- protected $pk = 'id';
-
- protected $name = 'user_apply';
- use ModelTrait;
- protected $autoWriteTimestamp = true;
- public static function list($where)
- {
- $model = self::alias('a')->field('a.*,u.nickname')->order('a.id DESC')
- ->leftJoin('user u', 'a.uid = u.uid');
- if ($where['name'])$model->where('u.uid|u.nickname' , 'like', '%'.$where['name'].'%');
- if ($where['status']){
- if ($where['status'] == 1){
- $model->where('a.status' , 0);
- }elseif ($where['status'] == 2){
- $model->where('a.status' , 1);
- }elseif ($where['status'] == 3){
- $model->where('a.status' , -1);
- }
- }
- $data['count'] = $model->count();
- if ($where['page'] && $where['limit']){
- $model->page($where['page'], $where['limit']);
- }else{
- $model->page(20, 1);
- }
- $list = $model->select()->toArray();
- $data['data'] = $list;
- return $data;
- }
- }
|