* @day: 2017/12/25 */ namespace app\admin\model\user; use crmeb\basic\BaseModel; use crmeb\traits\ModelTrait; /** * TODO 用户申请 * Class UserAddress * @package app\models\user */ class UserApply extends BaseModel { /** * 数据表主键 * @var string */ protected $pk = 'id'; /** * 模型名称 * @var string */ protected $name = 'user_apply'; use ModelTrait; protected $autoWriteTimestamp = true; public static function list($where) { $model = self::alias('a')->field('a.*,u.nickname') ->leftJoin('user u', 'a.uid = u.uid') ->order('a.id DESC'); if ($where['name'])$model->where('a.name' , 'like', '%'.$where['name'],'%'); if ($where['type']) $model->where('a.type', $where['type']); if ($where['status']) { if ($where['status'] == 1) $model->where('a.status', '=', -1); if ($where['status'] == 2) $model->where('a.status', '=', 0); if ($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; } }