Commit a66c3112 authored by rlgy's avatar rlgy

update

parent b300fa5d
<?php
namespace backend\assets;
use yii\web\AssetBundle;
/**
* Class FileInputAsset
* @package backend\assets
*/
class FileInputAsset extends AssetBundle
{
public $sourcePath = '@common/metronic';
public $css = [
'global/plugins/bootstrap-fileinput/bootstrap-fileinput.css',
];
public $js = [];
public $depends = [
'backend\assets\CoreAsset',
];
}
<?php
namespace backend\assets;
use yii\web\AssetBundle;
/**
* Class Select2Asset
* @package backend\assets
*/
class Select2Asset extends AssetBundle
{
public $sourcePath = '@common/metronic';
public $css = [
'global/plugins/select2/css/select2.min.css',
'global/plugins/select2/css/select2-bootstrap.min.css',
];
public $js = [
'global/plugins/select2/js/select2.full.min.js',
'pages/scripts/components-select2.min.js',
];
public $depends = [
//'backend\assets\CoreAsset',
];
}
...@@ -12,14 +12,11 @@ class TableAsset extends AssetBundle ...@@ -12,14 +12,11 @@ class TableAsset extends AssetBundle
public $sourcePath = '@common/metronic'; public $sourcePath = '@common/metronic';
public $css = [ public $css = [
//'global/plugins/bootstrap-table/bootstrap-table.min.css',
//'global/plugins/bootstrap-table/bootstrap-table-fixed-columns.css',
]; ];
public $js = [ public $js = [
'global/plugins/bootstrap-table/bootstrap-table.min.js', 'global/plugins/bootstrap-table/bootstrap-table.min.js',
//'global/plugins/bootstrap-table/bootstrap-table-fixed-columns.js', // 'global/plugins/bootstrap-table/bootstrap-table-fixed-columns.js',
'../../js/bootstrap-table-zh-CN.js'
]; ];
public $depends = [ public $depends = [
...@@ -27,6 +24,6 @@ class TableAsset extends AssetBundle ...@@ -27,6 +24,6 @@ class TableAsset extends AssetBundle
]; ];
public $jsOptions = [ public $jsOptions = [
'position' => \yii\web\View::POS_HEAD, 'position' => \yii\web\View::POS_END,
]; ];
} }
<?php
/**
* Created By Sublime Text 3
*
* @date 2018-09-07 17:31:23
* @author rlgy <rlgyzhcn@qq.com>
*/
namespace backend\assets;
use yii\web\AssetBundle;
use yii\web\View;
class TableZhAsset extends AssetBundle
{
public $sourcePath = '@backend/web/js';
public $js = [
'bootstrap-table-zh-CN.js',
];
public $jsOptions = [
'position' => View::POS_END,
];
}
<?php
/**
* Created By Sublime Text 3
*
* @date 2018-09-07 17:31:23
* @authors rlgy <rlgyzhcn@qq.com>
*/
namespace backend\assets\app;
use yii\web\AssetBundle;
use yii\web\View;
class IndexAsset extends AssetBundle
{
public $sourcePath = '@backend/web/js/app';
public $js = [
'index.js',
];
public $jsOptions = [
'position' => View::POS_END,
];
}
<?php
/**
* Created By Sublime Text 3
*
* @authors rlgy <rlgyzhcn@qq.com>
* @date 2018-09-07 17:41:04
*/
namespace backend\assets\coin;
use yii\web\AssetBundle;
use yii\web\View;
class IndexAsset extends AssetBundle
{
public $sourcePath = '@backend/web/js/coin';
public $js = [
'index.js',
];
public $jsOptions = [
'position' => View::POS_END,
];
}
\ No newline at end of file
<?php
/**
* Created By Sublime Text 3
*
* @date 2018-09-07 17:31:23
* @authors rlgy <rlgyzhcn@qq.com>
*/
namespace backend\assets\investment;
use yii\web\AssetBundle;
use yii\web\View;
class IndexAsset extends AssetBundle
{
public $sourcePath = '@backend/web/js/investment';
public $js = [
'index.js',
];
public $jsOptions = [
'position' => View::POS_END,
];
}
<?php
/**
* Created By Sublime Text 3
*
* @date 2018-09-07 17:31:23
* @authors rlgy <rlgyzhcn@qq.com>
*/
namespace backend\assets\investmentType;
use yii\web\AssetBundle;
use yii\web\View;
class IndexAsset extends AssetBundle
{
public $sourcePath = '@backend/web/js/investment-type';
public $js = [
'index.js',
];
public $jsOptions = [
'position' => View::POS_END,
];
}
<?php
/**
* Created By Sublime Text 3
*
* @date 2018-09-07 17:31:23
* @authors rlgy <rlgyzhcn@qq.com>
*/
namespace backend\assets\site;
use yii\web\AssetBundle;
use yii\web\View;
class IndexAsset extends AssetBundle
{
public $sourcePath = '@backend/web/js/site';
public $js = [
'index.js',
];
public $depends = [
'backend\assets\TableAsset',
'backend\assets\TableZhAsset',
];
public $jsOptions = [
'position' => View::POS_END,
];
}
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
*/ */
use yii\helpers\Html; use yii\helpers\Html;
use backend\assets\app\IndexAsset;
$this->registerJsFile('@web/js/app/index.js'); IndexAsset::register($this);
?> ?>
<div class="layui-row"> <div class="layui-row">
......
...@@ -5,7 +5,11 @@ ...@@ -5,7 +5,11 @@
* Date: 18-5-31 * Date: 18-5-31
* Time: 上午9:59 * Time: 上午9:59
*/ */
$this->registerJsFile('@web/js/coin/index.js');
use backend\assets\coin\IndexAsset;
IndexAsset::register($this);
?> ?>
<style> <style>
.layui-table-tips-c { .layui-table-tips-c {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
*/ */
use common\models\pwallet\InvestmentType; use common\models\pwallet\InvestmentType;
use backend\assets\investment\IndexAsset;
$_csrf = Yii::$app->request->getCsrfToken(); $_csrf = Yii::$app->request->getCsrfToken();
$js = <<<EOF $js = <<<EOF
...@@ -16,9 +17,8 @@ EOF; ...@@ -16,9 +17,8 @@ EOF;
* @var $this \yii\web\View * @var $this \yii\web\View
*/ */
$this->registerJs($js, \yii\web\View::POS_BEGIN); $this->registerJs($js, \yii\web\View::POS_BEGIN);
$this->registerJsFile('@web/js/investment/index.js');
IndexAsset::register($this);
$type = InvestmentType::getList(1, 999, []); $type = InvestmentType::getList(1, 999, []);
?> ?>
<h4>空投管理</h4> <h4>空投管理</h4>
......
...@@ -6,10 +6,11 @@ ...@@ -6,10 +6,11 @@
* Time: 下午2:46 * Time: 下午2:46
*/ */
use backend\assets\investmentType\IndexAsset;
/** /**
* @var \yii\web\View $this * @var \yii\web\View $this
*/ */
$this->registerJsFile('@web/js/investment-type/index.js'); IndexAsset::register($this);
?> ?>
<h4>空投类型管理</h4> <h4>空投类型管理</h4>
<div class="layui-row"> <div class="layui-row">
......
<?php <?php
\backend\assets\TableAsset::register($this);
use backend\assets\site\IndexAsset;
$jsAsset = $this->getAssetManager()->getBundle(\backend\assets\AppAsset::className())->baseUrl; $jsAsset = $this->getAssetManager()->getBundle(\backend\assets\AppAsset::className())->baseUrl;
$this->registerJsFile($jsAsset.'/global/plugins/echarts/echarts-all.js'); $this->registerJsFile($jsAsset.'/global/plugins/echarts/echarts-all.js');
$this->registerJsFile('@web/js/site/index.js?201801'); IndexAsset::register($this);
?> ?>
<div style="max-width: 1440px"> <div style="max-width: 1440px">
<h3><b>一、基本数据:</b></h3> <h3><b>一、基本数据:</b></h3>
......
html,
body {
height: 100%;
}
.layui-form-label {
width: 95px;
}
html,
body {
height: 100%;
}
.wrap {
min-height: 100%;
height: auto;
margin: 0 auto -60px;
padding: 0 0 60px;
}
.wrap > .container {
padding: 70px 15px 20px;
}
.footer {
height: 60px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
padding-top: 20px;
}
.jumbotron {
text-align: center;
background-color: transparent;
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
}
.not-set {
color: #c55;
font-style: italic;
}
/* add sorting icons to gridview sort links */
a.asc:after, a.desc:after {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: normal;
line-height: 1;
padding-left: 5px;
}
a.asc:after {
content: /*"\e113"*/ "\e151";
}
a.desc:after {
content: /*"\e114"*/ "\e152";
}
.sort-numerical a.asc:after {
content: "\e153";
}
.sort-numerical a.desc:after {
content: "\e154";
}
.sort-ordinal a.asc:after {
content: "\e155";
}
.sort-ordinal a.desc:after {
content: "\e156";
}
.grid-view td {
white-space: nowrap;
}
.grid-view .filters input,
.grid-view .filters select {
min-width: 50px;
}
.hint-block {
display: block;
margin-top: 5px;
color: #999;
}
.error-summary {
color: #a94442;
background: #fdf7f7;
border-left: 3px solid #eed3d7;
padding: 10px 20px;
margin: 0 0 15px 0;
}
/* align the logout "link" (button in form) of the navbar */
.nav li > form > button.logout {
padding: 15px;
border: none;
}
@media(max-width:767px) {
.nav li > form > button.logout {
display:block;
text-align: left;
width: 100%;
padding: 10px 15px;
}
}
.nav > li > form > button.logout:focus,
.nav > li > form > button.logout:hover {
text-decoration: none;
}
.nav > li > form > button.logout:focus {
outline: none;
}
/**
* 资产管理:手工入账
* libingke
* 2018/01/11
*/
/**
* 表单
* @type {{start: null, end: null, way: null, opuid: null, user: null}}
*/
var form1 = {
start:null,
end:null,
way:null,//支付渠道
opuid:null,//操作员编号
user:null
};
/**
* 表单
* @type {{start: null, end: null, way: null, opuid: null, checkuid: null, user: null}}
*/
var form2 = {
start:null,
end:null,
way:null,//支付渠道
opuid:null,//操作员编号
checkuid:null,//复核管理员
user:null
};
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#date_range',
range: ':',
done: function(value, date, endDate){
$('#date_range').val(value);
query(1);
}
});
laydate.render({
elem: '#date_range2',
range: ':',
done: function(value, date, endDate){
$('#date_range2').val(value);
query(2,1);
}
});
});
$(function () {
$('#uid1').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
$('#uid2').bind('keypress', function(event) {
if(event.keyCode == "13")
query(2,1);
});
$(".select1").bind("change",function(){ query(1); });
$(".select2").bind("change",function(){ query(2,1); });
/**
* 初始化表格
*/
$("#table1").bootstrapTable({
method: 'post',
url: url_table1,
queryParams: function (params) {
form1.way=$('form#form1 select[name="way"]').val();
form1.opuid=$('form#form1 select[name="opuid"]').val();
form1.user=$('form#form1 input[name="user"]').val();
if ($("#date_range").val()==='') {
form1.start=null;
form1.end=null;
} else {
var value=$("#date_range").val();
var t=value.split(' : ', 2);
form1.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
form1.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
form1.page = params.pageNumber;
form1.size = params.pageSize;
return form1;
},
pageSize: 12,
uniqueId: 'id',
/* 接口返回结果适配 */
responseHandler: function (res) {
if (res.code == 200) {
return {
"rows": res.data.rows,
"total": res.data.count
};
} else {
layer.msg('[' + res.code + ']' + res.message);
return false;
}
},
columns:[
[
{field: 'id', title: '流水编号', valign: "middle", align: "center"},
{field: 'uid', title: 'UID', valign: "middle", align: "center"},
{field: 'name', title: '姓名', valign: "middle", align: "center"},
{field: 'type', title: '类型', valign: "middle", align: "center"},
{field: 'way', title: '渠道', valign: "middle", align: "center"},
{field: 'amount', title: '金额', valign: "middle", align: "center"},
{field: 'addtime', title: '操作时间', valign: "middle", align: "center"},
{field: 'dealtime', title: '处理时间', valign: "middle", align: "center"},
{field: 'opuid', title: '操作员', valign: "middle", align: "center"},
{
field: 'status', title: '状态', valign: "middle", align: "center",
formatter: statusFormatter
},
{
title: '操作', valign:"middle", align:"center",
formatter: function(value, row, index) {
if (6 == row.status) {
return [
'<a href="javascript:void(0)" onclick="cashOpt('+row.id+', url_fh, this)">复核</a>',
'&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="cashOpt('+row.id+', url_cx, this)">撤销</a>'
].join('');
} else {
return '-';
}
}
}
]
]
});
$("#table2").bootstrapTable({
method: 'post',
url: url_table2,
queryParams: function (params) {
form2.way=$('form#form2 select[name="way"]').val();
form2.opuid=$('form#form2 select[name="opuid"]').val();
form2.checkuid=$('form#form2 select[name="checkuid"]').val();
form2.user=$('form#form2 input[name="user"]').val();
if ($("#date_range2").val()==='') {
form1.start=null;
form1.end=null;
} else {
var value=$("#date_range2").val();
var t=value.split(' : ', 2);
form2.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
form2.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
form2.page = params.pageNumber;
form2.size = params.pageSize;
return form2;
},
pageSize: 12,
uniqueId: 'id',
/* 接口返回结果适配 */
responseHandler: function (res) {
if (res.code == 200) {
if (res.data.record) {
str = '';
$.each(res.data.record, function(index, value, array) {
if (value > 0)
str+='<span style="color: #ba322b">['+index+']</span><b>'+value+'</b>, ';
});
$('#tip2').html(str);
}
return {
"rows": res.data.rows,
"total": res.data.count
};
} else {
layer.msg('[' + res.code + ']' + res.message);
return false;
}
},
columns: [
[
{field: 'id', title: '流水编号', valign: "middle", align: "center"},
{field: 'uid', title: 'UID', valign: "middle", align: "center"},
{field: 'name', title: '姓名', valign: "middle", align: "center"},
{field: 'type', title: '类型', valign: "middle", align: "center"},
{field: 'way', title: '渠道', valign: "middle", align: "center"},
{field: 'amount', title: '金额', valign: "middle", align: "center"},
{field: 'addtime', title: '操作时间', valign: "middle", align: "center"},
{field: 'dealtime', title: '处理时间', valign: "middle", align: "center"},
{field: 'opuid', title: '操作员', valign: "middle", align: "center"},
{field: 'checkuid', title: '初审员', valign: "middle", align: "center"},
{field: 'statusMark', title: '状态', valign: "middle", align: "center"}
]
]
});
});
var statusFormatter=function(status) {
switch (status)
{
case '0':s='待处理';break;
case '1':s='已完成';break;
case '2':s='处理中';break;
case '3':s='已取消';break;
case '4':s='失败[1]';break;
case '5':s='失败[2]';break;
case '6':s='待复核';break;
case '7':s='待出账';break;
case '8':s='待确认[区块链]';break;
default: s=status;
}
return s;
};
var cashOpt=function(rid, url, c) {
var $btn = $(c).button('loading');
$.ajax({
url: url,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {rid:rid},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
query(1);
query(2);
} else {
msg_no_200(res.message);
}
},
error: server_error
});
$btn.button('reset');
return false;
};
var cashIn=function() {
if (!$('form#form-cash [name="user"]').val() ||
!$('form#form-cash [name="name"]').val() ||
!$('form#form-cash [name="amount"]').val()) {
layer.msg('请填写完整入金信息!', {anim: 1});
return false;
}
var confirm=layer.confirm('确认入金 ?', {
title: '提示',
skin: 'layui-layer-myGreen',
btn: ['确认','取消'],
offset: ['50px']
}, function(){
$.ajax({
url: url_hand_in,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: $('form#form-cash').serialize(),
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
query(1);
} else {
msg_no_200(res.message);
}
},
error: server_error
});
layer.close(confirm);
});
return false;
};
var getCashLastRecord=function(that) {
var t=$(that).val();
if (!isNaN(t) !== true) {
console.log(t);
} else {
$.ajax({
url: url_last_record,
type: "POST",
headers: {"Authorization": 'Bearer ' + request_token},
data: {user: t},
success: function(data) {
var str='';
if (data.code == 200 && data.data) {
console.log(data.data);
str = ("undefined" == typeof(data.data.addtime) ? '' : ('申请时间:' + data.data.addtime)) +
("undefined" == typeof(data.data.amount) ? '' : (',&nbsp;&nbsp;金额:' + data.data.amount)) +
("undefined" == typeof(data.data.opuid) ? '' : (',&nbsp;&nbsp;操作员:' + data.data.opuid));
} else {
str= data.message;
}
$('#add-cash-recode').html(str);
},
error: server_error
});
$.ajax({
url: url_tail_num,
type: "POST",
headers: {"Authorization": 'Bearer ' + request_token},
data: {user: t},
success: function(data) {
var str='';
if (data.code == 200 && data.data) {
console.log(data.data);
str = ("undefined" == typeof(data.data.name) ? '' : (' | 姓名:' + data.data.name)) +
("undefined" == typeof(data.data.last) ? '' : (',&nbsp;&nbsp;尾号:' + data.data.last));
} else {
str= data.message;
}
$('#add-cash-tail').html(str);
},
error: server_error
});
}
return false;
};
\ No newline at end of file
/**
* 资产管理:提款查询
* libingke
* 2018/01/11
*/
/**
* 表单
* @type {{start: null, end: null, way: null, statu: null, user: null}}
*/
var form1 = {
start:null,
end:null,
way:null,
statu:null,
user:null
};
var laydate = layui.laydate;
layui.use('laydate', function(){
laydate.render({
elem: '#date_range',
range: ':',
done: function(value, date, endDate){
$('#date_range').val(value);
query(1);
}
});
});
var plugInit = false;
var t1 = '';
var t2 = '';
var openDatePlug=function() {
if (plugInit == false) {
var d=new Date();
var today=d.getFullYear()+'-'+(d.getMonth()+1)+'-'+d.getDate();
laydate.render({elem: '#t1',show: true, min: today,
done: function(value, date, endDate){t1 = value;}});
laydate.render({elem: '#t2',type: 'time',
done: function(value, date, endDate){t2 = value;}});
plugInit = true;
}
};
var set_export_plan=function() {
plugInit = false;
layer.open({
type: 1,
title: '设置导出计划',
id: 'set-export-plan',
area : ['310px', '220px'],
skin: 'layui-layer-myBlue',
zIndex: 100,
content: '<br><div class="layui-inline">\n' +
' <label class="layui-form-label">日期</label>\n' +
' <div class="layui-input-inline">\n' +
' <input type="text" class="layui-input" onclick="openDatePlug()" id="t1" placeholder="选择日期">\n' +
' </div>\n' +
' </div>' +
' <div class="layui-inline">\n' +
' <label class="layui-form-label">时间</label>\n' +
' <div class="layui-input-inline">\n' +
' <input type="text" class="layui-input" id="t2" placeholder="选择时间">\n' +
' </div>\n' +
' </div>\n',
btn: ['设定导出计划', '取消'],
btnAlign: 'c',
btn1: function() {
if (t1 == '' || t2 == '') {
layer.msg('请先设置日期和时间', {time:800});
} else {
var mytime=Math.round(new Date(t1+' '+t2).getTime()/1000);
$.ajax({
url: url_setPlan,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {mytime:mytime},
dataType: 'json',
success: function (data) {
if (data.code == 200) {
msg_200(data.message);
layer.closeAll();
} else {
msg_no_200(data.message);
}
},
error: server_error
});
}
}
});
};
var get_export_plan=function() {
$.ajax({
url: url_getPlan,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
dataType: 'json',
success: function (data) {
if (data.code == 200) {
var plan_list = '',c = 0;
plan_list += '<table class="layui-table">';
$.each(data.data, function(k,v){
c++;
plan_list += '<tr id="tr-'+ k +'"><td>导出时间</td><td> ' + v + '</td>';
plan_list += '<td><a href="###" onclick="delete_export_plan(\''+ k +'\')">删除</a></td></tr>';
});
plan_list += '</table>';
if (c==0) plan_list = "<p align='center'>暂无导出计划</p>";
layer.open({
type: 1,
title: '计划表',
id: 'get-plan-table',
area : ['340px', 'auto'],
skin: 'layui-layer-lan',
content: '<div style="padding: 5px 10px;">' + plan_list + '</div>',
btn: '关闭',
btnAlign: 'c'
});
} else {
msg_no_200(data.message);
}
},
error: server_error
});
};
var delete_export_plan=function(a) {
$.ajax({
url: url_delPlan,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
dataType: 'json',
data: {tid:a},
success: function (data) {
if (data.code == 200) {
layer.msg(data.message, {time: 800});
$("#tr-"+a).remove();
} else {
msg_no_200(data.message);
}
},
error: server_error
});
};
var show_plan=function() {
$.ajax({
url: url_showPlan,
headers: {"Authorization": 'Bearer ' + request_token},
dataType: 'json',
success: function (data) {
if (data.code == 200) {
var show_list = '';
show_list += '<table class="layui-table">';
$.each(data.data, function(k,v){
show_list += '<tr id="tr-show-'+ k +'"><td> ' + v.name + '</td><td><a target="_self" href="'+ v.downurl +'">下载</a></td></tr>';
});
show_list += '</table>';
layer.open({
type: 1,
title: '已导出数据',
id: 'show-plan',
skin: 'layui-layer-myBlue',
content: '<div style="padding: 5px 10px;">' + show_list + '</div>',
btn: '关闭',
btnAlign: 'c'
});
} else {
msg_no_200(data.message);
}
},
error: server_error
});
};
$(function () {
/**
* 回车触发 uid
*/
$('#uid').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
$(".select1").bind("change",function(){ query(1); });
/**
* 表格
*/
$("#table1").bootstrapTable({
method: 'post',
url: url_table1,
queryParams: function (params) {
var user=$('form#form1 input[name="uid"]').val();
if (user) {
$.ajax({
url: url_params,
type: 'get',
async: false,
data: {uid:$('form#form1 input[name="uid"]').val()},
dataType: 'json',
success: function (res) {
if (res.uid && res.uid!='-1') {
user=res.uid;
}
console.log(res);
}
});
}
form1.statu=$('form#form1 select[name="statu"]').val();
form1.user=user;
if ($("#date_range").val()==='') {
form1.start=null;
form1.end=null;
} else {
var value=$("#date_range").val();
var t=value.split(' : ', 2);
form1.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
form1.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
form1.page = params.pageNumber;
form1.size = params.pageSize;
return form1;
},
pageSize: 20,
uniqueId: 'id',
responseHandler: function (res) {
if (res.code == 200) {
if (res.data.usdt && res.data.cny) {
var str = '小计: <b style="color: #e64544">'+res.data.usdt+
'</b> USDT ≈ <b style="color: #e64544">'+res.data.cny+'</b> CNY';
$('#tip1').html(str);
}
return {
"rows": res.data.rows,
"total": res.data.count
};
} else {
layer.msg('[' + res.code + ']' + res.message);
return false;
}
},
columns:[
{field: 'id', title: '流水编号', valign:"middle", align:"right"},
{field: 'uid', title: 'UID', valign:"middle", align:"right"},
{field: 'name', title: '姓名', valign:"middle", align:"center"},
{field: 'mobile', title: '手机号', valign:"middle", align:"center"},
{field: 'usdt_amount', title: 'USDT数量', valign:"middle", align:"center"},
{field: 'amount', title: '\t金额', valign:"middle", align:"center"},
{field: 'bank', title: '\t对方地址', valign:"middle", align:"center"},
{field: 'addtime', title: '提交时间', valign:"middle", align:"center"},
/*{field: 'dealtime', title: '完成时间', valign:"middle", align:"center"},*/
{field: 'tradeno', title: '导出编码', valign:"middle", align:"center"},
{field: 'statusMark', title: '状态', valign:"middle", align:"center"},
{
field: 'coin_id', title: '撤提', valign:"middle", align:"center",
formatter: function (value, row) {
if (row.status != 'undefined' && row.status == 6) {
return '<a href="javascript:void(0)" onclick="coinOutCt(\''+value+'\', this)">撤销</a>';
} else {
return '';
}
}
}
]
});
});
/**
* 撤销提币
* @param id
* @param c
* @returns {boolean}
*/
var coinOutCt=function(id, c) {
var $btn = $(c).button('loading');
layer.confirm('确认撤销该次提款申请?', {
title: '提示',
skin: 'layui-layer-myRed',
btn: ['确认撤销','取消'],
btn1: function(){
var $btn2= $('.layui-layer-btn0').button('loading');
$.ajax({
url: url_ct,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {id:id},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
query(1);
} else {
msg_no_200(res.message);
}
$btn2.button('reset');
},
error: function () {
server_error();
$btn2.button('reset');
}
});
return true;
}
});
setTimeout(function(){$btn.button('reset');}, 500);
return false;
};
\ No newline at end of file
/**
* 资产管理:充币查询
* libingke
* 2018/01/11
*/
/**
* 表单
* @type {{start: null, end: null, coin: null, user: null}}
*/
var form1 = {
start:null,
end:null,
coin:null,
user:null
};
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#date_range',
range: ':',
done: function(value, date, endDate){
$('#date_range').val(value);
query(1);
}
});
});
/**
* 充币查询导出
* libingke
* 2018/01/11
*/
function exportTable1() {
var data = {};
data.coin=$('select[name="coin"]').val();
data.user=$('input[name="user"]').val();
if ($("#date_range").val()!=='') {
var value=$("#date_range").val();
var t=value.split(' : ', 2);
data.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
data.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
$.ajax({
url: url_export1,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: data,
dataType: 'json',
success: function (res) {
if (res.code == 200 && res.data.url) {
window.location.href = res.data.url;
} else {
msg_no_200('导出失败:' + res.message);
}
},
error: server_error
});
}
$(function () {
/**
* 回车触发 uid
*/
$('#user').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
$(".select1").bind("change",function(){ query(1); });
/**
* 表格
*/
$("#table1").bootstrapTable({
method: 'post',
url: url_table1,
queryParams: function (params) {
form1.coin=$('select[name="coin"]').val();
form1.user=$('input[name="user"]').val();
if ($("#date_range").val()==='') {
form1.start=null;
form1.end=null;
} else {
var value=$("#date_range").val();
var t=value.split(' : ', 2);
form1.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
form1.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
form1.page = params.pageNumber;
form1.size = params.pageSize;
return form1;
},
pageSize: 20,
uniqueId: 'id',
responseHandler: function (res) {
if (res.code == 200) {
if (res.data.record) {
var str = '累计充入: <b style="color: #e64544">'+res.data.record.total_amount+
'</b> '+res.data.record.currency;
if (res.data.record.worth) {
str+=' ≈ <b style="color: #e64544">'+res.data.record.worth+'</b> CNY';
}
$('#tip1').html(str);
}
return {
"rows": res.data.rows,
"total": res.data.count
};
} else {
layer.msg('[' + res.code + ']' + res.message);
return false;
}
},
columns:[
{field: 'id', title: '流水编号', valign:"middle", align:"right"},
{field: 'uid', title: 'UID', valign:"middle", align:"right"},
{field: 'name', title: '姓名', valign:"middle", align:"center"},
{field: 'currency', title: '币种', valign:"middle", align:"center"},
{field: 'amount', title: '数量', valign:"middle", align:"center"},
{field: 'rate', title: '汇率', valign:"middle", align:"center"},
{field: 'money', title: 'RMB金额', valign:"middle", align:"center"},
{field: 'way', title: '渠道', valign:"middle", align:"center"},
{field: 'accamount', title: '确认金额', valign:"middle", align:"center"},
{field: 'addtime', title: '申请时间', valign:"middle", align:"center"},
{field: 'dealtime', title: '完成时间', valign:"middle", align:"center"},
{field: 'checkuid', title: '初审员', valign:"middle", align:"center"},
{field: 'recheckuid', title: '复审员', valign:"middle", align:"center"},
{title: '状态', valign:"middle", align:"center"}
]
});
});
\ No newline at end of file
/**
* 资产管理:提币审核
* libingke
* 2018/01/05
*/
/**
* 表单
* @type {{start: null, end: null, coin: null, user: null}}
*/
var form1 = {
start:null,
end:null,
coin:null,
user:null//uid,金额,手机,邮箱,姓名
};
/**
* 表单
* @type {{start: null, end: null, coin: null, user: null, checkuid: null, recheckuid: null}}
*/
var form2 = {
start:null,
end:null,
coin:null,
user:null,
checkuid:null,//初审员编号
recheckuid:null//复核员编号
};
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#date_range',
range: ':',
done: function(value, date, endDate){
$('#date_range').val(value);
query(1);
}
});
laydate.render({
elem: '#date_range2',
range: ':',
done: function(value, date, endDate){
$('#date_range2').val(value);
query(2,1);
}
});
});
/**
* 撤销提币
* @param id
* @param c
* @returns {boolean}
*/
var coinOutCt=function(id, c) {
var $btn = $(c).button('loading');
layer.confirm('确认撤销该次提币申请?', {
title: '提示',
skin: 'layui-layer-myRed',
btn: ['确认撤销','取消'],
btn1: function(){
var $btn2= $('.layui-layer-btn0').button('loading');
$.ajax({
url: url_ct,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {id:id},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
query(1);
} else {
msg_no_200(res.message);
}
$btn2.button('reset');
},
error: function () {
server_error();
$btn2.button('reset');
}
});
return true;
}
});
setTimeout(function(){$btn.button('reset');}, 500);
return false;
};
var exportTable2=function() {
var data={};
$.ajax({
url: url_export2,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: data,
dataType: 'json',
success: function (res) {
if (res.code == 200 && res.data.url) {
window.location.href = res.data.url;
} else {
msg_no_200('导出失败:' + res.message);
}
},
error: server_error
});
};
var coinOutOpt=function(rid, url, c) {
var $btn = $(c).button('loading');
$.ajax({
url: url,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {rid:rid},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
query(1);
query(2);
} else {
msg_no_200(res.message);
}
},
error: server_error
});
$btn.button('reset');
return false;
};
var responseHandler=function(res) {
if (res.code == 200) {
if (res.data.record) {
str = '';
$.each(res.data.record, function(index, value, array) {
if (Math.abs(value) > 0)
str+='<span style="color: #ba322b">'+index+': </span><b>'+value+'</b>, ';
});
if (str !== '') {
$('#tip2').html('<br>提币小计:<br>' + str);
} else {
$('#tip2').html(str);
}
}
return {
"rows": res.data.rows,
"total": res.data.count
};
} else {
msg_no_200('[' + res.code + ']' + res.message);
return false;
}
};
var statusFormatter=function(status) {
switch (status)
{
case '0':s='拒绝';break;
case '1':s='通过';break;
case '2':s='已撤销';break;
case '3':s='待初审';break;
case '4':s='处理中';break;
case '7':s='待复核';break;
default: s=status;
}
return s;
};
/**
* 热钱包余额
*/
var getHot=function() {
$('#freshen_hot').show();
$('#hot-head').html('<th>币种</th>');
$('#hot-body').html('<td>热钱包数量</td>');
$.each(coin, function(key,value){
$.ajax({
url: url_hot,
timeout : 15000,
headers: {"Authorization": 'Bearer ' + request_token},
dataType: 'json',
data: {'coin': value},
success: function (data) {
if (data.code == 200) {
$('#hot-head').append('<th>' + value + '</th>');
$('#hot-body').append('<td>' + data.data[value].confirmedbalance + '</td>');
} else {
console.log(key + ' 余额查询出错:' + data.message);
}
},
error: function () {
console.log(key + ' 余额查询,服务器存储错');
}
});
});
};
var getHotBak=function() {
$('#freshen_hot').show();
var hotLoading = layer.load(2, {shade: false});
$.ajax({
url: url_hot,
timeout : 20000,
headers: {"Authorization": 'Bearer ' + request_token},
dataType: 'json',
success: function (data) {
if (data.code == 200) {
$('#freshen_hot').show();
th = '<th>币种</th>';
td = '<td>热钱包数量</td>';
$.each(data.data, function(a,b) {
th += '<th>'+a+'</th>';
td += '<td>'+b.confirmedbalance+'</td>';
});
str = '<thead><tr>'+th;
str += '</tr></thead><tbody><tr>' + td;
str += '</tr></tbody>';
$('#hot').html(str);
} else {
//$('#freshen_hot').hide();
msg_no_200('热钱包余额显示错误:'+data.message);
}
},
error: function () {
//$('#freshen_hot').hide();
}
});
layer.close(hotLoading);
};
var queryAddress=function (address) {
$('#uid2').val(address);
query(2,1);
};
$(function () {
/* 热钱包余额 */
getHot();
$('#uid1').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
$('#uid2').bind('keypress', function(event) {
if(event.keyCode == "13")
query(2,1);
});
$(".select1").bind("change",function(){ query(1); });
$(".select2").bind("change",function(){ query(2,1); });
/**
* 初始化表格
*/
$("#table1").bootstrapTable({
method: 'post',
url: url_table1,
queryParams: function (params) {
form1.coin=$('form#form1 select[name="coin"]').val();
form1.user=$('form#form1 input[name="user"]').val();
if ($("#date_range").val()==='') {
form1.start=null;
form1.end=null;
} else {
var value=$("#date_range").val();
var t=value.split(' : ', 2);
form1.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
form1.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
form1.page = params.pageNumber;
form1.size = params.pageSize;
return form1;
},
pageSize: 12,
responseHandler: responseHandler,
columns:[
[
{field: 'id', title: '流水编号', valign:"middle", align:"center"},
{field: 'uid', title: 'UID', valign:"middle", align:"center"},
{field: 'name', title: '姓名', valign:"middle", align:"center"},
{field: 'mobile', title: '手机号', valign:"middle", align:"center"},
{field: 'currency', title: '币种', valign:"middle", align:"center"},
{field: 'amount', title: '数量', valign:"middle", align:"center"},
{
field: 'address', title: '对方地址', valign:"middle", align:"center",
formatter: function (value, row, index) {
return '<a href="javascript:void(0)" onclick="queryAddress(\''+value+'\')">'+value+'</a>';
}
},
{field: 'todayAmount', title: '该地址今日已提币数', valign:"middle", align:"center"},
{field: 'num', title: '该地址总操作次数', valign:"middle", align:"center"},
{field: 'addtime', title: '提交时间', valign:"middle", align:"center"},
{
field: 'status', title: '操作', valign:"middle", align:"center",
formatter: function (value, row, index) {
if (row.status == 3) {
return [
'<a href="javascript:void(0)" onclick="coinOutOpt('+row.id+', url_cs, this)">初审</a>',
'&nbsp;&nbsp;&nbsp;<a onclick="return false;" style="color: grey;">复核</a>',
'&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="coinOutCt('+row.id+', this)">撤提</a>'
].join('');
} else if (row.status == 7) {
return [
'<a onclick="return false;" style="color: grey;">初审</a>',
'&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="coinOutOpt('+row.id+', url_fs, this)">复核</a>',
'&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="coinOutCt('+row.id+', this)">撤提</a>'
].join('');
} else {
return ['-'].join('');
}
}
}
]
]
});
$("#table2").bootstrapTable({
method: 'post',
url: url_table2,
queryParams: function (params) {
form2.coin=$('form#form2 select[name="coin"]').val();
form2.user=$('form#form2 input[name="user"]').val();
form2.checkuid=$('form#form2 select[name="checkuid"]').val();
form2.recheckuid=$('form#form2 select[name="recheckuid"]').val();
if ($("#date_range2").val()==='') {
form2.start=null;
form2.end=null;
} else {
var value=$("#date_range2").val();
var t=value.split(' : ', 2);
form2.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
form2.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
form2.page = params.pageNumber;
form2.size = params.pageSize;
return form2;
},
pageSize: 12,
responseHandler: responseHandler,
columns: [
[
{field: 'id', title: '流水编号', valign: "middle", align: "center"},
{field: 'uid', title: 'UID', valign: "middle", align: "center"},
{field: 'name', title: '姓名', valign: "middle", align: "center"},
{field: 'mobile', title: '手机号', valign: "middle", align: "center"},
{field: 'currency', title: '币种', valign: "middle", align: "center"},
{field: 'amount', title: '数量', valign: "middle", align: "center"},
{field: 'address', title: '对方地址', valign: "middle", align: "center"},
{field: 'addtime', title: '提交时间', valign: "middle", align: "center"},
{field: 'dealtime', title: '完成时间', valign: "middle", align: "center"},
{field: 'status', title: '状态', valign: "middle", align: "center",
formatter: statusFormatter},
{field: 'checkuid', title: '初审员', valign: "middle", align: "center"},
{field: 'recheckuid', title: '复审员', valign:"middle", align:"center"}
]
]
});
});
\ No newline at end of file
/**
* 资产管理:薪资发放
* libingke
* 2018/01/11
*/
/**
* 表单
* @type {{start: null, end: null, status: null, uid: null}}
*/
var form1 = {
start:null,
end:null,
status:null,
uid:null
};
var laydate = layui.laydate;
layui.use('laydate', function(){
laydate.render({
elem: '#date_range',
range: ':',
done: function(value, date, endDate){
$('#date_range').val(value);
query(1);
}
});
});
var loadSelect=function () {
var sid='add_row_select';
$.ajax({
url: url_type,
headers: {"Authorization": 'Bearer ' + request_token},
dataType: 'json',
success: function (res) {
if (res.code == 200 && res.data) {
var str='';
$.each(res.data,function(k,v){
str+='<option value="'+k+'">'+v+'</option>';
});
if (str !== '') {
str = '<select id="row_category" class="my-select select_row" style="border-radius: 0 4px 4px 0">' + str + '</select>';
$("#"+sid).html(str);
} else {
layer.msg('未获取到类型数据');
var str = '&nbsp;&nbsp;<span class="my-label"><a onclick="loadSelect()">重新加载</a></span>';
$("#"+sid).html(str);
}
} else {
layer.msg(res.message);
var str = '&nbsp;&nbsp;<span class="my-label"><a onclick="loadSelect()">重新加载</a></span>';
$("#"+sid).html(str);
}
},
error: function () {
layer.msg('未获取到类型数据');
var str = '&nbsp;&nbsp;<span class="my-label"><a onclick="loadSelect()">重新加载</a></span>';
$("#"+sid).html(str);
}
});
};
/**
* 导入数据
*/
var loadRow=function() {
var index=layer.open({
type: 1,
title: '添加数据',
id: 'load-row',
area : ['320px', 'auto'],
skin: 'layui-layer-myBlue',
content: '<div style="padding: 5px 20px;"><br>\n' +
' <div class="input-group my-group">'+
' <span class="input-group-addon">UID </span>\n' +
' <input id="row_uid" type="text" class="form-control">\n' +
' </div>\n'+
' <div class="input-group my-group">'+
' <span class="input-group-addon">数量 </span>\n' +
' <input id="row_amount" type="number" class="form-control">\n' +
' </div>\n'+
' <div class="input-group my-group">'+
' <span class="input-group-addon">类型 </span>\n' +
' <div id="add_row_select">' +
' &nbsp;&nbsp;<i class="layui-icon layui-anim layui-anim-rotate layui-anim-loop" style="font-size: 24px; color: #2196f3;">&#x1002;</i>\n' +
' </div>' +
' </div>\n'+
'</div>',
btn: ['确认', '取消'],
btn1: function() {
var v1=$('#row_uid').val();
var v2=$('#row_amount').val();
var v3=$('#row_category').val();
if(v1!=="" && v2!=="" && v3!="undefined"){
$btn = $('.layui-layer-btn0').button('loading');
$.ajax({
url: url_add_row,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {uid:v1,amount:v2,category:v3},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
layer.close(index);
query(1);
} else {
msg_no_200(res.message);
}
},
error: server_error
});
$btn.button('reset');
} else{
layer.msg("请输入完整!");
}
return false;
}
});
loadSelect();
};
/**
* 导入文件
*/
layui.use('upload', function() {
var $ = layui.jquery, upload = layui.upload;
upload.render({
elem: '#loadFile',
url: '##',
size: 1024,
auto: false,
accept:'file',
exts: 'csv',
choose: function(res){
res.preview(function(index, file){
var formData = new FormData();
formData.append("file",file);
$.ajax({
url: url_add_file,
headers: {"Authorization": 'Bearer ' + request_token},
type : 'POST',
dataType: 'json',
data : formData,
processData : false,
contentType : false,
success: function (res) {
if (res.code == 200) {
//valid_num 正确导入的行数量 error_num 错误处理的行数量 error_rows 错误处理的行
var t='<p>正确导入的行数量: <b>'+res.data.valid_num+'</b></p>'+
'<p>错误处理的行: <b>'+res.data.error_num+'</b></p>';
layer.msg(t, {btn: ['关闭'], time: 8000});
if (res.data.valid_num > 0) {
query(1);
}
} else {
msg_no_200(res.message);
}
},
error: server_error
});
});
}
});
});
var statusFormatter=function(s) {
'use strict';
switch (s)
{
case '0':s='<span style="color: #777">未处理</span>';break;
case '1':s='<span style="color: #f44336">已处理</span>';break;
default: s=status;
}
return s;
};
$(function () {
/**
* 回车触发 uid
*/
$('#uid').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
$(".select1").bind("change",function(){ query(1); });
/**
* 表格
*/
$("#table1").bootstrapTable({
method: 'post',
url: url_table1,
queryParams: function (params) {
form1.status=$('select[name="status"]').val();
form1.uid=$('input[name="uid"]').val();
if ($("#date_range").val()==='') {
form1.start=null;
form1.end=null;
} else {
var value=$("#date_range").val();
var t=value.split(' : ', 2);
form1.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
form1.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
form1.page = params.pageNumber;
form1.size = params.pageSize;
return form1;
},
pageSize: 25,
uniqueId: 'id',
responseHandler: function (res) {
if (res.code == 200) {
return {
"rows": res.data.rows,
"total": res.data.count
};
} else {
layer.msg('[' + res.code + ']' + res.message);
return false;
}
},
columns:[
{field: 'id', title: '流水编号', valign:"middle", align:"center"},
{field: 'uid', title: 'UID', valign:"middle", align:"center"},
{field: 'currency', title: '币种', valign:"middle", align:"center"},
{field: 'amount', title: '数值', valign:"middle", align:"right"},
{field: 'category', title: '类型', valign:"middle", align:"center"},
{
field: 'status', title: '状态', valign: "middle", align: "center",
formatter: statusFormatter
},
{field: 'addtime', title: '添加时间', valign:"middle", align:"center"},
{field: 'dealtime', title: '处理时间', valign:"middle", align:"center"}
]
});
});
\ No newline at end of file
/**
* 自定义刷新提示
*/
var whenShowLoading=null;
var showMyLoading=function () {
if (typeof(layer) === 'object' && whenShowLoading === null) {
whenShowLoading = layer.load(2, {shade: false});
}
return true;
};
var hideMyLoading=function () {
if (typeof(layer) === 'object' && whenShowLoading !== null) {
layer.close(whenShowLoading);
whenShowLoading = null;
}
return true;
};
/**
* 获取云矿机头部配置
* @param key
* @param verb
* @param postData object [{name:'xx', value:'xxx'}]
* @returns obj
*/
var getMinerHeaders = function (key, verb, postData) {
postData = arguments[2] ? (arguments[2] ? arguments[2] : '') : '';
var newSignature = {
_key: null,
_verb: null,
_date: null,
_contentType: 'application/json',
_signatureMethod: 'sha256',
_signatureVersion: '1.0',
setKey: function (key) {this._key = key;},
getKey: function () {return this._key === null ? '' : this._key;},
setVerb: function (verb) {this._verb = verb;},
getVerb: function () {return this._verb === null ? 'get' : this._verb;},
setDate: function (date) {this._date = date;},
getDate: function () {return this._date;},
getContentType: function () {return this._contentType;},
getSignatureMethod: function () {return this._signatureMethod;},
getSignatureVersion: function () {return this._signatureVersion;},
_buildContentMd5: function (postData) {
if (!postData) {
return '';
} else {
if (!(postData instanceof Array)) {
throw '发送数据必须是数组包含对象,并且对象包含键名name,value';
}
postData = postData.sort(function (x, y) {
if (x.name < y.name) {
return -1;
} else if (x.name > y.name) {
return 1;
} else {
return 0;
}
});
var obj = {};
for(var i= 0;i<postData.length;i++){
v = postData[i];
if (typeof (v.name) !== 'undefined' && typeof (v.value) !== 'undefined') {
name = v.name;
obj[name] = v.value;
}
}
return CryptoJS.MD5( JSON.stringify(obj) ).toString();
}
},
_buildSignatureString: function (postData) {
//console.log(this._buildContentMd5(postData));
str = (this.getVerb()).toUpperCase() + "\n\n" +
this._buildContentMd5(postData) + "\n" +
this.getContentType() + "\n" +
this.getDate() + "\n" +
this.getSignatureMethod() + "\n" +
this.getSignatureVersion() + "\n\n" +
this.getKey() + "\n";
//console.log(str);
return str;
},
getSignature: function (key, verb, postData) {
this.setKey(key);
this.setVerb(verb);
signatureString = this._buildSignatureString(postData);
//console.log(signatureString);debugger
hash = CryptoJS.HmacSHA256(signatureString, this.getKey()).toString(); //仅针对 sha256
return CryptoJS.MD5(hash).toString();
}
};
newSignature.setDate(new Date().toGMTString());
ret = {
'Verb' : (verb === 'post' ? 'post' : 'get'),
'Date' : newSignature.getDate(),
'Content-Type' : newSignature.getContentType(),
'Signature-Method' : newSignature.getSignatureMethod(),
'Signature-Version' : newSignature.getSignatureVersion(),
'Signature' : newSignature.getSignature(key, verb, postData)
};
return ret;
};
/**
* 粘贴板
* @param text
*/
var copyText=function (text) {
oInput = document.createElement('input');
oInput.value = text;
document.body.appendChild(oInput);
oInput.select();
document.execCommand("Copy");
oInput.className = 'oInput';
oInput.style.display='none';
};
/**
* 日期 转换为 Unix时间戳
* @param string 日期格式
* @param timeZone 时区
* @returns {number}
*/
var DateToUnix = function(string, timeZone) {
string = arguments[0] ? (typeof (arguments[0]) === 'string' ? arguments[0] : '') : '';
timeZone = arguments[1] ? (arguments[1]%1 === 0 ? arguments[1] : 8) : 8;
var f = string.split( 'T', 2);
var d = (f[0] ? f[0] : '').split( '-', 3);
var t = (f[1] ? f[1] : '').split( ':', 3);
var s = (t[2] ? t[2] : '').split( '.', 2);
return (new Date(
parseInt(d[0], 10) || null,
(parseInt(d[1], 10) || 1) - 1,
parseInt(d[2], 10) || null,
parseInt(t[0], 10) || null,
parseInt(t[1], 10) || null,
parseInt(s[0], 10) || null
)).getTime() / 1000 + 3600 * timeZone;
};
/**
* 时间戳转换日期
* @param unixTime 待时间戳(秒)
* @param isFull 返回完整时间(Y-m-d 或者 Y-m-d H:i:s)
* @param timeZone 时区
* @returns {string}
*/
var UnixToDate = function(unixTime, isFull, timeZone) {
unixTime = arguments[0] ? (arguments[0]%1 === 0 ? arguments[0] : 0) : 0;
isFull = arguments[1] ? (typeof (arguments[1]) === 'boolean' ? arguments[1] : true) : true;
timeZone = arguments[2] ? (arguments[2]%1 === 0 ? arguments[2] : 0) : 0;
unixTime = parseInt(unixTime) + parseInt(timeZone) * 60 * 60;
time = new Date(unixTime * 1000);
ymdhis = "";
ymdhis += time.getFullYear() + "-";
ymdhis += (time.getMonth()+1 < 10 ? '0'+(time.getMonth()+1) : (time.getMonth()+1)) + '-';
ymdhis += time.getDate() < 10 ? '0'+time.getDate() : time.getDate();
if (isFull === true) {
ymdhis += " " + (time.getHours() < 10 ? '0'+time.getHours() : time.getHours()) + ":";
ymdhis += (time.getMinutes() < 10 ? '0'+time.getMinutes() : time.getMinutes()) + ":";
ymdhis += (time.getSeconds() < 10 ? '0'+time.getSeconds() : time.getSeconds());
}
return ymdhis;
};
//console.log(DateToUnix('2014-5-15 20:20:20'));
//console.log(UnixToDate(1325347200));
/**
* Bootstrap Table Chinese translation
*/
(function ($) {
'use strict';
$.fn.bootstrapTable.locales['zh-CN'] = {
method: 'post',
url: "/admin/public/ajax?case=miner_query",
contentType: "application/x-www-form-urlencoded",
striped: true, //设置为 true 会有隔行变色效果
cache: false, //设置为 false 禁用 AJAX 数据缓存
silent: true, //静默刷新方式 refresh {silent: true}
dataType: "json", //服务器返回的数据类型
queryParamsType:'', //queryParams {pageSize, pageNumber, searchText, sortName, sortOrder}
undefinedText: '', //当数据为 undefined 时显示的字符
sidePagination: "server", //服务器分页
pagination: true, //设置为 true 会在表格底部显示分页条
paginationLoop: false, //设置为 true 启用分页条无限循环的功能
//clickToSelect: true,
/*fixedColumns: true,
fixedNumber: 2,*/
paginationPreText: '上一页',
paginationNextText: '下一页',
formatLoadingMessage: function () {
return '';
},
formatRecordsPerPage: function (pageNumber) {
return '';//'每页显示 ' + pageNumber + ' 条记录';
},
formatShowingRows: function (pageFrom, pageTo, totalRows) {
return '<span style="font-size: 11px">第 <b>'+pageFrom+'</b>-<b>'+pageTo+'</b> 条,共 <b>'+totalRows+'</b> 条数据. </span>';
//return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
},
formatSearch: function () {
return '搜索';
},
formatNoMatches: function () {
return '<span style="color: #9e9e9e">没有找到匹配的记录</span>';
},
formatPaginationSwitch: function () {
return '隐藏/显示分页';
},
formatRefresh: function () {
return '刷新';
},
formatToggle: function () {
return '切换';
},
formatColumns: function () {
return '列';
},
formatExport: function () {
return '导出';
},
formatClearFilters: function () {
return '清空过滤';
},
onLoadSuccess: function () {
return hideMyLoading();
},
onLoadError: function () {
return hideMyLoading();
},
onRefresh: function () {
return showMyLoading();
},
onPageChange: function () {
return showMyLoading();
}
};
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
})(jQuery);
\ No newline at end of file
/**
* 云矿机:利息表
* libingke
* 2018/05/07
*/
/**
* 表单1
* @type {{start_time: null, end_time: null, type: null, pool_id: null, user_id: null}}
*/
var form1 = {
start_time:null,
end_time:null,
type:null,
pool_id:null,
user_id:null
};
/**
* 表单2
* @type {{start_time: null, end_time: null, type: null, pool_id: null, user_id: null}}
*/
var form2 = {
start_time:null,
end_time:null,
type:null,
pool_id:null,
user_id:null
};
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#date_range1',
//type: 'datetime',
range: '~',
done: function(value, date, endDate){
$('#date_range1').val(value);
query(1);
}
});
laydate.render({
elem: '#date_range2',
//type: 'datetime',
range: '~',
done: function(value, date, endDate){
$('#date_range2').val(value);
query(2);
}
});
});
$(function () {
$('#pool_id1').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
$('#pool_id2').bind('keypress', function(event) {
if(event.keyCode == "13")
query(2);
});
$('#user_id1').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
$('#user_id2').bind('keypress', function(event) {
if(event.keyCode == "13")
query(2);
});
$(".select1").bind("change",function(){ query(1); });
$(".select2").bind("change",function(){ query(2); });
var responseHandler= function (res) {
if (res.message !== '') {
msg_no_200(res.message);
return false;
}
if (res.response.code != 200) {
msg_no_200("[" + res.response.code + "] " + res.response.message);
console.log(res)
return false;
}
return {
"rows": res.response.data.rows,
"total": res.response.data.count
};
};
/**
* 初始化表格
*/
$("#table1").bootstrapTable({
queryParams: function (params) {
form1.type=$('form#form1 select[name="type"]').val();
form1.pool_id=$.trim($('form#form1 input[id="pool_id1"]').val());
form1.user_id=$.trim($('form#form1 input[name="user_id"]').val());
if ($("#date_range1").val()==='') {
form1.start_time=null;
form1.end_time=null;
} else {
var value=$("#date_range1").val();
var t=value.split(' ~ ', 2);
form1.start_time=t[0] + ' 00:00:00';
form1.end_time=t[1] + ' 23:59:59';
}
form1.page = params.pageNumber;
form1.page_size = params.pageSize;
$('form#form1 input[name="pool_id"]').val(form1.pool_id);
//obj
api_type = 'get';
return {
'type': api_type,
'url': url_table1,
'headers': getMinerHeaders(url_key, api_type, ''),
'query': form1
};
},
pageSize: 20,
uniqueId: 'id',
/* 接口返回结果适配 */
responseHandler: responseHandler,
/* 复制矿池编号 */
onDblClickRow: function (row) {
//copyText(row.pool_id);
},
columns:[
[
{field: 'id', title: '编号', valign: "middle", align: "center"},
{field: 'pool_id', title: '矿池编号', valign: "middle", align: "center"},
{field: 'user_id', title: 'UID', valign: "middle", align: "center"},
{
field: 'type', title: '收益类型', valign: "middle", align: "center",
formatter: function (v) {
switch (v)
{
case 1: $t = '推荐人一级奖励';break;
case 2: $t = '推荐人二级奖励';break;
case 3: $t = '推荐矿池一级奖励';break;
case 4: $t = '推荐矿池二级奖励';break;
case 5: $t = '矿池发起人奖励';break;
case 6: $t = '矿池内挖矿一级奖励';break;
case 7: $t = '矿池内挖矿二级奖励';break;
default: $t = '';
}
return $t;
}
},
{field: 'amount', title: '奖励金额', valign: "middle", align: "center"},
{
field: 'mining_at', title: '奖励时间', valign: "middle", align: "center",
formatter: function (v) {return UnixToDate(v);}
}
]
]
});
$("#table2").bootstrapTable({
queryParams: function (params) {
form2.type=$('form#form2 select[name="type"]').val();
form2.pool_id=$.trim($('form#form2 input[id="pool_id2"]').val());
form2.user_id=$.trim($('form#form2 input[name="user_id"]').val());
if ($("#date_range2").val()==='') {
form2.start_time=null;
form2.end_time=null;
} else {
var value=$("#date_range2").val();
var t=value.split(' ~ ', 2);
form2.start_time=t[0] + ' 00:00:00';
form2.end_time=t[1] + ' 23:59:59';
}
form2.page = params.pageNumber;
form2.page_size = params.pageSize;
$('form#form2 input[name="pool_id"]').val(form2.pool_id);
//obj
api_type = 'get';
return {
'type': api_type,
'url': url_table2,
'headers': getMinerHeaders(url_key, api_type, ''),
'query': form2
};
},
pageSize: 20,
uniqueId: 'id',
responseHandler: responseHandler,
onDblClickRow: function (row) {
//copyText(row.pool_id);
},
columns:[
[
{field: 'id', title: '编号', valign: "middle", align: "center"},
{field: 'pool_id', title: '矿池编号', valign: "middle", align: "center"},
{field: 'user_id', title: 'UID', valign: "middle", align: "center"},
{
field: 'type', title: '收益类型', valign: "middle", align: "center",
formatter: function (v) {
switch (v)
{
case 1: $t = '挖矿';break;
default: $t = '';
}
return $t;
}
},
{field: 'amount', title: '奖励金额', valign: "middle", align: "center"},
{
field: 'mining_at', title: '奖励时间', valign: "middle", align: "center",
formatter: function (v) {return UnixToDate(v);}
}
]
]
});
});
\ No newline at end of file
/**
* 经纪商申请列表
* libingke
* 2018/01/05
*/
$(function () {
/**
* 初始化表格
*/
$("#table1").bootstrapTable({
method: 'post',
url: url_table1,
queryParams: function queryParams1(params) {
var res = {};
res.page = params.pageNumber;
res.size = params.pageSize;
return res;
},
pageSize: 20,
uniqueId: 'id',
showRefresh: true,
/* 接口返回结果适配 */
responseHandler: function(res) {
if (res.code == 200) {
return {
"rows": res.data.rows,
"total": res.data.count
};
} else {
msg_no_200('[' + res.code + ']' + res.message);
return false;
}
},
columns:[
[
{field: 'id', title: '编号', valign:"middle", align:"center"},
{field: 'company', title: '公司名称', valign:"middle", align:"center"},
{field: 'country', title: '所属国家', valign:"middle", align:"center"},
{field: 'area', title: '所属地区', valign:"middle", align:"center"},
{field: 'contacts', title: '申请人', valign:"middle", align:"center"},
{field: 'mobile', title: '申请人手机', valign:"middle", align:"center"},
{field: 'other', title: '其他联系方式', valign:"middle", align:"center"},
{field: 'addtime', title: '申请时间', valign:"middle", align:"center"},
{field: 'status', title: '记录状态', valign:"middle", align:"center"},
{
field: 'id', title: '操作', valign:"middle", align:"center",
formatter: function(id, row) {
return [
'<a href="javascript:void(0)" onclick="passRow('+row.id+', this)">通过</a>',
'&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" style="color: red" onclick="refuseRow('+row.id+', this)">拒绝</a>'
].join('');
}
}
]
]
});
});
/**
* 通过
*/
var passRow=function(id) {
var row = $("#table1").bootstrapTable("getRowByUniqueId", id);
var tip = row.company!==null?row.company:('('+id+')');
var confirmText = '<div style="padding: 5px 20px;"><br>\n' +
'确定要将“<span style="color: #2ab4c0">'+tip+'</span>”设为经纪商?<br><br>'+
' <div class="input-group" style="max-width: 280px">'+
' <span class="input-group-addon">经纪商标识</span>\n' +
' <input id="set_company" type="text" class="my-input" placeholder=" 填写英文或数字">\n' +
' </div><br>\n'+
'</div>';
var confirm=layer.open({
type: 1,
title: '设置经纪商标识 <span style="color: #32c5d2">['+tip+']</span>',
id: 'set-company',
skin: 'layui-layer-myBlue',
content: confirmText,
btn: ['确认','取消'],
btn1: function(){
v1=$('#set_company').val();
if(v1!=="") {
var waitLoading=layer.load(2, {shade: false});
$btn = $('.layui-layer-btn0').button('loading');
$.ajax({
url: url_pass,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {"aid": id, "platkey": v1},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
$('#table1').bootstrapTable('removeByUniqueId', row.id);
layer.close(waitLoading);
layer.close(confirm);
var index=layer.open({
type: 1,
title: '设置返佣比例 <span style="color: #32c5d2">['+tip+']</span>',
id: 'set-ratio',
area : ['280px', 'auto'],
skin: 'layui-layer-myBlue',
content: '<div style="padding: 5px 20px;"><br>\n' +
' <div class="input-group">'+
' <span class="input-group-addon"> 返佣比例</span>\n' +
' <input id="set_ratio" type="number" class="form-control">\n' +
' <span class="input-group-addon">%</span>\n' +
' </div>\n'+
'</div><br>',
btn: ['确认', '取消'],
btn1: function() {
v2=$('#set_ratio').val();
if(!isNaN(v2) && v2!==""){
$btn = $('.layui-layer-btn0').button('loading');
$.ajax({
url: url_updateRate,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {uid:row.uid,rebate:v2},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
layer.closeAll();
query(1);
} else {
msg_no_200(res.message);
}
},
error: server_error
});
$btn.button('reset');
} else{
layer.msg("请输入正确的返佣比例");
}
return false;
},
btn2: function(){
layer.closeAll();
}
});
} else {
msg_no_200(res.message);
}
},
error: server_error
});
layer.close(waitLoading);
$btn.button('reset');
}else{
layer.msg("请输入标识");
}
return false;
},btn2: function(){
layer.closeAll();
}
});
return true;
};
/**
* 拒绝
*/
var refuseRow=function(id) {
var row = $("#table1").bootstrapTable("getRowByUniqueId", id);
var tip = row.company!==null?row.company:('('+id+')');
var reasonText = ' <div class="input-group my-group">\n' +
' <span class="input-group-addon">原因</span>\n' +
' <textarea id="reason_text" name="reason_text" class="layui-textarea" rows="1"></textarea>\n' +
' </div>\n';
index=layer.confirm('确认拒绝“ <span style="color: red">'+tip+'</span>”的申请 ?<br><br>'+reasonText, {
title: '拒绝提示',
skin: 'layui-layer-myRed',
btn: ['拒绝','取消']
,btn1: function(){
$btn = $('.layui-layer-btn0').button('loading');
query(1);
$.ajax({
url: url_refuse,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {aid:id, reason:$("#reason_text").val()},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
layer.close(index);
query(1);
} else {
msg_no_200(res.message);
}
},
error: server_error
});
$btn.button('reset');
}
});
};
/**
* 经纪商资产管理
* libingke
* 2018/01/10
*/
/**
* 表单
* @type {{start: null, end: null, search: null}}
*/
var form1 = {
currency:null,//币种
optype:null,// 操作类型(1->用户购买,2->用户兑出,3->预购,4->兑出,5->提币)
start:null,
end:null,
search:null
};
/**
* 范围日期
*/
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#date_range',
range: ':',
done: function(value, st, ed){
$('#date_range').val(value);
query(1);
}
});
});
/**
* 导出
*/
var exportTable1=function () {
var data = {};
data.currency=$("#currency").val()>0?$("#currency").find("option:selected").text():'';
data.optype=$("#optype").val();
data.search=$("#search").val();
if ($("#date_range").val()==='') {
data.start=null;
data.end=null;
} else {
var value=$("#date_range").val();
var t=value.split(' : ', 2);
data.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
data.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
$.ajax({
url: url_export1,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: data,
dataType: 'json',
success: function (res) {
if (res.code == 200 && res.data.url) {
window.location.href = res.data.url;
} else {
msg_no_200('导出失败:' + res.message);
}
},
error: server_error
});
};
$(function () {
/**
* 回车触发
*/
$('#uid1').bind('keypress', function(event) {
if(event.keyCode == "13") {
query(1);
}
});
$(".select1").bind("change",function(){ query(1); });
/**
* 初始化表格
*/
$("#table1").bootstrapTable({
method: 'post',
url: url_table1,
queryParams: function (params) {
form1.currency=$("#currency").val()>0?$("#currency").find("option:selected").text():'';
form1.optype=$("#optype").val();
form1.search=$("#search").val();
if ($("#date_range").val()==='') {
form1.start=null;
form1.end=null;
} else {
var value=$("#date_range").val();
var t=value.split(' : ', 2);
form1.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
form1.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
form1.page = params.pageNumber;
form1.size = params.pageSize;
return form1;
},
pageSize: 20,
uniqueId: 'id',
/* 接口返回结果适配 */
responseHandler: function (res) {
if (res.code == 200) {
if (res.data.record) {
var str = '';
$.each(res.data.record, function(index, value, array) {
if (value >= 0)
str+="<span>共 <b>"+value+"</b> "+index+"</span><br>";
});
$('#tip2').html(str);
}
return {
"rows": res.data.rows,
"total": res.data.count
};
} else {
layer.msg('[' + res.code + ']' + res.message);
return false;
}
},
columns:[
[
{field: 'id', title: '编号', valign:"middle", align:"center", colspan: 1, rowspan: 2},
{field: 'optime', title: '操作时间', valign:"middle", align:"center", colspan: 1, rowspan: 2},
{field: 'uid', title: 'UID', valign:"middle", align:"center", colspan: 1, rowspan: 2},
{field: 'company', title: '经纪商名称', valign:"middle", align:"center", colspan: 1, rowspan: 2},
{field: 'type', title: '操作', valign:"middle", align:"center", colspan: 1, rowspan: 2},
{field: 'currency', title: '币种', valign:"middle", align:"center", colspan: 1, rowspan: 2},
{field: 'price', title: '价格', valign:"middle", align:"center", colspan: 1, rowspan: 2},
{field: 'amount', title: '数量', valign:"middle", align:"center", colspan: 1, rowspan: 2},
{title: '资产数据', valign:"middle", align:"center", colspan: 2, rowspan: 1}
],
[
{field: 'BTC', title: 'BTC', valign:"middle", align:"center"},
{field: 'USDT', title: 'USDT', valign:"middle", align:"center"}
]
]
});
});
/**
* 修改返佣比例
*/
var editRow=function(uid) {
var row = $("#table1").bootstrapTable("getRowByUniqueId", uid);
var tip = row.company!==null?row.company:('('+uid+')');
var index=layer.open({
type: 1
,title: '修改返佣比例'
,id: 'edit-row'
,area : ['280px', 'auto']
,skin: 'layui-layer-myBlue'
,content: '<div style="padding: 5px 20px;">\n' +
' <p style="text-align: left"> '+tip+'</p>' +
' <div class="input-group my-group">'+
' <span class="input-group-addon">返佣比例 </span>\n' +
' <input id="edit_row" type="number" class="form-control">\n' +
' <span class="input-group-addon">%</span>\n' +
' </div>\n'+
'</div>'
,btn: ['确认', '取消']
,btn1: function() {
v=$('#edit_row').val();
if(!isNaN(v) && v!==""){
$btn = $('.layui-layer-btn0').button('loading');
$.ajax({
url: url_updateRate,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {uid:uid,rebate:v},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
layer.close(index);
query(1);
} else {
msg_no_200(res.message);
}
},
error: server_error
});
$btn.button('reset');
} else{
layer.msg("输入有误");
}
return false;
}
,btn2: function(){
layer.close(index);
}
});
return true;
};
/**
* 删除
*/
var deleteRow=function(uid) {
var row = $("#table1").bootstrapTable("getRowByUniqueId", uid);
var tip = row.company!==null?row.company:('('+uid+')');
var title='确认删除 <span style="color: red">'+tip+'</span> ?<br>' +
'<span style="font-size: 10px;color: #9E9E9E">说明:未删除,仅转为不可用状态</span>';
var index=layer.confirm(title, {
title: '删除提示',
skin: 'layui-layer-myRed',
btn: ['确认','取消']
}, function(){
$btn = $('.layui-layer-btn0').button('loading');
$.ajax({
url: url_updateRate,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {uid:uid,status:"-1",operation:"status"},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
layer.close(index);
query(1);
} else {
msg_no_200(res.message);
}
},
error: server_error
});
$btn.button('reset');
query(1);
}, function(){
layer.close(index);
});
};
\ No newline at end of file
/**
* 经纪商:提款查询
* libingke
* 2018/01/05
*/
/**
* 表单
* @type {{start: null, end: null, statu: null, user: null}}
*/
var form1 = {
start:null,
end:null,
statu:null,//出金记录状态
user:null
};
/**
* 范围日期
*/
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#date_range'
,range: ':'
,done: function(value, date, endDate){
$('#date_range').val(value);
query(1);
}
});
});
/**
* 确认打款
* @param id
* @param that
* @returns {boolean}
*/
var recordConfirm=function (id, that) {
var $btn = $(that).button('loading');
var confirm=layer.confirm('确认打款 ?', {
title: '清除提示',
skin: 'layui-layer-myGreen',
btn: ['确认','取消']
}, function(){
$.ajax({
url: url_confirm,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {cashid:id},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
query(1);
} else {
msg_no_200(res.message);
}
},
error: server_error
});
$btn.button('reset');
layer.close(confirm);
}, function () {
$btn.button('reset');
layer.close(confirm);
});
return false;
};
$(function () {
/**
* 回车触发
*/
$('#user').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
$("select").bind("change",function(){ query(1); });
/**
* 初始化表格
*/
$("#table1").bootstrapTable({
method: 'post',
url: url_table1,
queryParams: function (params) {
form1.statu=$('select[name="statu"]').val();
form1.user=$('input[name="user"]').val();
if ($("#date_range").val()==='') {
form1.start=null;
form1.end=null;
} else {
var value=$("#date_range").val();
var t=value.split(' : ', 2);
form1.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
form1.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
form1.page = params.pageNumber;
form1.size = params.pageSize;
return form1;
},
pageSize: 12,
responseHandler: function (res) {
if (res.code == 200) {
if (res.data.statis) {
var str = '<span><b>小计</b></span>:';
str+="<span> <b>"+res.data.statis.cny+"</b> cny ≈ <b>"+res.data.statis.usdt+"</b> usdt</span>";
$('#tip1').html(str);
}
return {
"rows": res.data.rows,
"total": res.data.count
};
} else {
msg_no_200('[' + res.code + ']' + res.message);
return false;
}
},
uniqueId: 'id',
columns:[
{field: 'id', title: '流水编号', valign:"middle", align:"center"},
{field: 'uid', title: 'UID', valign:"middle", align:"center"},
{field: 'name', title: '姓名', valign:"middle", align:"center"},
{field: 'mobile', title: '手机号', valign:"middle", align:"center"},
{field: 'usdt_amount', title: 'USDT数量', valign:"middle", align:"center"},
{field: 'amount', title: '金额', valign:"middle", align:"center"},
{field: 'addtime', title: '提交时间', valign:"middle", align:"center"},
{field: 'dealtime', title: '完成时间', valign:"middle", align:"center"},
{field: 'statusMark', title: '状态', valign:"middle", align:"center"},
{
field: 'status', title: '操作', valign:"middle", align:"center",
formatter: function (value, row, index) {
if (value == 6) {
return '<a href="javascript:void(0)" onclick="recordConfirm('+row.id+', this)">确认打款</a>';
} else {
return '';
}
}
}
]
});
});
\ No newline at end of file
/**
* 经纪商管理页面
* libingke
* 2018/01/05
*/
/**
* 表单
* @type {{start: null, end: null, search: null}}
*/
var form1 = {
start:null,
end:null,
search:null
};
/**
* 范围日期
*/
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#date_range',
range: ':',
done: function(value, st, ed){
$('#date_range').val(value);
query(1);
}
});
});
$(function () {
/**
* 回车触发
*/
$('#search').bind('keypress', function(event) {
if(event.keyCode == "13") {
query(1);
}
});
/**
* 初始化表格
*/
$("#table1").bootstrapTable({
method: 'post',
url: url_table1,
queryParams: function (params) {
form1.search=$("#search").val();
if ($("#date_range").val()==='') {
form1.start=null;
form1.end=null;
} else {
var value=$("#date_range").val();
var t=value.split(' : ', 2);
form1.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
form1.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
form1.page = params.pageNumber;
form1.size = params.pageSize;
return form1;
},
pageSize: 20,
uniqueId: 'uid',
/* 接口返回结果适配 */
responseHandler: function (res) {
if (res.code == 200) {
return {
"rows": res.data.rows,
"total": res.data.count
};
} else {
msg_no_200('[' + res.code + ']' + res.message);
return false;
}
},
columns:[
[
{field: 'uid', title: '经纪商UID', valign:"middle", align:"center"},
{field: 'username', title: '经纪商账号', valign:"middle", align:"center"},
{field: 'company', title: '经纪商名称', valign:"middle", align:"center"},
{field: 'platkey', title: '平台标识', valign:"middle", align:"center"},
{field: 'platcode', title: '平台识别码', valign:"middle", align:"center"},
{field: 'rebate', title: '返佣比例%', valign:"middle", align:"center"},
{field: 'area', title: '所在地区', valign:"middle", align:"center"},
{field: 'contacts', title: '联系人', valign:"middle", align:"center"},
{field: 'mobile', title: '手机号', valign:"middle", align:"center"},
{field: 'other', title: '其他联系方式', valign:"middle", align:"center"},
{field: 'addtime', title: '添加时间', valign:"middle", align:"center"},
{field: 'user_num', title: '客户数量', valign:"middle", align:"center"},
{
field: 'status', title: '状态', valign:"middle", align:"center",
formatter: function(a) {return a==1?"<span style='color: #24a948'>正常</span>":"<span style='color: #9e9e9e'>不可用</span>";}
},
{
title: '操作', valign:"middle", align:"center",
formatter: function(uid, row) {
if (row.status == 1) {
return [
'<a href="javascript:void(0)" onclick="editRow('+row.uid+', this)">修改</a>',
'&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" style="color: #e64544" onclick="deleteRow('+row.uid+', this)">删除</a>'
].join('');
} else {
return '';
}
}
}
]
]
});
});
/**
* 修改返佣比例
*/
var editRow=function(uid) {
var row = $("#table1").bootstrapTable("getRowByUniqueId", uid);
var tip = row.company!==null?row.company:('('+uid+')');
var index=layer.open({
type: 1
,title: '修改返佣比例'
,id: 'edit-row'
,area : ['280px', 'auto']
,skin: 'layui-layer-myBlue'
,content: '<div style="padding: 5px 20px;">\n' +
' <p style="text-align: left"><b> '+tip+'</b></p>' +
' <div class="input-group my-group">'+
' <span class="input-group-addon">返佣比例 </span>\n' +
' <input id="edit_row" type="number" class="form-control">\n' +
' <span class="input-group-addon">%</span>\n' +
' </div>\n'+
'</div>'
,btn: ['确认', '取消']
,btn1: function() {
v=$('#edit_row').val();
if(!isNaN(v) && v!==""){
$btn = $('.layui-layer-btn0').button('loading');
$.ajax({
url: url_updateRate,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {uid:uid,rebate:v},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
layer.close(index);
query(1);
} else {
msg_no_200(res.message);
}
},
error: server_error
});
$btn.button('reset');
} else{
layer.msg("输入有误");
}
return false;
}
,btn2: function(){
layer.close(index);
}
});
return true;
};
/**
* 删除
*/
var deleteRow=function(uid) {
var row = $("#table1").bootstrapTable("getRowByUniqueId", uid);
var tip = row.company!==null?row.company:('('+uid+')');
var title='确认删除 <span style="color: red">'+tip+'</span> ?<br>' +
'<span style="font-size: 10px;color: #9E9E9E">说明:未删除,仅转为不可用状态</span>';
var index=layer.confirm(title, {
title: '删除提示',
skin: 'layui-layer-myRed',
btn: ['确认','取消']
}, function(){
$btn = $('.layui-layer-btn0').button('loading');
$.ajax({
url: url_updateRate,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {uid:uid,status:"-1",operation:"status"},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
layer.close(index);
query(1);
} else {
msg_no_200(res.message);
}
},
error: server_error
});
$btn.button('reset');
query(1);
}, function(){
layer.close(index);
});
};
/**
* 经纪商预购兑出
* libingke
* 2018/01/08
*/
/**
* 表单
* @type {{start: null, end: null, statu: null, account: null}}
*/
var form1 = {
start:null,
end:null,
statu:null,//出金记录状态
account:null//用户编号
};
/**
* 范围日期
*/
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#date_range'
,range: ':'
,done: function(value, date, endDate){
$('#date_range').val(value);
query(1);
}
});
});
function typeFormatter(t) {
switch (t)
{
case '0':s='预购';break;
case '1':s='兑出';break;
default: s=t;
}
return s;
}
/**
* 初始化表格
*/
$(function () {
$("#table1").bootstrapTable({
method: 'post',
url: url_table1,
queryParams: function (params) {
form1.account =$("#search").val();
if ($("#date_range").val()==='') {
form1.start=null;
form1.end=null;
} else {
var value=$("#date_range").val();
var t=value.split(' : ', 2);
form1.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
form1.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
form1.page = params.pageNumber;
form1.size = params.pageSize;
return form1;
},
pageSize: 20,
uniqueId: 'id',
/* 接口返回结果适配 */
responseHandler: function (res) {
if (res.code == 200) {
if (res.data.statis) {
var str = "<p style='color: #24a948'>共: <b>"+res.data.statis.in_count+"</b> 条充值信息<br>" +
"充入: <b>"+res.data.statis.in_cny+"</b> CNY ≈ <b>"+res.data.statis.in_usdt+"</b> USDT</p>" +
"<p style='color: #e64544'>共: <b>"+res.data.statis.out_count+"</b> 条提款信息<br>" +
"提款: <b>"+res.data.statis.out_cny+"</b> CNY ≈ <b>"+res.data.statis.out_usdt+"</b> USDT</p>";
$('#tip1').html(str);
}
return {
"rows": res.data.list,
"total": res.data.total
};
} else {
layer.msg('[' + res.code + ']' + res.message);
return false;
}
},
columns:[
{field: 'id', title: '流水编号', valign:"left", align:"center"},
{field: 'uid', title: 'UID', valign:"middle", align:"center"},
{field: 'type', title: '类型', valign:"middle", align:"center", formatter: typeFormatter},
{field: 'platkey', title: '公司标识', valign:"middle", align:"center"},
{field: 'usdt_amount', title: 'USDT数量', valign:"middle", align:"center"},
{field: 'rate', title: '兑换比例', valign:"middle", align:"center"},
{field: 'amount', title: '总金额', valign:"middle", align:"center"},
{field: 'statusMark', title: '申请状态', valign:"middle", align:"center"},
{field: 'addtime', title: '申请时间', valign:"middle", align:"center"},
{field: 'dealtime', title: '处理时间', valign:"middle", align:"center"}
]
});
});
/**
* 回车触发
*/
$('#search').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
\ No newline at end of file
/**
* 经纪商管理页面
* libingke
* 2018/01/05
*/
/**
* @type {{start: null, end: null, currency: null, search: null}}
*/
var form1 = {
start:null,//开始时间(格式:2018-01)
end:null,//结束时间(格式:2018-01)
currency:null,//币种
search:null//搜索条件(uid,经纪商名称)
};
var form2 = {
start:null,
end:null,
currency:null,
search:null
};
/**
* 范围日期
*/
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#month_range1',
type: 'month',
range: '~',
done: function(value, date, endDate){
$('#month_range1').val(value);
query(1);
}
});
laydate.render({
elem: '#month_range2',
type: 'month',
range: '~',
done: function(value, date, endDate){
$('#month_range2').val(value);
query(2);
}
});
});
/**
* 历史返佣导出
* libingke
* 2018/01/08
*/
function exportTable2() {
var data = {};
data.search=$("#search2").val();
if ($("#month_range2").val()!=='') {
var value=$("#month_range2").val();
var t=value.split(' ~ ', 2);
data.start=t[0];
data.end=t[1];
}
$.ajax({
url: url_export2,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: data,
dataType: 'json',
success: function (res) {
if (res.code == 200 && res.data.url) {
window.location.href = res.data.url;
} else {
msg_no_200('导出失败:' + res.message);
}
},
error: server_error
});
}
/**
* 初始化表格
*/
$(function () {
$("#table1").bootstrapTable({
method: 'post',
url: url_table1,
queryParams: function (params) {
form1.search=$("#search1").val();
if ($("#month_range1").val()==='') {
form1.start=null;
form1.end=null;
} else {
var value=$("#month_range1").val();
var t=value.split(' ~ ', 2);
form1.start=t[0];
form1.end=t[1];
}
form1.page = params.pageNumber;
form1.size = params.pageSize;
return form1;
},
pageSize: 15,
uniqueId: 'id',
/* 接口返回结果适配 */
responseHandler: function (res) {
if (res.code == 200) {
if (res.data.record) {
var str = '<br><span style="color: #e7505a"><b>待返手续费</b></span>:';
$.each(res.data.record, function(index, value, array) {
if (value >= 0)
str+="<span> <b>"+value+"</b> "+index+"</span> , ";
});
$('#tip1').html(str);
}
return {
"rows": res.data.rows,
"total": res.data.count
};
} else {
msg_no_200('[' + res.code + ']' + res.message);
return false;
}
},
columns:[
{field: 'date', title: '月份', valign:"middle", align:"center"},
{field: 'uid', title: 'UID', valign:"middle", align:"center"},
{field: 'name', title: '经纪商名称', valign:"middle", align:"center"},
{field: 'currency', title: '币种', valign:"middle", align:"center"},
{field: 'charge', title: '手续费', valign:"middle", align:"center"},
{field: 'amount', title: '应返数量', valign:"middle", align:"center"},
{
field: 'id', title: '操作', valign:"middle", align:"center",
formatter: function(id, row) {
return '<a href="javascript:void(0)" onclick="optRow('+id+', this)">佣金结算</a>';
}
}
]
});
$("#table2").bootstrapTable({
method: 'post',
url: url_table2,
queryParams: function (params) {
form2.search=$("#search2").val();
if ($("#month_range2").val()==='') {
form2.start=null;
form2.end=null;
} else {
var value=$("#month_range2").val();
var t=value.split(' ~ ', 2);
form2.start=t[0];
form2.end=t[1];
}
form2.page = params.pageNumber;
form2.size = params.pageSize;
return form2;
},
pageSize: 15,
/* 接口返回结果适配 */
responseHandler: function (res) {
if (res.code == 200) {
return {
"rows": res.data.rows,
"total": res.data.count
};
} else {
msg_no_200('[' + res.code + ']' + res.message);
return false;
}
},
columns:[
{field: 'date', title: '月份', valign:"middle", align:"center"},
{field: 'uid', title: 'UID', valign:"middle", align:"center"},
{field: 'name', title: '经纪商名称', valign:"middle", align:"center"},
{field: 'currency', title: '币种', valign:"middle", align:"center"},
{field: 'charge', title: '手续费', valign:"middle", align:"center"},
{field: 'amount', title: '返还', valign:"middle", align:"center"},
{field: 'real_amount', title: '实际返还', valign:"middle", align:"center"}
]
});
});
function optRow(a,that) {
row = $("#table1").bootstrapTable("getRowByUniqueId", a);
tip = row.name!==null?row.name:('('+a+')');
var index=layer.open({
type: 1
,title: '佣金结算'
,id: 'opt-row'
,area : ['280px', 'auto']
,skin: 'layui-layer-myBlue'
,content: '<div style="padding: 5px 20px;">\n' +
' <p style="text-align: left">经纪商: <span style="color: #333"><b>'+tip+'</b></span></p>' +
' <div class="input-group my-group">'+
' <span class="input-group-addon">结算币种 </span>\n' +
' <input type="text" class="form-control" value="'+(row.currency!=null?row.currency:'')+'" disabled="disabled">\n' +
' </div>\n'+
' <div class="input-group my-group">'+
' <span class="input-group-addon">实际返还 </span>\n' +
' <input id="amount" type="number" class="form-control" value="'+(row.amount!=null?row.amount:0)+'">\n' +
' </div>\n'+
'</div>'
,btn: ['确认', '取消']
,btn1: function(t,a,c) {
v1=$('#amount').val();
if(!isNaN(v1) && v1!==""){
$btn = $('.layui-layer-btn0').button('loading');
$.ajax({
url: url_update,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {id:row.id,uid:row.uid,amount:v1},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
layer.close(index);
query(1);
query(2);
} else {
msg_no_200(res.message);
}
},
error: server_error
});
$btn.button('reset');
} else{
layer.msg("输入不合法");
}
return false;
}
,btn2: function(){
layer.closeAll();
}
});
}
/**
* 回车触发
*/
$('#search1').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
$('#search2').bind('keypress', function(event) {
if(event.keyCode == "13")
query(2,1);
});
\ No newline at end of file
/**
* 云矿机:矿机成员
* libingke
* 2018/05/09
*/
/**
* 表单
* @type {{start_time: null, end_time: null, user_id: null, pool_id: null, inviter: null}}
*/
var form1 = {
start_time:null,
end_time:null,
user_id:null,
pool_id:null,
inviter:null
};
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#date_range',
//type: 'datetime',
range: '~',
done: function(value, date, endDate){
$('#date_range').val(value);
query(1);
}
});
});
$(function () {
$('input').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
var responseHandler = function (res) {
if (res.message !== '') {
msg_no_200(res.message);
return false;
}
if (res.response.code != 200) {
msg_no_200("[" + res.response.code + "] " + res.response.message);
console.log(res)
return false;
}
return {
"rows": res.response.data.rows,
"total": res.response.data.count
};
};
/**
* 初始化表格
*/
$("#table1").bootstrapTable({
queryParams: function (params) {
$date_range = $("#date_range");
$pool_id = $('form#form1 input[name="pool_id"]');
form1.pool_id=$.trim($pool_id.val());
form1.user_id=$.trim($('form#form1 input[name="user_id"]').val());
form1.inviter=$.trim($('form#form1 input[name="inviter"]').val());
if ($date_range.val()==='') {
form1.start_time=null;
form1.end_time=null;
} else {
var value=$date_range.val();
var t=value.split(' ~ ', 2);
form1.start_time=t[0] + ' 00:00:00';
form1.end_time=t[1] + ' 23:59:59';
}
form1.page = params.pageNumber;
form1.page_size = params.pageSize;
$pool_id.val(form1.pool_id);
//obj
api_type = 'get';
return {
'type': api_type,
'url': url_table1,
'headers': getMinerHeaders(url_key, api_type),
'query': form1
};
},
pageSize: 20,
responseHandler: responseHandler,
onDblClickRow: function (row) {
//copyText(row.pool_id);
},
columns:[
{field: 'pool.friendly_id', title: '编号', valign: "middle", align: "center"},
{field: 'miner.pool_id', title: '矿池编号', valign: "middle", align: "center"},
{field: 'miner.id', title: '矿机编号', valign: "middle", align: "center"},
{field: 'miner.user_id', title: '购买人UID', valign: "middle", align: "center"},
{field: 'miner.inviter', title: '推荐人UID', valign: "middle", align: "center"},
{
field: 'miner.created_at', title: '购买时间', valign: "middle", align: "center",
formatter: function (v) {return UnixToDate(DateToUnix(v));}
}
]
});
});
\ No newline at end of file
/**
* 云矿机:矿机管理
* libingke
* 2018/05/09
*/
/**
* 表单
* @type {{start_time: null, end_time: null, type: null, status: null}}
*/
var form1 = {
start_time:null,
end_time:null,
type:null,
status:null
};
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#date_range',
//type: 'datetime',
range: '~',
done: function(value, date, endDate){
$('#date_range').val(value);
query(1);
}
});
});
$(function () {
$('input').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
$(".select1").bind("change",function(){ query(1); });
var responseHandler = function (res) {
if (res.message !== '') {
msg_no_200(res.message);
return false;
}
if (res.response.code != 200) {
msg_no_200("[" + res.response.code + "] " + res.response.message);
console.log(res)
return false;
}
return {
"rows": res.response.data.rows,
"total": res.response.data.count
};
};
/**
* 初始化表格
*/
$("#table1").bootstrapTable({
queryParams: function (params) {
$date_range = $("#date_range");
form1.type=$('form#form1 select[name="type"]').val();
form1.status=$('form#form1 select[name="status"]').val();
if ($date_range.val()==='') {
form1.start_time=null;
form1.end_time=null;
} else {
var value=$date_range.val();
var t=value.split(' ~ ', 2);
form1.start_time=t[0] + ' 00:00:00';
form1.end_time=t[1] + ' 23:59:59';
}
form1.page = params.pageNumber;
form1.page_size = params.pageSize;
//obj
api_type = 'get';
return {
'type': api_type,
'url': url_table1,
'headers': getMinerHeaders(url_key, api_type),
'query': form1
};
},
pageSize: 20,
responseHandler: responseHandler,
onDblClickRow: function (row) {
//copyText(row.pool_id);
},
columns:[
{field: 'id', title: '矿机编号', valign: "middle", align: "center"},
{
field: 'type', title: '矿机类型', valign: "middle", align: "center",
formatter: function (v) {
switch (v)
{
case 1: $t = '新手标';break;
case 2: $t = '标准矿机';break;
case 3: $t = '限购矿机';break;
default: $t = '';
}
return $t;
}
},
{field: 'name', title: '矿机名称', valign: "middle", align: "center"},
{field: 'miner_coin', title: '单位赠币', valign: "middle", align: "center"},
{field: 'basic_yield', title: '基本币量', valign: "middle", align: "center"},
{field: 'presented_yield', title: '赠送币量', valign: "middle", align: "center"},
{field: 'duration', title: '矿机周期(天)', valign: "middle", align: "center"},
{field: 'sold', title: '已售矿机', valign: "middle", align: "center"},
{
field: 'created_at', title: '添加时间', valign: "middle", align: "center",
formatter: function (v) { return UnixToDate(DateToUnix(v));}
},
{
field: 'status', title: '状态', valign: "middle", align: "center",
formatter: function (v) {
switch (v)
{
case 1: $t = '<span style="color: #808080">下线</span>';break;
case 2: $t = '<span style="color: green">上线</span>';break;
case 100: $t = '<span style="color: red">已删除</span>';break;
default: $t = '';
}
return $t;
}
},
{
field: 'status', title: '操作', valign:"middle", align:"left",
formatter: function (v, k) {
kid = k.id;
switch (v)
{
case 1://glyphicon glyphicon-chevron-up
$t = '<a onclick="opt.editRow.init(\''+kid+'\')" title="编辑"><span class="glyphicon glyphicon-edit"></a>&nbsp;&nbsp;'
+ '<a onclick="opt.viewRow.init(\''+kid+'\')" title="查看"><span style="color: #67809f" class="glyphicon glyphicon-eye-open"></span></a>&nbsp;&nbsp;'
+ '<a onclick="opt.setOnLine.init(\''+kid+'\')" title="上线"><span style="color: #f36a5a" class="glyphicon glyphicon-chevron-up"></a>&nbsp;&nbsp;&nbsp;'
+ '<a onclick="opt.deleteRow.init(\''+kid+'\')" title="删除"><span style="color: #c5535a" class="glyphicon glyphicon-trash"></a>';
break;
case 2:
$t = '<a onclick="opt.editRow.init(\''+kid+'\')" title="编辑"><span class="glyphicon glyphicon-edit"></a></a>&nbsp;&nbsp;'
+ '<a onclick="opt.viewRow.init(\''+kid+'\')" title="查看"><span style="color: #67809f" class="glyphicon glyphicon-eye-open"></span></a>&nbsp;&nbsp;'
+ '<a onclick="opt.setOffLine.init(\''+kid+'\')" title="下线"><span style="color: gray" class="glyphicon glyphicon-chevron-down"></a>&nbsp;&nbsp;&nbsp;'
+ '<a onclick="opt.deleteRow.init(\''+kid+'\')" title="删除"><span style="color: #c5535a" class="glyphicon glyphicon-trash"></a>';
break;
//case 100:$t = '';break;
default: $t = '';
}
return $t;
}
}
]
});
});
/**
* 操作中心
*/
var opt = {
_key: url_key,
_config: {
info:{url: url_info, type: 'get'},
edit:{url: url_edit, type: 'post'},
delete:{url: url_delete, type: 'post'},
online:{url: url_online, type: 'post'},
offline:{url: url_offline, type: 'post'},
},
ajax: function (data, callback) {
$.ajax({
url: "/admin/public/ajax?case=miner_query",
type: 'POST',
data: data,
dataType: 'json',
success: function (res) {
if (res.message !== '') {
msg_no_200(res.message);
return false;
}
if (res.response.code != 200) {
msg_no_200("[" + res.response.code + "] " + res.response.message);
return false;
}
if ((callback && typeof(callback)==="function")) {
callback(res.response);
} else {
msg_no_200("回调显示错误");
}
},
error: server_error
});
},
//编辑行
editRow: {
init: function(kid) {
opt.ajax({
type: opt._config.info.type,
url: opt._config.info.url,
headers: getMinerHeaders(opt._key, opt._config.info.type),
query: {id:kid}
}, this.render);
},
render: function (ret) {
str = ret.data;
opt.openRow(str, 'edit');
//渲染时间插件
layui.laydate.render({
elem: '.timer' //指定元素
,type: 'datetime'
,value: str.online_time === null ? null : new Date(str.online_time * 1000)
});
$(".select-type option[value= '"+str.type+"']").attr("selected","selected");
$(".select-lv option[value= '"+str.class+"']").attr("selected","selected");
},
after: function (ret) {
msg_200(ret.message);
query(1)
}
},
//查看行
viewRow: {
init: function(kid) {
opt.ajax({
type: opt._config.info.type,
url: opt._config.info.url,
headers: getMinerHeaders(opt._key, opt._config.info.type),
query: {id:kid}
}, this.after);
},
after: function (ret) {
str = ret.data;
opt.openRow(str, 'view');
$(".select-type option[value= '"+str.type+"']").attr("selected","selected");
$(".select-lv option[value= '"+str.class+"']").attr("selected","selected");
}
},
//删除行
deleteRow: {
init: function(kid) {
that=this;
s=[{name:'id', value:kid}];
index=layer.confirm('确认删除?', {
skin: 'layui-layer-myRed'
}, function(index){
opt.ajax({
type: opt._config.delete.type,
url: opt._config.delete.url,
headers: getMinerHeaders(opt._key, opt._config.delete.type, s),
data: s
}, that.after);
layer.close(index);
});
},
after: function (ret) {
msg_200(ret.message);
query(1)
}
},
//上线
setOnLine: {
init: function(kid) {
that=this;
s=[{name:'id', value:kid}];
index=layer.confirm('确认上线?', {
skin: 'layui-layer-myBlue'
}, function(index){
opt.ajax({
type: opt._config.online.type,
url: opt._config.online.url,
headers: getMinerHeaders(opt._key, opt._config.online.type, s),
data: s
}, that.after);
layer.close(index);
});
},
after: function (ret) {
msg_200(ret.message);
query(1)
}
},
//下线
setOffLine: {
init: function(kid) {
that=this;
s=[{name:'id', value:kid}];
index=layer.confirm('确认下线?', {
skin: 'layui-layer-myGray'
}, function(index){
opt.ajax({
type: opt._config.offline.type,
url: opt._config.offline.url,
headers: getMinerHeaders(opt._key, opt._config.offline.type, s),
data: s
}, that.after);
layer.close(index);
});
},
after: function (ret) {
msg_200(ret.message);
query(1)
}
},
//显示行
openRow: function (str, type) {
var lv = '';
str.duration = typeof(str.duration) === 'undefined' ? '' : str.duration/86400;
for (var i=1; i <= 10; i++) {
lv += '<option value='+i+'>'+i+'</option>'
}
add_style=type==='view'?' disabled ':'';
html = '<div class="layui-row edit" style="padding:5px 40px 0 40px">'+
'<form id="edit_form" class="layui-form-item" action="javascript:void(0)" method="post">'+
'<input type="hidden" name="id" value='+str.id+'>'+
'<div class="layui-unselect layui-form-select">'+
'<label class="my-label">矿机类型</label>'+
'<div class="layui-input-block">'+
'<select'+add_style+' class="my-select select-type" name="type"> <option value="1">新手标</option> <option value="2">标准矿机</option> <option value="3">限购矿机</option> </select>'+
'</div></div>'+
'<div class="layui-form-item">'+
'<label class="my-label">矿机名称</label>'+
'<div class="layui-input-block">'+
'<input'+add_style+' class="my-input" type="text" name="name" required lay-verify="required" placeholder="" autocomplete="off" value='+str.name+'>'+
'</div></div>'+
'<div class="layui-form-item">'+
'<label class="my-label">名称缩写</label>'+
'<div class="layui-input-block">'+
'<input'+add_style+' class="my-input" type="text" name="abbreviation" required lay-verify="required" placeholder="" autocomplete="off" value='+str.abbreviation+'>'+
'</div></div>'+
'<div class="layui-form-item">'+
'<label class="my-label">矿机等级</label>'+
'<div class="layui-input-block"><select'+add_style+' class="my-select select-lv" name="class">'+lv+ '</select></div> </div>'+
'<div class="layui-form-item">'+
'<label class="my-label">矿机数量</label>'+
'<div class="layui-input-block">'+
'<input'+add_style+' class="my-input" type="text" name="miner_count" required lay-verify="required" placeholder="" autocomplete="off" value='+str.miner_count+'>'+
'</div></div>'+
'<div class="layui-form-item">'+
'<label class="my-label">每台价格</label>'+
'<div class="layui-input-block">'+
'<input'+add_style+' class="my-input" type="text" name="miner_amount" required lay-verify="required" placeholder="" autocomplete="off" value='+str.miner_amount+'>'+
'</div></div>'+
'<div class="layui-form-item">'+
'<label class="my-label">基本币量</label>'+
'<div class="layui-input-block">'+
'<input'+add_style+' class="my-input" type="text" name="basic_yield" required lay-verify="required" placeholder="" autocomplete="off" value='+str.basic_yield +'>'+
'</div> </div>'+
'<div class="layui-form-item">'+
'<label class="my-label">赠送币量</label>'+
'<div class="layui-input-block">'+
'<input'+add_style+' class="my-input" type="text" name="presented_yield" required lay-verify="required" placeholder="" autocomplete="off" value='+str.presented_yield +'>'+
'</div></div>'+
'<div class="layui-form-item">'+
'<label class="my-label">期限(天)</label>'+
'<div class="layui-input-block">'+
'<input type="hidden" id="duration" name="duration" value="">'+
'<input'+add_style+' class="my-input" type="text" id="duration-data" required lay-verify="required" placeholder="天" autocomplete="off" value='+str.duration +'>'+
'</div></div>'+
'<div class="layui-form-item">'+
'<label class="my-label">发放日期</label>'+
'<div class="layui-input-block">'+
'<input type="hidden" id="online_time" name="online_time" value="'+str.online_time+'">'+
'<input'+add_style+' class="my-input timer" type="text" id="online_time-data" placeholder="" autocomplete="off">'+
'</div> </div>'+
'<div class="layui-form-item">'+
'<label class="my-label">发放数量</label>'+
'<div class="layui-input-block">'+
'<input'+add_style+' class="my-input" type="text" name="quantity" required lay-verify="required" placeholder="个" autocomplete="off" value='+str.quantity +'>'+
'</div></div>'+
'<div class="layui-form-item">'+
'<label class="my-label">发起人起购份数</label>'+
'<div class="layui-input-block">'+
'<input'+add_style+' class="my-input" style="width:98%" type="text" name="initiator_miner_limit" required lay-verify="required" placeholder="个" autocomplete="off" value='+str.initiator_miner_limit +'>'+
'</div> </div>'+
'<div class="layui-form-item">'+
'<label class="my-label">年化收益</label>'+
'<div class="layui-input-block">'+
'<input'+add_style+' class="my-input" type="text" name="annual_yield" required lay-verify="required" placeholder="个" autocomplete="off" value='+str.annual_yield +'>'+
'</div></div>'+
'<div class="layui-form-item">'+
'<label class="my-label">单位赠币</label>'+
'<div class="layui-input-block">'+
'<input'+add_style+' class="my-input" type="text" name="miner_coin" required lay-verify="required" placeholder="个" autocomplete="off" value='+str.miner_coin +'>'+
'</div> </div>'+
'<div class="layui-form-item layui-form-text">'+
'<label class="my-label">矿机介绍</label>'+
'<div class="layui-input-block">'+
'<textarea'+add_style+' name="presentation" placeholder="请输入内容" class="layui-textarea">'+str.presentation+'</textarea>'+
'</div> </div><br>'+
'<div class="layui-form-item layui-form-text">'+
'<label class="my-label">交易须知</label>'+
'<div class="layui-input-block">'+
'<textarea'+add_style+' name="trade_information" placeholder="请输入内容" class="layui-textarea">'+str.trade_information+'</textarea>'+
'</div> </div>'+
'</form> </div>';
if (type === 'edit') {
open = layer.open({
type: 1,
content: html,
id: 'edit-row-open'+str.id,
skin: 'layui-layer-myBlue-big',
title: '编辑矿机信息',
scrollbar: false,
area: '680px',
btn: ['立即提交', '取消'],
btnAlign: 'c',
btn1: function() {
duration = $('#duration-data').val();
duration = duration%1 === 0 ? duration*86400 : 0;
$('#duration').val(duration);
online_time = $('#online_time-data').val();
if (online_time==='null' || online_time==='') {//online_time为空时无法签名,所以无法设置为空
//online_time = '';
$('#online_time').remove();
} else {
temp = new Date(online_time).getTime();
online_time = isNaN(temp) ? '' : temp/1000;
$('#online_time').val(online_time);
}
postData = $('#edit_form').serializeArray();
opt.ajax({
type: opt._config.edit.type,
url: opt._config.edit.url,
headers: getMinerHeaders(opt._key, opt._config.edit.type, postData),
data: postData
}, opt.editRow.after);
layer.close(open);
}
});
} else if (type === 'view') {
open = layer.open({
type: 1,
content: html,
id: 'view-row-open'+str.id,
skin: 'layui-layer-myGray-big',
title: '查看矿机信息',
scrollbar: false,
area: '680px',
btn: ['关闭']
});
text=$('textarea');
text.attr("style", "min-height:80px");
text.attr("style", "max-height:100px");
}
}
};
\ No newline at end of file
/**
* 云矿机:矿机购买记录
* libingke
* 2018/05/08
*/
/**
* 表单
* @type {{start_time: null, end_time: null, type: null, status: null, pool_id: null, user_id: null, inviter: null}}
*/
var form1 = {
start_time:null,
end_time:null,
pool_id:null,
type:null,
status:null,
user_id:null,
inviter:null //推荐人
};
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#date_range1',
//type: 'datetime',
range: '~',
done: function(value, date, endDate){
$('#date_range1').val(value);
query(1);
}
});
});
$(function () {
$('input').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
$(".select1").bind("change",function(){ query(1); });
var responseHandler= function (res) {
if (res.message !== '') {
msg_no_200(res.message);
return false;
}
if (res.response.code != 200) {
msg_no_200("[" + res.response.code + "] " + res.response.message);
console.log(res)
return false;
}
return {
"rows": res.response.data.rows,
"total": res.response.data.count
};
};
/**
* 初始化表格
*/
$("#table1").bootstrapTable({
queryParams: function (params) {
form1.pool_id=$.trim($('form#form1 input[name="pool_id"]').val());
form1.user_id=$.trim($('form#form1 input[name="user_id"]').val());
form1.inviter=$.trim($('form#form1 input[name="inviter"]').val());
form1.type=$('form#form1 select[name="type"]').val();
form1.status=$('form#form1 select[name="status"]').val();
if ($("#date_range1").val()==='') {
form1.start_time=null;
form1.end_time=null;
} else {
var value=$("#date_range1").val();
var t=value.split(' ~ ', 2);
form1.start_time=t[0] + ' 00:00:00';
form1.end_time=t[1] + ' 23:59:59';
}
form1.page = params.pageNumber;
form1.page_size = params.pageSize;
$('form#form1 input[name="pool_id"]').val(form1.pool_id);
//obj
api_type = 'get';
return {
'type': api_type,
'url': url_table1,
'headers': getMinerHeaders(url_key, api_type, ''),
'query': form1
};
},
pageSize: 20,
uniqueId: 'id',
/* 接口返回结果适配 */
responseHandler: responseHandler,
/* 复制矿池编号 */
onDblClickRow: function (row) {
//copyText(row.pool_id);
},
columns:[
{field: 'id', title: '订单号', valign: "middle", align: "center"},
{field: 'pool_id', title: '矿池编号', valign: "middle", align: "center"},
{field: 'user_id', title: '下单uid', valign: "middle", align: "center"},
{field: 'quantity', title: '购买份额', valign: "middle", align: "center"},
{field: 'amount', title: '购买费用', valign: "middle", align: "center"},
{field: 'inviter', title: '推荐人uid', valign: "middle", align: "center"},
{
field: 'type', title: '类型', valign: "middle", align: "center",
formatter: function (v) {
switch (v)
{
case 1: $t = '<span style="color: #a74e4b">自购成为发起者</span>';break;
case 2: $t = '<span style="color: #FF7E00">自购成为参与者</span>';break;
case 3: $t = '<span style="color: #21a799">代购成为发起者</span>';break;
case 4: $t = '<span style="color: #111">代购成为参与者</span>';break;
default: $t = '';
}
return $t;
}
},
{field: 'mobile', title: '付款账号', valign: "middle", align: "center"},
{
field: 'order_at', title: '下单时间|付款时间|取消时间', valign: "middle", align: "center",
formatter: function (v, k) {
str = '下单:' + (k.order_at ? UnixToDate(k.order_at) : '');
if (k.payment_at) {
str += '<br>付款:' + UnixToDate(k.payment_at);
}
if (k.revoke_at) {
str+='<br>取消:' + UnixToDate(k.revoke_at);
}
return str;
}
},
{
field: 'status', title: '状态', valign: "middle", align: "center",
formatter: function (v) {
switch (v)
{
case 1: $t = '待支付';break;
case 2: $t = '已支付';break;
case 3: $t = '用户撤单';break;
case 4: $t = '代买用户撤单';break;
case 5: $t = '管理员撤单';break;
case 6: $t = '超时';break;
default: $t = '';
}
return $t;
}
},
{
field: 'name', title: '矿机所属账号', valign: "middle", align: "center",
formatter: function (v, k) {
str = k.name + '<b style="color: #5fb6b7">|</b>'
+ k.id_number_last_six + '<b style="color: #5fb6b7">|</b>'
+ k.mobile;
return str;
}
},
{field: 'agent_id', title: '代理人ID', valign: "middle", align: "center"}
]
});
});
\ No newline at end of file
/**
* 云矿机:矿池份额
* libingke
* 2018/05/09
*/
/**
* 表单
* @type {{start_time: null, end_time: null, user_id: null, id: null, sort: null}}
*/
var form1 = {
start_time:null,
end_time:null,
user_id:null,
id:null, //pool_id
sort:null
};
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#date_range',
//type: 'datetime',
range: '~',
done: function(value, date, endDate){
$('#date_range').val(value);
query(1);
}
});
});
var sortFunc= {
init: function () {
form1.sort = null;
$sort = $('#sort-expires');
$sort.attr('class', '');
},
sort: function (id) {
$id = $('#'+id);
val = $id.data('sort');
if(val.indexOf("-") > -1){
$id.attr('class', 'asc');
newVal = val.substr(1);
} else {
$id.attr('class', 'desc');
newVal = '-' + val;
}
$id.data('sort', newVal);
form1.sort = newVal;
query(1);
}
};
$(function () {
$('input').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
//$(".select1").bind("change",function(){ query(1); });
var responseHandler = function (res) {
if (res.message !== '') {
msg_no_200(res.message);
return false;
}
if (res.response.code != 200) {
msg_no_200("[" + res.response.code + "] " + res.response.message);
console.log(res)
return false;
}
return {
"rows": res.response.data.rows,
"total": res.response.data.count
};
};
/**
* 初始化表格
*/
$("#table1").bootstrapTable({
queryParams: function (params) {
$date_range = $("#date_range");
$pool_id = $('form#form1 input[name="pool_id"]');
form1.id=$.trim($pool_id.val());
form1.user_id=$.trim($('form#form1 input[name="user_id"]').val());
if ($date_range.val()==='') {
form1.start_time=null;
form1.end_time=null;
} else {
var value=$date_range.val();
var t=value.split(' ~ ', 2);
form1.start_time=t[0] + ' 00:00:00';
form1.end_time=t[1] + ' 23:59:59';
}
form1.page = params.pageNumber;
form1.page_size = params.pageSize;
$pool_id.val(form1.id);
//obj
api_type = 'get';
return {
'type': api_type,
'url': url_table1,
'headers': getMinerHeaders(url_key, api_type),
'query': form1
};
},
pageSize: 20,
responseHandler: responseHandler,
onDblClickRow: function (row) {
//copyText(row.pool_id);
},
columns:[
{field: 'friendly_id', title: '编号', valign: "middle", align: "center"},
{field: 'id', title: '矿池编号', valign: "middle", align: "center"},
{field: 'sold', title: '已售台数', valign: "middle", align: "center"},
{field: 'miner_count', title: '总台数', valign: "middle", align: "center"},
{field: 'user_id', title: '发起人ID', valign: "middle", align: "center"},
{
field: 'created_at', title: '创建时间', valign: "middle", align: "center",
formatter: function (v) {return UnixToDate(DateToUnix(v));}
},
{
field: 'expires', title: '<a id="sort-expires" onclick="sortFunc.sort(\'sort-expires\')" class="" href="javascript:void(0)" data-sort="expires">过期时间</a>',
valign: "middle", align: "center", sortable : true,
formatter: function (v) {return UnixToDate(v);}
}
]
});
});
\ No newline at end of file
/**
* 用户管理:人工认证
* libingke
* 2018/01/11
*/
$('#hid').bind('keypress', function(event) {
if(event.keyCode == "13") {
getIdentityStatus(this);
}
});
var uploadPic=function(formData, id) {
if (id == 1) {
layer.msg('模拟身份证正面照(A),正式上线后关闭!', {anim: 3});
$('#s1').attr('src', 'https://images.33.cn/upload/zhaobi/20171208/2017120816131835754951_water.jpg');
$('#mid').val('2017120814572509960875');
} else {
layer.msg('模拟手持证件照(B),正式上线后关闭!', {anim: 3});
$('#s2').attr('src', "https://images.33.cn/upload/zhaobi/20171208/2017120814572509960875_water.jpg");
$('#matchmid').val('2017120816131835754951');
}
return 1;
$.ajax({
url: 'https://oss.33.cn/upload/certificate',
type: 'POST',
headers: {'FZM-Ca-AppKey': "zhaobi"},
cache: false,
data: formData,
processData: false,
contentType: false,
success: function (res) {
if (res.code == 200) {
if (id == 1) {
$('#mid').val(res.data.mid);
$('#s1').attr('src', res.data.thumbImage);
} else {
$('#matchmid').val(res.data.mid);
$('#s2').attr('src', res.data.thumbImage);
}
} else {
layer.msg(res.message, {anim: 4});
var tryAgain = $('#try'+id);
tryAgain.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini try-reload'+id+'">重试</a>');
tryAgain.find('.try-reload'+id).on('click', function(){
uploadPic(formData, id);
});
}
},
error: function () {
layer.msg('上传认证接口出错!', {anim: 4});
}
});
};
layui.use('upload', function() {
var $ = layui.jquery, upload = layui.upload;
upload.render({
elem: '#p1',
url: '##',
size: 600,
auto: false,
exts: 'jpg|jpeg|gif|png|bmp',
choose: function(res){
res.preview(function(index, file, result){
$('#s1').attr('src', result);
var formData = new FormData();
formData.append('idtype', 1);
formData.append('myfile', file);
formData.append('token', getUploadToken());
uploadPic(formData, 1);
});
}
});
upload.render({
elem: '#p2',
url: '##',
size: 600,
auto: false,
exts: 'jpg|jpeg|gif|png|bmp',
before: function(obj){
obj.preview(function(index, file, result){
$('#s2').attr('src', result);
});
},
choose: function(res){
res.preview(function(index, file, result){
$('#s2').attr('src', result);
var formData = new FormData();
formData.append('idtype', 1);
formData.append('myfile', file);
formData.append('token', getUploadToken());
uploadPic(formData, 2);
});
}
});
});
var getUploadToken=function() {
var loadToken;
$.ajax({
url: 'upload-pic',
type: "POST",
dataType: "json",
async: false,
success: function(res) {
if (res.code == 200) {
loadToken = res.data.token;
} else {
layer.msg(res.message, {anim: 4});
}
},
error: function() {
layer.msg('获取上传Token的服务器错误!', {anim: 4});
}
});
return loadToken;
};
var getIdentityStatus=function(that) {
var t=$(that).val();
if (!isNaN(t) !== true || !t) {
if (!t) {
return false;
} else {
console.log(t);
}
} else {
$.ajax({
url: "identity-status",
type: "get",
dataType: "json",
data: {"uid": t},
success: function(data) {
if (data.status == 1) {
layer.tips('该用户已实名认证,无法手工认证', '#hid', { tips: [3, '#ba322b']});
} else {
layer.tips('未实名认证', '#hid', { tips: [2, '#5FB878']});
}
},
error: server_error
});
}
return false;
};
var identityOpt=function() {
var uid=$('input[name="uid"]').val();
var name=$('input[name="name"]').val();
var cardid=$('input[name="cardid"]').val();
if (!uid||!name||!cardid) {
layer.msg("请填写完整!",{anim: 1});
return;
}
$.ajax({
url: url_auth,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: $('form#form1').serialize(),
dataType: 'json',
success: function (res) {
if (res.code == 200) {
msg_200(res.message);
query(1);
} else {
msg_no_200(res.message);
}
},
error: server_error
});
};
$(function () {
/**
* 表格
*/
$("#table1").bootstrapTable({
method: 'post',
url: url_table1,
queryParams: function (params) {
var res={};
res.page = params.pageNumber;
res.size = params.pageSize;
return res;
},
pageSize: 15,
showRefresh:true,
responseHandler: function (res) {
if (res.code == 200) {
return {
"rows": res.data.list,
"total": res.data.total
};
} else {
layer.msg('[' + res.code + ']' + res.message);
return false;
}
},
columns:[
{field: 'uid', title: 'UID', valign:"middle", align:"right"},
{field: 'name', title: '姓名', valign:"middle", align:"center"},
{field: 'country', title: '国籍', valign:"middle", align:"center"},
{field: 'cardtype', title: '证件类型', valign:"middle", align:"center"},
{field: 'cardid', title: '证件号', valign:"middle", align:"center"},
{field: 'mid', title: '照片信息', valign:"middle", align:"center"},//matchmid
{field: 'addtime', title: '录入时间', valign:"middle", align:"center"},
{field: 'operatorid', title: '操作员', valign:"middle", align:"center"}
]
});
});
\ No newline at end of file
/**
* 用户管理:用户信息
* libingke
* 2018/01/10
*/
/**
* 表单
* @type {{start: null, end: null, country: null, type: null, user: null}}
*/
var form1 = {
start:null,
end:null,
country:null,
type:null,
user:null
};
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#date_range',
range: ':',
done: function(value, date, endDate){
$('#date_range').val(value);
query(1);
}
});
});
$(function () {
/**
* 回车触发 uid
*/
$('#user').bind('keypress', function(event) {
if(event.keyCode == "13")
query(1);
});
$(".select1").bind("change",function(){ query(1); });
/**
* 表格
*/
$("#table1").bootstrapTable({
method: 'post',
url: url_table1,
queryParams: function (params) {
form1.country=$('select[name="country"]').val();
form1.type=$('select[name="type"]').val();
form1.user=$('input[name="user"]').val();
if ($("#date_range").val()==='') {
form1.start=null;
form1.end=null;
} else {
var value=$("#date_range").val();
var t=value.split(' : ', 2);
form1.start=Math.round(new Date(t[0]).getTime()/1000+(new Date()).getTimezoneOffset()*60);
form1.end=Math.round(new Date(t[1]).getTime()/1000+(new Date()).getTimezoneOffset()*60)+86399;
}
form1.page = params.pageNumber;
form1.size = params.pageSize;
return form1;
},
pageSize: 20,
uniqueId: 'uid',
responseHandler: function (res) {
if (res.code == 200) {
if (res.data.conutdata.today && res.data.conutdata.total) {
var str = '<span>共计 <b style="color: #e64544">'+res.data.conutdata.total+
'</b> 名用户, 今日新增 <b style="color: #e64544">'+res.data.conutdata.today+'</b> 名用户</span>';
$('#tip1').html(str);
}
return {
"rows": res.data.rows,
"total": res.data.count
};
} else {
layer.msg('[' + res.code + ']' + res.message);
return false;
}
},
columns:[
{field: 'uid', title: 'UID', valign:"middle", align:"right"},
{field: 'name', title: '姓名', valign:"middle", align:"center"},
{field: 'role', title: '角色', valign:"middle", align:"center"},
{field: 'mobile', title: '手机', valign:"middle", align:"center"},
{field: 'email', title: '邮箱', valign:"middle", align:"center"},
{field: 'country', title: '国籍', valign:"middle", align:"center"},
{field: 'cardtype', title: '证件类型', valign:"middle", align:"center"},
{field: 'cardid', title: '证件号', valign:"middle", align:"center"},
{
title: '资产总值/BTC', valign:"middle", align:"center",
formatter: function(id, row) {
return '<a href="javascript:void(0)" class="view-'+row.uid+'" onmouseover="layer.tips(\'查看资产 UID:'+row.uid+'\', \'.view-'+row.uid+'\', {time:2500,tips:[2,\'#028e9a\']});" onclick="showWallet('+row.uid+')">查看</a>';
}
},
{field: 'addtime', title: '注册时间', valign:"middle", align:"center"},
{field: 'pid', title: '推客/代理商名称', valign:"middle", align:"center"},
{field: 'broker',title: '经纪商名称', valign:"middle", align:"center"},
{
title: '操作', valign:"middle", align:"center",
formatter: function(id, row) {
return '<a href="javascript:void(0)" onclick="infoEdit('+row.uid+')"><i class="fa fa-edit"></i> 修改</a>';
}
},
{
title: '充值尾号', valign:"middle", align:"center",
formatter: function(id, row) {
return '<a href="javascript:void(0)" class="tail-'+row.uid+'" onmouseover="layer.tips(\'查看充值尾号 UID:'+row.uid+'\', \'.tail-'+row.uid+'\', {time:2500,tips:[4,\'#4caf50\']});" onclick="showTailNum('+row.uid+')">查看</a>';
}
}
]
});
});
/**
* 编辑信息
* @param a id
*/
var infoEdit=function(a) {
var row = $("#table1").bootstrapTable("getRowByUniqueId", a);
var tip = row.name!='null'?row.name:('('+a+')');
var index=layer.open({type: 1,
title: '修改 <span style="color: #32c5d2">'+tip+'</span>',
id: 'info-edit',
skin: 'layui-layer-myBlue',
area: ['450px'],
offset: '100px',
content:
'<div style="padding: 5px 40px;"><br>\n' +
'<form class="layui-form-item" role="form">\n' +
' <div class="input-group my-group">\n' +
' <span class="input-group-addon">UID</span>\n' +
' <input name="uid" type="text" class="form-control" value="'+row.uid+'" disabled="disabled">\n' +
' </div>\n' +
' <div class="input-group my-group">\n' +
' <span class="input-group-addon">姓名</span>\n' +
' <input name="name" type="text" class="form-control" value="'+row.name+'" disabled="disabled">\n' +
' </div>\n' +
' <div class="input-group my-group">\n' +
' <span class="input-group-addon">手机号</span>\n' +
' <input id="clear_mobile" name="name" type="text" class="form-control" value="'+row.mobile+'" disabled="disabled">\n' +
(row.mobile!=''?'<span class="input-group-addon"><a onclick="clearAuth('+row.uid+',\'mobile\', this)" style="color: #f44336">清除手机号</a></span>\n' : '') +
' </div>\n' +
' <div class="input-group my-group">\n' +
' <span class="input-group-addon">邮箱</span>\n' +
' <input id="clear_email" name="email" type="text" class="form-control" value="'+row.email+'" disabled="disabled">\n' +
(row.email!=''?'<span class="input-group-addon"><a onclick="clearAuth('+row.uid+',\'email\', this)" style="color: #f44336">清除邮箱</a></span>\n' : '') +
' </div>\n' +
' <div class="input-group my-group">\n' +
' <span class="input-group-addon">用户类型</span>\n' +
' <input name="usertype" type="text" class="form-control" value="'+(row.usertype!=null?row.usertype:'')+'" disabled="disabled">\n' +
' </div>\n' +
' <div class="input-group my-group">\n' +
' <span class="input-group-addon">国际</span>\n' +
' <input name="country" type="text" class="form-control" value="'+(row.country!=null?row.country:'')+'" disabled="disabled">\n' +
' </div>\n' +
' <div class="input-group my-group">\n' +
' <span class="input-group-addon">身份证</span>\n' +
' <input name="cardtype" type="text" class="form-control" value="'+(row.cardtype!=null?row.cardtype:'')+'" disabled="disabled">\n' +
' </div>\n' +
' <div class="input-group my-group">\n' +
' <span class="input-group-addon">证件号</span>\n' +
' <input name="cardid" type="text" class="form-control" value="'+(row.cardid!=null?row.cardid:'')+'" disabled="disabled">\n' +
' </div>\n' +
' <div class="input-group my-group">\n' +
' <span class="input-group-addon my-group">经纪商</span>\n' +
' <input name="pid" type="text" class="form-control" value="'+(row.pid!=null?row.pid:'')+'" disabled="disabled">\n' +
' </div>\n' +
' <div class="input-group my-group">\n' +
' <span class="input-group-addon">备注</span>\n' +
' <textarea name="desc" placeholder="" class="layui-textarea" rows="1" disabled="disabled"></textarea>\n' +
' </div>\n' +
'</form></div>',
btn: ['确认修改', '取消'],
btn1: function() {
return layer.msg('未开放修改!');
v1=$('#set_company').val();
v2=$('#set_ratio').val();
if(!isNaN(v2) && v1!=="" && v2!="") {
$btn = $('.layui-layer-btn0').button('loading');
$("#table1").bootstrapTable('refresh', {});
$.ajax({
url: '##',
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {"rid": id, "keyname": v1, "rate": v2},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
layer.msg(res.message, {time: 500});
$("#table1").bootstrapTable('refresh');
layer.close(index);
} else {
layer.msg(res.message, {anim: 4});
}
},
error: function () {
layer.msg('服务器错误!', {anim: 4});
}
});
$btn.button('reset');
} else{
layer.msg("请输入完整且正确格式的数据");
}
return false;
}
});
};
/**
* 查看资产
* @param uid
*/
var showWallet=function(uid) {
var loading = layer.load(2, {shade: false});
$.ajax({
url: url_wallet,
data: {uid: uid},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
var show_list = '';
show_list += '<table class="layui-table">';
$.each(res.data, function(k,v){
show_list += '<tr id="tr-show-'+ k +'"><td><b> ' + k + '</b></td><td>'+ v +'</td></tr>';
});
show_list += '</table>';
layer.open({
type: 1,
id: 'show-wallet'+uid,
skin: 'layui-layer-myBlue',
area: ['308px'],
title: '查看资产 <span style="color: #ffeb3b">UID:'+uid+'</span>',
content: '<div style="padding: 5px 10px;">' + show_list + '</div>',
shadeClose: true,
shade: false,
btn: '关闭',
btnAlign: 'c'
});
} else {
layer.msg('<b style="color: #ba322b">UID:'+uid+'</b> '+res.message, {icon: 7, time: 1300});
}
},
error: server_error
});
layer.close(loading);
};
/**
* 清除认证
* @param uid
* @param act
* @param that
*/
var clearAuth=function(uid, act, that) {
layer.confirm('确认清除 ?', {
title: '清除提示',
skin: 'layui-layer-myRed',
btn: ['确认','取消']
}, function(){
$.ajax({
url: url_clear_auth,
type: 'POST',
headers: {"Authorization": 'Bearer ' + request_token},
data: {"user": uid, "field": act},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
$("#clear_"+act).val('');
$("#clear_"+act).removeAttr('disabled');
$(that).remove();
layer.msg(res.message, {time: 500});
} else {
layer.msg('清除失败:' + res.message, {anim: 6});
}
},
error: server_error
});
});
};
/**
* 显示充值尾号
*/
var showTailNum=function(uid) {
var row = $("#table1").bootstrapTable("getRowByUniqueId", uid);
console.log(row);
var loading = layer.load(2, {shade: false});
$.ajax({
url: url_tail_num,
type: "POST",
headers: {"Authorization": 'Bearer ' + request_token},
data: {user: uid},
success: function(data) {
var str="";
str+='<table class="layui-table">';
str+='<tr id="tr-tail-uid-'+ row.uid +'"><td><b>UID</b></td><td>'+ row.uid +'</td></tr>';
if (data.code == 200 && data.data.last != "undefined") {
str+='<tr><td><b> 姓名</b></td><td>'+ data.data.name +'</td></tr>';
str+='<tr><td><b>充值尾号</b></td><td>'+ data.data.last +'</td></tr>';
} else {
str+='<tr><td><b> 姓名</b></td><td>'+ row.name +'</td></tr>';
str+='<tr><td><b>充值尾号</b></td><td></td></tr>';
str+='<tr><td><b>提示信息</b></td><td style="color: red">'+data.message+'</td></tr>';
}
str+='</table>';
layer.open({
type: 1,
id: 'show-tail-num'+uid,
skin: 'layui-layer-myBlue',
area: ['308px'],
title: '充值尾号',
content: '<div style="padding: 5px 10px;">' + str + '</div>',
shadeClose: true,
shade: false,
btn: '关闭',
btnAlign: 'r'
});
},
error: server_error
});
layer.close(loading);
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment