<?php

/**
 *
 * @author: xaboy<365615158@qq.com>
 * @day: 2017/11/02
 */

namespace app\admin\model\auction;

use crmeb\traits\ModelTrait;
use crmeb\basic\BaseModel;

/**
 * 场馆 Model
 * Class WechatNews
 * @package app\admin\model\wechat
 */
class AuctionApply extends BaseModel
{

    use ModelTrait;

    protected $pk = 'id';

    protected $name = 'auction_apply';
    protected $autoWriteTimestamp = true;


    public static function list($where)
    {
        $model = self::alias('a')
            ->field('a.*, u.nickname,u.avatar as image')
            ->order('a.id DESC')
            ->leftJoin('user u', 'a.uid = u.uid');

        if ($where['auction']) $model->where('u.nickname', 'like', '%'.$where['auction'].'%');
        if ($where['page'] && $where['limit']){
            $model->page($where['page'], $where['limit']);
        }else{
            $model->page(20, 1);
        }

        $data['count'] = $model->count();
        $list = $model->select();
        $data['data'] = empty($list) ? [] : $list->toArray();
        return $data;

    }




}