where($where)->count(); $list = $store->where($where)->page($get['page'], $get['limit'])->order('id desc')->select(); foreach ($list as &$item) { $item['image'] = UrlServer::getFileUrl($item['image']); $item['create_time'] = date('Y-m-d H:i:s', $item['create_time']); if ($item['is_show'] == 1) { $item['is_show_text'] = '显示'; } else { $item['is_show_text'] = '隐藏'; } } return ['count' => $count, 'lists' => $list]; } public static function addStore($post) { $store = new Store(); $data = [ 'title' => $post['title'], 'address' => $post['address'], 'image' => $post['image'], 'business' => $post['business'], 'is_show' => $post['is_show'], 'traffic' => $post['traffic'], 'create_time' => time(), 'contact' => $post['contact'], ]; return $store->save($data); } public static function editStore($post) { $store = new Store(); $data = [ 'title' => $post['title'], 'address' => $post['address'], 'image' => $post['image'], 'business' => $post['business'], 'is_show' => $post['is_show'], 'traffic' => $post['traffic'], 'update_time' => time(), 'contact' => $post['contact'], ]; return $store->save($data, ['id' => $post['id'], 'del' => 0]); } public static function getStore($id) { $store = new Store(); $detail = $store::get(['id' => $id, 'del' => 0]); $detail['abs_image'] = UrlServer::getFileUrl($detail['image']); return $detail; } public static function delStore($id) { $store = new Store(); $data = [ 'del' => time(), 'update_time' => 1 ]; return $article->save($data, ['id' => $id, 'del' => 0]); } public static function switchStatus($post) { $data = [ 'is_show' => $post['is_show'], 'update_time' => time(), ]; return Db::name('store')->where(['del' => 0, 'id' => $post['id']])->update($data); } }