1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- /**
- * @author: xaboy<365615158@qq.com>
- * @day: 2017/11/11
- */
- namespace app\admin\model\user;
- use crmeb\traits\ModelTrait;
- use crmeb\basic\BaseModel;
- use think\model\concern\SoftDelete;
- /**
- * Class StoreCategory
- * @package app\admin\model\store
- */
- 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')->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;
- }
- }
|