count(); $list = $model->page((int)$where['page'], (int)$where['limit']) ->select() ->each(function ($item) { $item['add_time'] = date('Y-m-d H:i:s', $item['add_time']); }); return compact('count', 'list'); } /** * 设置商家 where 条件 * @param $where * @param null $model * @return mixed */ public static function setWhere($where, $model = null) { $model = $model === null ? new self() : $model; $model = $model->alias('c'); $model = $model->field('c.*'); if (isset($where['name']) && $where['name'] != '') $model = $model->where('c.id|c.name', 'LIKE', "%$where[name]%"); if (isset($where['main']) && $where['main'] != '') $model = $model->where('c.main', $where['main']); return $model->order('c.id desc')->where('c.is_del', 0); } /** * 详情 */ public static function getOne($id) { $info = self::get($id); return $info; } }