<?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;}
?>
<!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/jquery1.9.min.js"></script>
</head>
<body>
<div class="x-body">
<blockquote class="layui-elem-quote">
<dl class="apps-filter-tr">
<dt><span  class="xb">单一视频推广</span></dt>
</dl>
<span class="x-right" style="margin-top:-24px;line-height:10px"> <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>
<fieldset class="layui-elem-field"><legend>添加视频链接说明</legend>
<div class="layui-field-box">单条链接添加 直接添加即可 不要有空白行或换行</div>
<div class="layui-field-box">批量，多条之间通过换行隔开,最多设置100条链接</div>
</fieldset>
<div class="layui-form-item">
<textarea id='video' placeholder="请输入视频链接,支持mp4,m3u8" style="height:270px;resize:none" class="layui-textarea"></textarea>
</div>
<a  class="layui-btn"  style="width:100%;">生成</a>
<fieldset class="layui-elem-field layui-field-title"><legend>推广链接</legend></fieldset>
<div class="layui-form-item">
<textarea id="link"  style="height:270px;resize:none" class="layui-textarea" placeholder="生成的连接都会在这显示" ></textarea>
</div>

</div>
</div>
<script type="text/javascript">
$('.layui-btn').on('click', function () {
var video = $("#video").val();
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/post<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {video:video,lx:'api'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('生成成功');
var Text = '';
for(i=0;i<data.lists.length;i++){
Text += data.lists[i].url + "\r";
}
$("#link").val(Text);
}else{
layer.closeAll('loading');
layer.msg(data.msg);
} 
},
error:function(){
}
});

})
</script>
</div>
<script src="/layui/layui.js"></script>
<script>
layui.use(['form', 'layedit', 'laydate', 'element', 'jquery', 'layer'], function(){
var form = layui.form
,layer   = layui.layer
,layedit = layui.layedit
,element = layui.element
,$= layui.jquery
,laydate = layui.laydate;
});
</script>
</body>
</html>