* @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 AuctionProduct extends BaseModel { use ModelTrait; protected $pk = 'id'; protected $name = 'auction_product'; protected $autoWriteTimestamp = true; public static function list($where, $id = 0) { $model = self::alias('a') ->field('a.*,u.nickname, au.name as au_name') ->order('a.id DESC') ->leftJoin('auction au', 'a.auction_id = au.id') ->leftJoin('user u', 'a.uid = u.uid'); if ($id){ $model->where('a.auction_id', $id); } if (trim(($where['store_name'])) != ''){ $model->where('a.id|a.name|u.nickname', 'like','%'.$where['store_name'].'%'); } if ( trim($where['is_show']) != ''){ $where['is_show'] = $where['is_show'] == 2? 0: 1; $model->where('a.is_show', '=',$where['is_show']); } if (trim($where['auction_id'])) $model->where('a.auction_id', '=',$where['auction_id']); $data['count'] = $model->count(); if ($where['page'] && $where['limit']){ $model->page($where['page'], $where['limit']); }else{ $model->page(20, 1); } $data['data'] = $model->select()->toArray(); return $data; } }