mirror of https://github.com/helloxz/imgurl
修复探索发现BUG
parent
95b17500da
commit
70c703ecdd
|
@ -29,45 +29,33 @@
|
|||
$siteinfo = $this->query->site_setting();
|
||||
$siteinfo = $siteinfo->values;
|
||||
$siteinfo = json_decode($siteinfo);
|
||||
//每页显示16张图片
|
||||
$limit = 16;
|
||||
|
||||
//echo $page;
|
||||
$siteinfo->title = '探索发现 - '.$siteinfo->title;
|
||||
//SQL语句
|
||||
$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语句
|
||||
switch($type){
|
||||
case 'all':
|
||||
//查询游客上传图片总数
|
||||
$num = $this->query->count_num('visitor')->num;
|
||||
$config['base_url'] = "/found/all/";
|
||||
$sql = $sql_header."ORDER BY a.id DESC LIMIT $limit OFFSET $page";
|
||||
break;
|
||||
case 'gif':
|
||||
$num = $this->query->count_num('gif')->num;
|
||||
$config['base_url'] = "/found/gif/";
|
||||
$sql = $sql_header."AND b.ext = '.gif' ORDER BY a.id DESC LIMIT $limit OFFSET $page";
|
||||
break;
|
||||
case 'views':
|
||||
$num = $this->query->count_num('visitor')->num;
|
||||
case 'views':
|
||||
$config['base_url'] = "/found/views/";
|
||||
$sql = $sql_header."ORDER BY b.views DESC LIMIT $limit OFFSET $page";
|
||||
break;
|
||||
case 'large':
|
||||
$num = $this->query->count_num('large')->num;
|
||||
$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;
|
||||
default:
|
||||
//查询游客上传图片总数
|
||||
$num = $this->query->count_num('visitor')->num;
|
||||
$config['base_url'] = "/found/all/";
|
||||
$sql = $sql_header."ORDER BY a.id DESC LIMIT $limit OFFSET $page";
|
||||
break;
|
||||
}
|
||||
//查询图片信息,返回对象
|
||||
//$data['imgs'] = $this->query->found(96);
|
||||
$data['imgs'] = $this->db->query($sql)->result_array();
|
||||
//$data['imgs'] = $this->db->query($sql)->result_array();
|
||||
$data['imgs'] = $this->query->found_img($type,$page);
|
||||
//查询域名
|
||||
$data['domain'] = $this->query->domain('localhost');
|
||||
|
||||
|
|
|
@ -277,10 +277,51 @@
|
|||
//先获取img id
|
||||
$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";
|
||||
$imginfo = $this->db->query($sql)->row();
|
||||
|
||||
|
||||
return $imginfo;
|
||||
|
||||
}
|
||||
//各种条件的图片查询
|
||||
public function found_img($type,$page){
|
||||
//探索发现每页显示16张图片
|
||||
$limit = 16;
|
||||
//通用的SQL语句头部
|
||||
$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' OR a.level = 'unknown') ";
|
||||
//根据条件生成不同的SQL语句
|
||||
switch($type){
|
||||
case 'all':
|
||||
//查询游客上传图片总数
|
||||
$num = $this->count_num('visitor')->num;
|
||||
//$config['base_url'] = "/found/all/";
|
||||
$sql = $sql_header."ORDER BY a.id DESC LIMIT $limit OFFSET $page";
|
||||
break;
|
||||
case 'gif':
|
||||
$num = $this->count_num('gif')->num;
|
||||
//$config['base_url'] = "/found/gif/";
|
||||
$sql = $sql_header."AND b.ext = '.gif' ORDER BY a.id DESC LIMIT $limit OFFSET $page";
|
||||
break;
|
||||
case 'views':
|
||||
$num = $this->count_num('visitor')->num;
|
||||
//$config['base_url'] = "/found/views/";
|
||||
$sql = $sql_header."ORDER BY b.views DESC LIMIT $limit OFFSET $page";
|
||||
break;
|
||||
case 'large':
|
||||
$num = $this->count_num('large')->num;
|
||||
//$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;
|
||||
default:
|
||||
//查询游客上传图片总数
|
||||
$num = $this->count_num('visitor')->num;
|
||||
//$config['base_url'] = "/found/all/";
|
||||
$sql = $sql_header."ORDER BY a.id DESC LIMIT $limit OFFSET $page";
|
||||
break;
|
||||
}
|
||||
$datas = $this->db->query($sql)->result_array();
|
||||
return $datas;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -20,31 +20,34 @@
|
|||
<!-- 多图上传结果 -->
|
||||
<div class="layui-col-lg12" id = "multiple-re">
|
||||
<div class="layui-tab layui-tab-brief">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">URL</li>
|
||||
<li>HTML</li>
|
||||
<li>Markdown</li>
|
||||
<li>BBCode</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content" style="height: 100px;">
|
||||
<!-- 第一个选显卡结果 -->
|
||||
<div class="layui-tab-item layui-show" id = "re-url">
|
||||
<pre></pre>
|
||||
</div>
|
||||
<!-- 返回HTML结果 -->
|
||||
<div class="layui-tab-item" id = "re-html">
|
||||
<pre></pre>
|
||||
</div>
|
||||
<!-- 返回Markdown结果 -->
|
||||
<div class="layui-tab-item" id = "re-md">
|
||||
<pre></pre>
|
||||
</div>
|
||||
<!-- 返回BBCode结果 -->
|
||||
<div class="layui-tab-item" id = "re-bbc">
|
||||
<pre></pre>
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">URL</li>
|
||||
<li>HTML</li>
|
||||
<li>Markdown</li>
|
||||
<li>BBCode</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content" style="height: 100px;">
|
||||
<!-- 第一个选显卡结果 -->
|
||||
<div class="layui-tab-item layui-show" id = "re-url">
|
||||
<pre></pre>
|
||||
</div>
|
||||
<!-- 返回HTML结果 -->
|
||||
<div class="layui-tab-item" id = "re-html">
|
||||
<pre></pre>
|
||||
</div>
|
||||
<!-- 返回Markdown结果 -->
|
||||
<div class="layui-tab-item" id = "re-md">
|
||||
<pre></pre>
|
||||
</div>
|
||||
<!-- 返回BBCode结果 -->
|
||||
<div class="layui-tab-item" id = "re-bbc">
|
||||
<pre></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 导出txt按钮 -->
|
||||
<!-- <a href="" class="layui-btn layui-btn-sm"><i class="layui-icon layui-icon-download-circle"></i> 导出txt</a> -->
|
||||
<!-- 导出txt按钮end -->
|
||||
</div>
|
||||
<!-- 多图上传结果END -->
|
||||
<!-- 首页主要区域END -->
|
||||
|
|
|
@ -1 +1 @@
|
|||
v2.1.1-20190323
|
||||
v2.1.2-20190406
|
|
@ -247,4 +247,17 @@ function del_img(id,imgid,path,thumbnail_path){
|
|||
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 创建并下载文件
|
||||
* @param {String} fileName 文件名
|
||||
* @param {String} content 文件内容
|
||||
*/
|
||||
function createAndDownloadFile(fileName, content) {
|
||||
var aTag = document.createElement('a');
|
||||
var blob = new Blob([content]);
|
||||
aTag.download = fileName;
|
||||
aTag.href = URL.createObjectURL(blob);
|
||||
aTag.click();
|
||||
URL.revokeObjectURL(blob);
|
||||
}
|
Loading…
Reference in New Issue