<?php
error_reporting(0); 
include("../../config/qiantai.php");
session_start();
if(!isset($_SESSION['username'])){echo "<script>alert('请重新登录!')</script><script>top.location.href='/index$dshz'</script>";exit;}
$username=$_SESSION['username'];
$type="where name='$username'";
$user=queryall(user,$type);
$userid=$user['userid'];
if(!$user){echo "<script>alert('请重新登录!')</script><script>top.location.href='/index$dshz'</script>";exit;}
$day=date("m-d");
$name=ubo($_GET["name"]);
$flid=ubo($_GET["flid"]);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="gb2312">
<title>私有片库</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="/2019newui/qiantai/css/x-admin.css" media="all">
<script src="/2019newui/js/jquery.min.js"></script>
<script type="text/javascript" src="/2019newui/js/clipboard.min.js"></script>
<link rel="stylesheet" href="/layui/css/layui.css" media="all" />
<script src="/layui/layui.js"></script>
<script language="javascript" src="/2019newui/js/base64.js"></script>
</head>
<body>
<div class="x-body">
<?php
$sql = mysql_query("SELECT * FROM daili  WHERE  userid='$userid' ");
$bs = mysql_num_rows($sql);
?>
<blockquote class="layui-elem-quote">
<dl class="apps-filter-tr">
<dt><?php if($name or $flid or $page){?><a href="javascript:;"  onclick="window.history.back(-1);" class="aui-navBar-item"><i class="icon layui-icon" style="font-size: 30px;">&#xF060;</i></a>    <?php }?><span  class="xb">私有片库</span></dt>
</dl>
<span class="x-right" style="margin-top:-24px;line-height:10px">共有片源：<?php echo $bs?> 部 <a class="layui-btn-small" style="line-height:10px;margin-top:-2px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="fa fa-refresh"></i></a></span>
</blockquote>
<div class="layui-form x-center" action="" style="width:100%">
<div class="layui-form-pane layui-form" style="margin-top: 15px;">
<div class="layui-form-item">
<label class="layui-form-label" style="width:80px">按分类</label>
<div class="layui-input-inline" style="width:220px;text-align: left">
<select name="paylx"    lay-filter="paylx">
<option value='请选择'>请选择分类</option>
<option value=''>全部数据</option>
<?php 
$result = mysql_query("SELECT * FROM  dlfl   WHERE yc='1' and userid='$userid' ");
$count = mysql_num_rows($result);
?>
<?php if($count == 0){?><option value='0'>暂无分类</option><?php }?>
<?php
$query = mysql_query("SELECT * FROM  dlfl   WHERE yc='1' and userid='$userid' ");
while($a = mysql_fetch_array($query)) {
?>  
<option value='<?php echo $a[id]?>'><?php echo $a[name]?></option>
<?php }?>
</select>
</div>
<label class="layui-form-label" style="width:80px">按名称</label>
<div class="layui-input-inline" style="width:220px">
<input type="text"  name="name"  id="name"  autocomplete="off" class="layui-input" value="<?php if($name){echo $name;}?>" placeholder="请输入视频名称" onkeyup="cq(this.value)">
</div>
<label class="layui-form-label" style="width:120px">数据显示方式</label>
<div class="layui-input-inline" style="width:220px">
<select name="fs"    lay-filter="fs" >
<option value='请选择'>请选择</option>
<option value='1'>按随机显示数据</option>
<option value='2'>按正序显示数据</option>
<option value='3'>按倒序显示数据</option>
<option value='4'>按打赏次数显示数据</option>
<option value='5'>按时间显示数据</option>
</select>
</div>
</div>
</div> 
</div>
<table class="layui-table" id="data-row">
<thead>
<tr>
<?php if($name or $flid){?><?php }else{?><th style="text-align:center;width: 34px;" ><label class="demo--label2"><input class="demo--radio" type="checkbox"><span class="demo--checkbox demo--radioInput"></span></label></th><?php }?>
<!--<th style="text-align:center;" >影片ID</th>-->
<?php if($pic==1){?><th style="text-align:center;width: 120px;" >影片缩略图</th><?php }?>
<th style="text-align:center;" >影片名称</th>
<th style="text-align:center;" >影片分类</th>
<?php if($yulan=='1'){?><th style="text-align:center;width: 40px;" >试看</th><?php }?>
<th style="text-align:center;width: 140px;" >价格（格式1-1 或1）</th>
<?php if($lei==1){?>
<th style="text-align:center;width: 60px;" id='leijiage'>暗雷价格</th>
<?php }?>
<th style="text-align:center;width: 100px;" >短链接</th>
<th style="text-align:center;width: 140px;" >添加时间</th>
<th style="text-align:center;width: 140px;" >打赏次数</th>
<th style="text-align:center;width: 60px;" >状态</th>
<th style="text-align:center;width: 60px;" >是否试看</th>
</tr>
</thead>
<tbody>
<?php 
$page_size=8; 
$sql= "WHERE 1=1";
$sql.=" and userid='$userid' ";
if($name){
$sql .=" and name like '%$name%' ";
}
if($flid){
$sql .=" and flid='$flid' ";
}
$resul = mysql_query("select * from  daili   ".$sql."");
$count = mysql_num_rows($resul);
if($count == 0){echo '<tr><td colspan="12" style="text-align:center;">没有记录</td></tr> ';}
$page_count = ceil($count/$page_size); 
$init=1; 
$page_len=7; 
$max_p=$page_count; 
$pages=$page_count; 
if(empty($_GET['page'])||$_GET['page']<0){ 
$page=1; 
}else { 
$page=$_GET['page']; 
} 
$offset=$page_size*($page-1); 
$query = mysql_query("select * from  daili  ".$sql."  order by id desc     limit $offset, $page_size");
while ($a=mysql_fetch_array($query)) { 
$type="where id='$a[flid]'";
$fl=queryall(dlfl,$type);
if($fl[name]){
$flname=$fl[name];
}else{
$flname='暂无分类';
}
?> 	
<tr>
<?php if($name or $flid){?>
<?php }else{?>
<td style="text-align:center;width: 34px;" >
<label class="demo--label2"><input class="demo--radio" type="checkbox"   name="ids[]" id="ck-<?php echo $a['id']?>" value="<?php echo $a['id']?>" data-title="<?php if($a['zt']=='待审核'){?>状态待审核<?php }else{?><?php echo $a['name']?><?php }?>" data-url="<?php if($a['zt']=='待审核'){?>状态待审核<?php }else{?><?php echo $a[link]?><?php }?>"><span class="demo--checkbox demo--radioInput"></span></label></td><?php }?>
<!--<td align="center"><?php echo $a[id]?></td>-->
<?php if($pic==1){?><td style="text-align: center;"><img style="width: 120px; height: 80px; cursor: -webkit-zoom-in;" src="<?php echo $a[pic]?>"  onerror="this.src = '/2019newui/images/nopic.jpg'" ></td><?php }?>
<td  style="text-align:center;" ><input type="text" name="title[]" class="title  layui-input" data-id="<?php echo $a['id']?>" value="<?php echo $a['name']?>" style="width: 100%;"></td>
<td align="center"><span style="color:#<?php echo randColor()?>;"> <?php echo $flname?></span></td>
<?php if($yulan=='1'){?><td  style="text-align:center;" ><i class="fa fa-video-camera"  onClick="play('<?php echo $a['id']?>','dl')" style="top: 1px;" ></i></td><?php }?>
<td  style="text-align:center;" ><input type="text" class="price price-<?php echo $a['id']?> layui-input" value="<?php if($a['sj']==$a['money']){?><?php echo $a['money']?><?php }else{?><?php echo $a['sj']?>-<?php echo $a['money']?><?php }?>" data-id="<?php echo $a['id']?>"   data-toggle="tooltip" data-placement="right" title="" style="width: 140px;"> </td>
<?php if($lei==1){?>
<td  style="text-align:center;" ><input type="text"  class="lei lei-<?php echo $a['id']?> layui-input" value="<?php echo $a['lei']?>" data-id="<?php echo $a['id']?>"   data-toggle="tooltip" data-placement="right" title="" style="width: 60px;text-align:center;"> </td>
<?php }?>
<td  style="text-align:center;" ><?php if($a['zt']=='待审核'){echo "状态待审核";}else{echo "<a href='$a[link]'  target='_blank'>$a[link]</a>";}?></td>
<td style="text-align:center;" ><?php echo $a['shijian']?></td>
<td style="text-align:center;" ><?php echo $a['cs']?></td>
<td style="text-align:center;" ><?php echo $a['zt']?></td>
<td style="text-align:center;" ><div class="layui-form"><input type="checkbox"  name="open"  data-id="<?php echo $a[id]?>"  lay-skin="switch" lay-filter="lx" lay-text="是|否" <?php if($a[lx]=="2"){?> checked<?php }?>></div></td>
</tr>
<?php 
} 
$page_len = ($page_len%2)?$page_len:$pagelen+1;//页码个数 
$pageoffset = ($page_len-1)/2;//页码个数左右偏移量 
if($page!=1){ 
if($name or $flid){
}else{
$keyt.="<a href=\""."/sppage/1/\">首页</a>"; //首页 
$keyt.="<a href=\""."/sppage/".($page-1)."/\">上一页 </a>"; //上一页 
}
}else { 
if($name or $flid){
}else{
$keyt.="<p>首页</p>"; //首页 
$keyt.="<p>上一页 </p>"; //上一页  
}
} 
if($pages>$page_len){ 
//如果当前页小于等于左偏移 
if($page<=$pageoffset){ 
$init=1; 
$max_p = $page_len; 
}else{//如果当前页大于左偏移 
//如果当前页码右偏移超出最大分页数 
if($page+$pageoffset>=$pages+1){ 
$init = $pages-$page_len+1; 
}else{ 
//左右偏移都存在时的计算 
$init = $page-$pageoffset; 
$max_p = $page+$pageoffset; 
} 
} 
} 
for($i=$init;$i<=$max_p;$i++){ 
if($i==$page){ 
if($name or $flid){
}else{
$keyt.='<a class="cur">'.$i.'</a>'; 
}
} else { 
if($name or $flid){
}else{
$keyt.="<a href=\""."/sppage/".$i."/\">".$i."</a>"; 
}
} 
} 
if($page!=$pages){ 
if($name or $flid){
}else{
$keyt.="<a href=\""."/sppage/".($page+1)."/\">下一页 </a> ";//下一页 
$keyt.="<a href=\""."/sppage/{$pages}/\">尾页</a> "; //最后一页 
}
}else { 
if($name or $flid){
}else{
$keyt.="<p>下一页 </p>";//下一页 
$keyt.="<p>尾页</p>"; //最后一页 
}
} 
if($name or $flid){
}else{
$keyt.="<p class='pageRemark' >当前第 <b> $page </b> 页/共 <b> $pages </b> 页  共 <b>$count</b> 条数据 </p>"; //第几页,共几页 

}?>   	    	
<hr>
<?php if($count =="0"){?>
<?php }else{?>
<?php if($name or $flid){?>
<?php }else{?>
<tr>
<td  colspan="12" style="text-align:left;padding-left:20px;" >
<a class="btn  btn-xs btn-jiage"  onclick="plfl()" role="button">批量更改分类</a>
<a class="btn btn-danger btn-xs multipleDelete" href="#" role="button">批量删除链接</a>
<a class="btn btn-up btn-xs"  onClick="up()" role="button">批量更新短链接</a>
<a class="btn  btn-xs btn-jiage"  onclick="jiage()" role="button">批量更改价格</a>
<a class="btn  btn-xs btn-jiage"  onclick="yjsk()" role="button">一键试看</a>
<a class="btn  btn-xs btn-jiage"  onclick="yjgai()" role="button">一键改价</a>
<!--<a class="btn  btn-xs btn-jiage"  onclick="fenxiang()" role="button">分享公共片库</a>-->
<a class="btn  btn-xs btn-jiage"  onclick="zonglian()" role="button">生成推广总链</a>
<!--<a class="btn  btn-xs btn-jiage"  onclick="dwz()" role="button">一键更新短链接</a>-->
<a class="btn  btn-xs btn-jiage"  onclick="yjsc()" role="button">一键删除片库（私有）</a>
</td>
</tr>
<?php }?>
<?php }?>
</tbody>
</table>
<?php if($pic==1){?>
<div id="img-div" style="position: fixed; left: 0; right: 0; bottom: 0; top: 0; z-index: 999999; text-align: center; display: none; ">
<img id="big-img" style="position:relative;z-index:99999;cursor:-webkit-zoom-out;" src="">
<div style="position:fixed;left:0;right:0;bottom:0;top:0;background:#000000;opacity:0.4; z-index:111;">
</div>
</div>
<?php }?>
<?php if($count =="0"){?>
<?php }else{?>
<div id="info" style = "display : none"></div>
<div style="padding:0 20px;"><div class="pagination"><?php echo $keyt?></div></div>
<?php }?>
</div>
</div>
</div>
</div>
<br><br><br><br><br><br>
<script>
layui.use(['form', 'layedit', 'laydate', 'element', 'jquery', 'layer'], function(){
var form = layui.form
,layer = layui.layer
,layedit = layui.layedit
,element = layui.element
,laydate = layui.laydate
,$ = layui.jquery;
form.on('select(fs)', function(data){
if (data.value=='请选择') {
layer.msg('显示方式未选择');
return false;
}else{
layer.close(index);
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {fs: data.value,lx:'fssz'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('设置成功');
location.reload();
} 
},
error:function(){
}
});
}
});
form.on('select(paylx)', function(data){
if (data.value=='请选择') {
layer.msg('请选择分类');
return false;
}else{
window.location.href='/shipin<?php echo $dshz?>?flid='+data.value; 
}
});
form.on('switch(lx)', function (data) {
var zt = this.checked ? 1 : 0,
id = $(this).attr('data-id');
if(zt=='1'){
tip='设置为试看吗？';
}else{
tip='取消试看吗？';
}
layer.confirm("确认要" +tip , { title: "确认" }, function (index) {
layer.close(index);
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {id: id,lx:'shikan',zt:zt},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('设置成功');
location.reload();
}else{
layer.closeAll('loading');
layer.msg(data.msg);
location.reload();
} 
},
error:function(){
}
});
}); 
});
});
</script>
<?php if($count =="0"){?>
<?php }else{?>
<script type="text/javascript">
$(function() {
var changeContent = function() {
var links = $('input[name="ids[]"]:checked');
var myDate=new Date();
var contents = "<?php echo $tip?> \r\n 今日推荐视频更新于 <?php echo $day?>  \r\n------------------------ \r\n";
$.each(links, function(index, val) {
contents += $(val).attr('data-title') + "\r\n" + $(val).attr('data-url') + "\r\n";
});
contents += "------------------------ \r\n  <?php echo $tip1?> \r\n ++++ <?php echo $tip2?> ++++";
$("#info").html(contents);
}
$(document).on('change', '.price', function(event) {
event.preventDefault();
var id = $(this).attr('data-id'),
price = $(this).val();
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {id: id, money : price, lx : 'jiage'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('价格修改成功');
location.reload();
}else{
layer.closeAll('loading');
layer.msg(data.msg);
} 
},
error:function(){
}
});
});
<?php if($lei==1){?>
$(document).on('change', '.lei', function(event) {
event.preventDefault();
var id = $(this).attr('data-id'),
lei = $(this).val();
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {id: id, money : lei, lx : 'lei'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('修改成功');
location.reload();
}else{
layer.closeAll('loading');
layer.msg(data.msg);
} 
},
error:function(){
}
});
});
<?php }?>
$(document).on('click', '.chk-all', function(event) {
event.preventDefault();
$('input[name="ids[]"]').prop('checked', 'checked');
changeContent();
});
$(document).on('click', '.unchk-all', function(event) {
event.preventDefault();
$('input[name="ids[]"]').prop('checked', false);
changeContent();
});
$(document).on('change', 'input[name="ids[]"]', function(event) {
event.preventDefault();
changeContent();
});

$(function(){
var cks = $(":checkbox:gt(0)"); 
var fk = $(":checkbox:first").click(function(){
cks.prop("checked", $(this).prop("checked"));
changeContent();
layer.open({
type: 1,
title: '推广链接获取',
skin: 'layui-layer-rim', 
area: ['630px', '440px'], 
content:  '<textarea  style="height: 440px; width: 630px;resize:none;"  class="layui-textarea" id="copy" data-clipboard-action="copy" data-clipboard-target="#copy">'+ $("#info").html()+'</textarea>'              
});
});
cks.click(function(){
if(!$(this).prop("checked")){
fk.prop("checked",false);
changeContent();
}else{
if(cks.filter(":not(:checked)").length == 0){
fk.prop("checked",true);
changeContent();
}
}
});
});
// 修改标题
$(document).on('change', '.title', function(event) {
event.preventDefault();
var id  = $(this).attr('data-id'),
title  = $(this).val();
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
//更新标题
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {id: id, name : title, lx : 'name'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('影片名称更新成功');
location.reload();
}else{
layer.closeAll('loading');
layer.msg(data.msg);
} 
},
error:function(){
}
});
});
});

$(document).on('click', '.multipleDelete', function(event) {
event.preventDefault();
var _ids = '';
$.each($('input[name="ids[]"]:checked'), function(index, val) {
_ids += $(val).val()+',';
});
if (_ids == '') {
layer.msg('请选择要操作影片ID');
return false;
}
layer.confirm("确定要删除吗？", { title: "确认" }, function (index) {
layer.close(index);
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {ids: _ids,lx: 'shanchu'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('删除成功');
location.reload();
} 
},
error:function(){
}
});

}); 
});
var clipboard = new Clipboard('#copy');
clipboard.on('success', function(e) {
layer.msg('推广链接已经成功复制， 请黏贴推广');
});
clipboard.on('error', function(e) {
layer.msg('复制失败请手动复制');
});
</script>
<style> 
.mark_body {
position: relative;
display: inline-block;
left: 50%;
top: 0px;
width: auto;
min-width: 300px;
-webkit-transform: translate(-50%, 0%);
-moz-transform: translate(-50%, 0%);
-ms-transform: translate(-50%, 0%);
-o-transform: translate(-50%, 0%);
transform: translate(-50%, 0%);
margin-top: 10px;
}
.mark {margin: 10px auto 0;text-align: center;}
.mark input {width: 50px;height: 25px;background-color: #fff;margin: 0 7px 0 7px;border-radius: 5px;text-align: center;color: #098707;}
</style> 
<?php if($yulan=='1'){?>
<script type="text/javascript">
function play(id,lx) {
var url='/play_'+id+'_'+lx+'<?php echo $dshz?>';
layer.open({
type: 2,
title: '视频预览(代理只能预览前<?php echo $shipinsj?>秒视频，验证是否可放！)',
shadeClose: true,
shade: 0.8,
area: ['500px', '390px'],
content:url
}); 
}
</script>
<?php }?>
<script type="text/javascript">
function plfl() {
var _ids = '';
$.each($('input[name="ids[]"]:checked'), function(index, val) {
_ids += $(val).val()+',';
});
if (_ids == '') {
layer.msg('请选择要操作影片ID');
return false;
}
var b = new Base64();  
var str = b.encode(_ids);
var u ='/dlfledit/'+ str+'/';
var w = '20%';
var h = '45%';
var n = '批量更改分类';
layer.open({
type: 2,
title: n,
shadeClose: true,
area: [w, h],
content: u
});
}
function up() {
var _ids = '';
$.each($('input[name="ids[]"]:checked'), function(index, val) {
_ids += $(val).val()+',';
});
if (_ids == '') {
layer.msg('请选择要操作影片ID');
return false;
}
layer.confirm("确定要更新吗？", { title: "确认" }, function (index) {
layer.close(index);
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {id: _ids, lx : 'gengxin'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('更新成功');
location.reload();
} 
},
error:function(){
}
});
});
}
function fenxiang() {
var _ids = '';
$.each($('input[name="ids[]"]:checked'), function(index, val) {
_ids += $(val).val()+',';
});
if (_ids == '') {
layer.msg('请选择要操作影片ID');
return false;
}
layer.confirm("确定要分享吗？", { title: "确认" }, function (index) {
layer.close(index);
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {id: _ids, lx: 'fenxiang'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('分享成功');
location.reload();
}else{
layer.msg(data.msg);
location.reload();
} 
},
error:function(){
}
});
});
}

function zonglian() {
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {lx:'zonglian'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
var link = '';
var name = '';
var contents = "<br>&nbsp;&nbsp;&nbsp;<?php echo $tip?> \r\n 今日推荐视频更新于 <?php echo $day?><br>";
for(i=0;i<data.lists.length;i++){
link = data.lists[i].url;
name = data.lists[i].name;
contents +="&nbsp;&nbsp;&nbsp;&nbsp;" + name + "<br>&nbsp;&nbsp;&nbsp;&nbsp;" + link + "<br>";
}
contents += "<br>&nbsp;&nbsp;&nbsp;<?php echo $tip1?> <br>&nbsp;&nbsp;&nbsp; ++++ <?php echo $tip2?> ++++";
contents += "<br>&nbsp;&nbsp;&nbsp;推广二维码<div class='layui-form-item'><div ><img  src='http://qr.liantu.com/api.php?text=" + link + "'></div></div>";
$("#info").html(contents);
layer.open({
type: 1,
title: '总链生成成功',
skin: 'layui-layer-rim', 
area: ['520px', '540px'], 
content: $("#info").html()
});
} 
},
error:function(){
}
});
}
function jiage() {
var _ids = '';
$.each($('input[name="ids[]"]:checked'), function(index, val) {
_ids += $(val).val()+',';
});
if (_ids == '') {
layer.msg('请选择要操作影片ID');
return false;
}
layer.open({
type: 1,
title: "批量更改价格",
area: '300px',
shade: 0.8,
id: 'LAY_layuipro',
btn: ['确认'],
moveType: 1,
<?php if($sjsz==1){?>
content: '<div class="mark_body"><div class="mark"><div style="margin: 5px 0;">起始金额 :<span><input type="text" value="2"  id="sjmoney" >元 </span><br><br>结束金额:<span><input type="text" value="5"  id="gdmoney"   ></span>元</div><div>(如固定价格则填相同的价格)</div></div></div>',
<?php }else{?>
content: '<div class="mark_body"><div class="mark"><div style="margin: 5px 0;">固定金额 :<span><input type="text" value="2"  id="sjmoney" >元 </span></div></div></div>',
<?php }?>
success: function(layero){
var btn = layero.find('.layui-layer-btn');
btn.css('text-align', 'center');
btn.on("click",function(){
var sjmoney = $("#sjmoney").val();
var gdmoney = $("#gdmoney").val();
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {id: _ids, lx: 'jiagegengxin',sjmoney:sjmoney,gdmoney:gdmoney},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('批量更改价格成功');
location.reload();
}else{
layer.closeAll('loading');
layer.msg(data.msg);
} 
},
error:function(){
}
});
});
},
cancel: function(index, layero){
location.reload();
}
});
}

function yjsk() {
var _ids = '';
$.each($('input[name="ids[]"]:checked'), function(index, val) {
_ids += $(val).val()+',';
});
if (_ids == '') {
layer.msg('请选择要操作影片ID');
return false;
}
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {id: _ids, lx: 'plshikan'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('批量试看成功');
location.reload();
} 
},
error:function(){
}
});
}
function yjgai() {
layer.open({
type: 1,
title: "一键更改价格",
area: '300px',
shade: 0.8,
id: 'LAY_layuipro',
btn: ['确认'],
moveType: 1,
<?php if($sjsz==1){?>
content: '<div class="mark_body"><div class="mark"><div style="margin: 5px 0;">起始金额 :<span><input type="text" value="2"  id="sjmoney" >元 </span><br><br>结束金额:<span><input type="text" value="5"  id="gdmoney"   ></span>元</div><div>(如固定价格则填相同的价格)</div></div></div>',
<?php }else{?>
content: '<div class="mark_body"><div class="mark"><div style="margin: 5px 0;">固定金额 :<span><input type="text" value="2"  id="sjmoney" >元 </span></div></div></div>',
<?php }?>
success: function(layero){
var btn = layero.find('.layui-layer-btn');
btn.css('text-align', 'center');
btn.on("click",function(){
var sjmoney = $("#sjmoney").val();
var gdmoney = $("#gdmoney").val();
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {lx: 'jiagegengxin2',sjmoney:sjmoney,gdmoney:gdmoney},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('一键更改价格成功');
location.reload();
}else{
layer.closeAll('loading');
layer.msg(data.msg);
} 
},
error:function(){
}
});
});
},
cancel: function(index, layero){
location.reload();
}
});
}
function dwz() {
layer.confirm("确定更新短网址吗？", { title: "确认" }, function (index) {
layer.close(index);
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {lx: 'dwz'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('更新成功');
location.reload();
}else{
layer.msg(data.msg);
location.reload();
} 
},
error:function(){
}
});
});
}
function yjsc() {
layer.confirm("确定删除片库吗？", { title: "确认" }, function (index) {
layer.close(index);
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {lx: 'scpk'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('删除成功');
location.reload();
}else{
layer.msg(data.msg);
location.reload();
} 
},
error:function(){
}
});
});
}

</script>
<?php }?>
<script>
function cq(name) {
window.location.href='/shipin<?php echo $dshz?>?name='+name; 
}
<?php if($pic==1){?>
$(function () {
$("body").on('click', '#data-row img', function () {
$("#big-img").attr("src", this.src);
var tWidth = document.body.offsetWidth;
var tHeight = window.screen.availHeight;
var sw = this.width;
var sh = this.height;
var tRate = tWidth * 1.0 / tHeight;
var rate = sw * 1.0 / sh;
var rh;
if (tRate > rate) {
$("#big-img").css("height", (tHeight - 280) + 'px');
$("#big-img").css('width', 'auto');
rh = tHeight - 80;
} else {
$("#big-img").css("width", '80%');
$("#big-img").css('height', '60%');
rh = sh / sw * (tWidth * 0.8);
}
if (rh < tHeight - 100) {
$("#big-img").css('margin-top', (tHeight - rh) / 2 + 'px');
} else {
$("#big-img").css('margin-top', '6px');
}
$("#img-div").show();
});
$("#img-div").click(function () {
$("#img-div").hide();
});
});
<?php }?>
</script>
</body>
</html>