|
|
<extend name="Public/base" />
|
|
|
|
|
|
<block name="body">
|
|
|
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
|
|
|
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
|
|
|
<php>if(C('COLOR_STYLE')=='blue_color') echo '
|
|
|
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
|
|
|
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
|
|
|
<style>
|
|
|
.tabcon1711 td:first-child {
|
|
|
width: auto;
|
|
|
|
|
|
}
|
|
|
</style>
|
|
|
|
|
|
<div class="cf main-place top_nav_list navtab_list">
|
|
|
<h3 class="page_title">新增推广员</h3>
|
|
|
<p class="description_text">说明:此功是创建推广员时所需填写信息</p>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 标签页导航 -->
|
|
|
<div class="tab-wrap" style="display: flex;">
|
|
|
|
|
|
<div class="tab-content tabcon1711" style="min-width:50%;">
|
|
|
<!-- 基础文档模型 -->
|
|
|
<div id="tab1" class="tab-pane in tab1">
|
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>校验时间:</td>
|
|
|
<td class="r">
|
|
|
<div class="input-list" style="margin-left: 0;">
|
|
|
<input type="text" readonly id="time_start" name="time_start" class=""
|
|
|
value="{:I('time_start')}" placeholder="开始时间" />
|
|
|
-
|
|
|
<div class="input-append date" id="datetimepicker" style="display:inline-block">
|
|
|
<input type="text" readonly id="time_end" name="time_end" class=""
|
|
|
value="{:I('time_end')}" placeholder="结束时间" />
|
|
|
<span class="add-on"><i class="icon-th"></i></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<span class="notice-text" style="margin-left: 0;">请选择不超过31天的时间</span>
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>支付渠道:</td>
|
|
|
<td class="r">
|
|
|
<select name="pay_way" id="pay_way">
|
|
|
<option value="-1">请选择支付渠道</option>
|
|
|
<option value="1">支付宝</option>
|
|
|
<option value="2">微信</option>
|
|
|
<option value="3">易宝</option>
|
|
|
</select>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>Excel文件上传:</td>
|
|
|
<td class="r">
|
|
|
<div class="input-list" style="margin-left: 0;">
|
|
|
<input type="file" id="fileinput" name="file">
|
|
|
</div>
|
|
|
<span class="notice-text" style="margin-left: 0;">暂只支持.xls .xlsx 格式文件</span>
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
<div class="form-item cf">
|
|
|
<button class="submit_btn" id="submit_btn">
|
|
|
保存
|
|
|
</button>
|
|
|
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">
|
|
|
返回
|
|
|
</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
4654654646
|
|
|
</div>
|
|
|
</div>
|
|
|
<div style="width: 100vw;height: 100vh;padding: 0;position: absolute;top: 0;z-index: 9999;display: none;" id="creat_msg">
|
|
|
<div class="layui-layer layui-layer-dialog layui-layer-border layui-layer-msg layui-layer-hui"
|
|
|
type="dialog" times="1" showtime="50000" contype="string" style="z-index: 19891015; top:30%; left: 45%;">
|
|
|
<div class="layui-layer-content" style="padding: 15px 0 5px;font-size: 20px;font-weight: 600;">执行进度</div>
|
|
|
<div id="tip_msg" class="layui-layer-content">开始时间与结束时间都不允许为空</div>
|
|
|
<div class="layui-layer-content" style="padding: 5px 10px 15px;font-size: 10px;color: #BBB;">TIP:未执行完成之前请勿刷新或关闭此页面</div>
|
|
|
<span class="layui-layer-setwin"></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
</block>
|
|
|
|
|
|
<block name="script">
|
|
|
<script type="text/javascript" src="__STATIC__/xlsx.core.min.js" charset="UTF-8"></script>
|
|
|
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
|
|
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
|
|
|
charset="UTF-8"></script>
|
|
|
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
|
|
|
<script type="text/javascript">
|
|
|
//导航高亮
|
|
|
highlight_subnav("{:U('Promote/lists')}");
|
|
|
var MSG={
|
|
|
showmsg:function(str){
|
|
|
$("#creat_msg").show();
|
|
|
$("#tip_msg").html(str);
|
|
|
},
|
|
|
hidemsg:function(){
|
|
|
$("#creat_msg").hide();
|
|
|
$("#tip_msg").html('');
|
|
|
}
|
|
|
}
|
|
|
var COMPARE={
|
|
|
publiucAjax:function(url,senddata,callback){
|
|
|
$.ajax({
|
|
|
type: 'post',
|
|
|
url: url,
|
|
|
data:senddata,
|
|
|
success: function(data) {
|
|
|
if(data.success){
|
|
|
callback(data.data);
|
|
|
}else{
|
|
|
MSG.hidemsg();
|
|
|
layer.alert(data.error);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
//创建面单
|
|
|
creatCompare:function(senddata,callback){
|
|
|
COMPARE.publiucAjax("{:U('creatCompare')}",senddata,function(data){
|
|
|
sendDefaultData.compare_id = data.id;
|
|
|
MSG.showmsg("初始化完成,开始比较数据 [0/"+sendDefaultData.filedata_count+"] ......");
|
|
|
callback();
|
|
|
});
|
|
|
},
|
|
|
//循环比较
|
|
|
loopCheck:function(page,callback){
|
|
|
if(page > sendDefaultData.check_page){
|
|
|
callback();
|
|
|
return;
|
|
|
}
|
|
|
var senddata = {
|
|
|
keys:sendDefaultData.keys,
|
|
|
compare_id:sendDefaultData.compare_id,
|
|
|
pay_way:sendDefaultData.pay_way,
|
|
|
checkarr:sendDefaultData.filedata.splice(0,check_size)
|
|
|
}
|
|
|
COMPARE.publiucAjax("{:U('compareData')}",senddata,function(data){
|
|
|
var checkok = page*check_size > sendDefaultData.filedata_count ? sendDefaultData.filedata_count : page*check_size;
|
|
|
MSG.showmsg("比较数据 ["+checkok+"/"+sendDefaultData.filedata_count+"] ......");
|
|
|
page++;
|
|
|
COMPARE.loopCheck(page,callback)
|
|
|
});
|
|
|
},
|
|
|
//生成游戏订单平台缺失订单
|
|
|
checkSpendData:function(callback){
|
|
|
var senddata = {
|
|
|
compare_id:sendDefaultData.compare_id,
|
|
|
pay_way:sendDefaultData.pay_way,
|
|
|
begin_time:sendDefaultData.begin_time,
|
|
|
end_time:sendDefaultData.end_time,
|
|
|
}
|
|
|
COMPARE.publiucAjax("{:U('checkSpendData')}",senddata,function(data){
|
|
|
MSG.showmsg("生成平台 游戏流水比对订单......");
|
|
|
console.log(data)
|
|
|
callback();
|
|
|
});
|
|
|
},
|
|
|
//生成游戏订单平台缺失订单
|
|
|
checkDepositData:function(callback){
|
|
|
var senddata = {
|
|
|
compare_id:sendDefaultData.compare_id,
|
|
|
pay_way:sendDefaultData.pay_way,
|
|
|
begin_time:sendDefaultData.begin_time,
|
|
|
end_time:sendDefaultData.end_time,
|
|
|
}
|
|
|
COMPARE.publiucAjax("{:U('checkDepositData')}",senddata,function(data){
|
|
|
MSG.showmsg("生成平台 平台币比对订单......");
|
|
|
console.log(data)
|
|
|
callback();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
}
|
|
|
</script>
|
|
|
<script type="text/javascript">
|
|
|
var isfile = false;
|
|
|
var rABS = false; //是否将文件读取为二进制字符串
|
|
|
var check_size = "{$page_size}";//每次验证的数量
|
|
|
|
|
|
var sendDefaultData = {
|
|
|
"keys": [],
|
|
|
"filedata_count": 0,
|
|
|
"compare_id": 0,
|
|
|
"check_page":0,
|
|
|
"filedata":[],
|
|
|
"pay_way":-1,
|
|
|
"begin_time":0,
|
|
|
"end_time":0
|
|
|
}
|
|
|
|
|
|
$(function () {
|
|
|
|
|
|
|
|
|
$("#submit_btn").on("click", function () {
|
|
|
var start = $("#time_start").val();
|
|
|
var end = $("#time_end").val();
|
|
|
var sdate = Date.parse(start) / 1000;
|
|
|
var edate = Date.parse(end) / 1000;
|
|
|
if (start == '' || end == '') {
|
|
|
layer.msg('开始时间与结束时间都不允许为空');
|
|
|
return false;
|
|
|
}
|
|
|
if (sdate > edate) {
|
|
|
layer.msg('开始时间必须小于等于结束时间');
|
|
|
return false;
|
|
|
}
|
|
|
if ((edate - sdate) > 2592000) {
|
|
|
layer.msg('时间间隔不能超过31天,请重新选择日期');
|
|
|
return false;
|
|
|
}
|
|
|
//获取渠道
|
|
|
var paychannel = $("#pay_way option:selected").val();
|
|
|
if (paychannel == -1) {
|
|
|
layer.msg('请选择支付渠道');
|
|
|
return false;
|
|
|
}
|
|
|
//获取文件
|
|
|
if (!isfile) {
|
|
|
layer.msg('excel文件不能为空');
|
|
|
return false;
|
|
|
}
|
|
|
//执行
|
|
|
readFileInput(function () {
|
|
|
if(sendDefaultData.filedata_count == 0){
|
|
|
MSG.hidemsg();
|
|
|
layer.msg('excel内容不能为空');
|
|
|
return false;
|
|
|
}
|
|
|
//获取需要循环的次数
|
|
|
sendDefaultData.check_page = Math.ceil(sendDefaultData.filedata_count/check_size);
|
|
|
sendDefaultData.pay_way = paychannel;
|
|
|
sendDefaultData.begin_time = start;
|
|
|
sendDefaultData.end_time = end;
|
|
|
//创建面单
|
|
|
var senddata = {
|
|
|
begin_time:start,
|
|
|
end_time:end,
|
|
|
pay_way:paychannel,
|
|
|
check_count:sendDefaultData.filedata_count
|
|
|
}
|
|
|
COMPARE.creatCompare(senddata,function(){
|
|
|
COMPARE.loopCheck(1,function(){
|
|
|
COMPARE.checkSpendData(function(){
|
|
|
COMPARE.checkDepositData(function(){
|
|
|
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
|
|
|
})
|
|
|
})
|
|
|
|
|
|
|
|
|
$("#fileinput").change(function () {
|
|
|
var p = $(this).val();
|
|
|
var ext = p.substr(p.lastIndexOf(".")).toLowerCase();
|
|
|
if (ext != ".xls" && ext != ".xlsx") {
|
|
|
layer.msg("文件仅支持excel文件格式");
|
|
|
$(this).val('');
|
|
|
p = '';
|
|
|
}
|
|
|
|
|
|
if (p != '') {
|
|
|
isfile = true;
|
|
|
} else {
|
|
|
isfile = false;
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
function readFileInput(callback) {
|
|
|
MSG.showmsg("读取excle中。。。");
|
|
|
var wb;//读取完成的数据
|
|
|
var f = $("#fileinput")[0].files[0];
|
|
|
var reader = new FileReader();
|
|
|
if (rABS) {
|
|
|
reader.readAsArrayBuffer(f);
|
|
|
} else {
|
|
|
reader.readAsBinaryString(f);
|
|
|
}
|
|
|
reader.onload = function (e) {
|
|
|
MSG.showmsg("文件读取完成,比较命令初始化。。。");
|
|
|
var data = e.target.result;
|
|
|
if (rABS) {
|
|
|
wb = XLSX.read(btoa(fixdata(data)), {
|
|
|
type: 'base64'
|
|
|
});
|
|
|
} else {
|
|
|
wb = XLSX.read(data, {
|
|
|
type: 'binary'
|
|
|
});
|
|
|
}
|
|
|
try {
|
|
|
sendDefaultData.keys.push(wb.Sheets[wb.SheetNames[0]]["A1"]["v"]);
|
|
|
sendDefaultData.keys.push(wb.Sheets[wb.SheetNames[0]]["B1"]["v"]);
|
|
|
sendDefaultData.filedata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
|
|
|
sendDefaultData.filedata_count = sendDefaultData.filedata.length;
|
|
|
callback();
|
|
|
} catch (error) {
|
|
|
MSG.hidemsg();
|
|
|
isfile = false;
|
|
|
layer.msg('excel内容不符或不能为空');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
// document.getElementById("demo").innerHTML= JSON.stringify( XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]) );
|
|
|
};
|
|
|
}
|
|
|
|
|
|
|
|
|
function fixdata(data) { //文件流转BinaryString
|
|
|
var o = "",
|
|
|
l = 0,
|
|
|
w = 10240;
|
|
|
for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w)));
|
|
|
o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w)));
|
|
|
return o;
|
|
|
}
|
|
|
|
|
|
$('#time_start').datetimepicker({
|
|
|
format: 'yyyy-mm-dd',
|
|
|
language: "zh-CN",
|
|
|
minView: 2,
|
|
|
autoclose: true
|
|
|
});
|
|
|
|
|
|
$('#datetimepicker').datetimepicker({
|
|
|
format: 'yyyy-mm-dd',
|
|
|
language: "zh-CN",
|
|
|
minView: 2,
|
|
|
autoclose: true,
|
|
|
pickerPosition: 'bottom-left'
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
</block> |