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;
}
This diff is collapsed.
This diff is collapsed.
/**
* 资产管理:充币查询
* 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
This diff is collapsed.
/**
* 资产管理:薪资发放
* 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
This diff is collapsed.
/**
* 云矿机:矿机购买记录
* 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
This diff is collapsed.
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