$sql_header = "SELECT a.id,a.imgid,a.path,a.thumb_path,a.date,a.compression,a.level,b.mime,b.width,b.height,b.views,b.ext,b.client_name FROM img_images AS a INNER JOIN img_imginfo AS b ON a.imgid = b.imgid AND a.user = 'visitor' AND a.level = 'everyone' ";
//根据条件生成不同的SQL语句
//根据条件生成不同的SQL语句
switch($type){
switch($type){
case 'all':
case 'all':
//查询游客上传图片总数
//查询游客上传图片总数
$num = $this->query->count_num('visitor')->num;
$config['base_url'] = "/found/all/";
$config['base_url'] = "/found/all/";
$sql = $sql_header."ORDER BY a.id DESC LIMIT $limit OFFSET $page";
break;
break;
case 'gif':
case 'gif':
$num = $this->query->count_num('gif')->num;
$config['base_url'] = "/found/gif/";
$config['base_url'] = "/found/gif/";
$sql = $sql_header."AND b.ext = '.gif' ORDER BY a.id DESC LIMIT $limit OFFSET $page";
break;
break;
case 'views':
case 'views':
$num = $this->query->count_num('visitor')->num;
$config['base_url'] = "/found/views/";
$config['base_url'] = "/found/views/";
$sql = $sql_header."ORDER BY b.views DESC LIMIT $limit OFFSET $page";
break;
break;
case 'large':
case 'large':
$num = $this->query->count_num('large')->num;
$config['base_url'] = "/found/large/";
$config['base_url'] = "/found/large/";
$sql = $sql_header."AND b.width >= 1920 AND b.height >= 1080 ORDER BY a.id DESC LIMIT $limit OFFSET $page";
break;
break;
default:
default:
//查询游客上传图片总数
$num = $this->query->count_num('visitor')->num;
$config['base_url'] = "/found/all/";
$config['base_url'] = "/found/all/";
$sql = $sql_header."ORDER BY a.id DESC LIMIT $limit OFFSET $page";
$sql = "SELECT a.*,b.mime,b.width,b.height,b.views,b.ext,b.client_name FROM img_images AS a INNER JOIN img_imginfo AS b ON a.id = $id AND a.imgid = b.imgid";
$sql = "SELECT a.*,b.mime,b.width,b.height,b.views,b.ext,b.client_name FROM img_images AS a INNER JOIN img_imginfo AS b ON a.id = $id AND a.imgid = b.imgid";