Skip to content

Commit

Permalink
Merge branch 'malio' into 'malio'
Browse files Browse the repository at this point in the history
feat(js): 更正 JS 轮询逻辑问题

See merge request masivro/malio-theme-for-sspanel!48
  • Loading branch information
Masivro committed May 16, 2020
2 parents 4bb9670 + deeb5ec commit 8043684
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 123 deletions.
2 changes: 1 addition & 1 deletion app/Controllers/Mod_Mu/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static function ($query1) use ($node) {
$key_list = array('email', 'method', 'obfs', 'obfs_param', 'protocol', 'protocol_param',
'forbidden_ip', 'forbidden_port', 'node_speedlimit', 'disconnect_ip',
'is_multi_user', 'id', 'port', 'passwd', 'u', 'd', 'node_connector',
'sort', 'uuid');
'sort', 'uuid', 'sha224uuid');

$users = array();

Expand Down
1 change: 0 additions & 1 deletion app/Services/Gateway/TomatoPay.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ public function getPurchaseHTML()
}
}
});
setTimeout(f, 1000);
});
</script>
';
Expand Down
1 change: 0 additions & 1 deletion app/Services/Gateway/flyfoxpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ public function getPurchaseHTML()
}
}
});
setTimeout(f, 1000);
});
</script>
';
Expand Down
9 changes: 8 additions & 1 deletion resources/views/material/auth/login.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,17 @@
qrcode.makeCode(telegram_qrcode);
</script>
<script>
var flag = false;
$(document).ready(function () {
$("#calltgauth").click(
function () {
f();
if(flag == false){
f();
flag = true;
}else{
return 0;
}
}
);
Expand Down
70 changes: 37 additions & 33 deletions resources/views/material/user/aopf2f.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,49 @@

<script>
var pid = 0;
var flag = false;
function pay() {
$("#readytopay").modal();
$("#readytopay").on('shown.bs.modal', function () {
$.ajax({
type: "POST",
url: "/user/payment/purchase",
dataType: "json",
data: {
amount: $$getValue('amount')
},
success: (data) => {
if (data.ret) {
//console.log(data);
pid = data.pid;
$$.getElementById('qrarea').innerHTML = '<div class="text-center"><p>请使用手机支付宝扫描二维码支付</p><a id="qrcode" style="padding-top:10px;display:inline-block"></a><p>手机可点击二维码唤起支付宝支付</p></div>'
$("#readytopay").modal('hide');
new QRCode("qrcode", {
render: "canvas",
width: 200,
height: 200,
text: encodeURI(data.qrcode)
});
$$.getElementById('qrcode').setAttribute('href', data.qrcode);
$.ajax({
type: "POST",
url: "/user/payment/purchase",
dataType: "json",
data: {
amount: $$getValue('amount')
},
success: (data) => {
if (data.ret) {
//console.log(data);
pid = data.pid;
$$.getElementById('qrarea').innerHTML = '<div class="text-center"><p>请使用手机支付宝扫描二维码支付</p><a id="qrcode" style="padding-top:10px;display:inline-block"></a><p>手机可点击二维码唤起支付宝支付</p></div>'
$("#readytopay").modal('hide');
new QRCode("qrcode", {
render: "canvas",
width: 200,
height: 200,
text: encodeURI(data.qrcode)
});
$$.getElementById('qrcode').setAttribute('href', data.qrcode);
if(flag == false){
setTimeout(f, 1000);
} else {
$("#result").modal();
$$.getElementById('msg').innerHTML = data.msg;
flag = true;
}else{
return 0;
}
},
error: (jqXHR) => {
//console.log(jqXHR);
$("#readytopay").modal('hide');
} else {
$("#result").modal();
$$.getElementById('msg').innerHTML = `${
jqXHR
} 发生错误了`;
$$.getElementById('msg').innerHTML = data.msg;
}
})
},
error: (jqXHR) => {
//console.log(jqXHR);
$("#readytopay").modal('hide');
$("#result").modal();
$$.getElementById('msg').innerHTML = `${
jqXHR
} 发生错误了`;
}
});
}
Expand Down
38 changes: 18 additions & 20 deletions resources/views/material/user/bitpay.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,26 @@
return;
}
$('#readytopay').modal();
$("#readytopay").on('shown.bs.modal', function () {
$.ajax({
url: "/user/payment/bitpay/purchase",
data: {
price,
type,
},
dataType: 'json',
type: "POST",
success: (data) => {
//console.log(data);
$.ajax({
url: "/user/payment/bitpay/purchase",
data: {
price,
type,
},
dataType: 'json',
type: "POST",
success: (data) => {
//console.log(data);
if (data.errcode === 0) {
$("#readytopay").modal('hide');
$$.getElementById('msg').innerHTML = '正在跳转到数字货币支付...'
window.location.href = data.url;
} else {
$("#result").modal();
$$.getElementById('msg').innerHTML = data.errmsg
}
if (data.errcode === 0) {
$("#readytopay").modal('hide');
$$.getElementById('msg').innerHTML = '正在跳转到数字货币支付...'
window.location.href = data.url;
} else {
$("#result").modal();
$$.getElementById('msg').innerHTML = data.errmsg
}
});
}
});
}
Expand Down
49 changes: 12 additions & 37 deletions resources/views/material/user/bitpayx.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,50 +40,25 @@
}
$('#readytopay').modal();
$("#readytopay").on('shown.bs.modal', function () {
$.ajax({
'url': "/user/payment/purchase",
'data': {
'price': price,
'type': type,
},
'dataType': 'json',
'type': "POST",
success: function (data) {
if (data.errcode == 0) {
$("#readytopay").modal('hide');
$("#msg").html("正在跳转到支付页面...");
window.location.href = data.url;
} else {
$("#result").modal();
$("#msg").html(data.errmsg);
}
}
});
});
}
function f() {
$.ajax({
type: "POST",
url: "/payment/status",
dataType: "json",
data: {
pid: pid
'url': "/user/payment/purchase",
'data': {
'price': price,
'type': type,
},
'dataType': 'json',
'type': "POST",
success: function (data) {
if (data.result) {
console.log(data);
if (data.errcode == 0) {
$("#readytopay").modal('hide');
$("#msg").html("正在跳转到支付页面...");
window.location.href = data.url;
} else {
$("#result").modal();
$("#msg").html("充值成功!");
window.setTimeout("location.href=window.location.href", {$config['jump_delay']});
$("#msg").html(data.errmsg);
}
},
error: function (jqXHR) {
console.log(jqXHR);
}
});
tid = setTimeout(f, 1000); //循环调用触发setTimeout
}
</script>
61 changes: 32 additions & 29 deletions resources/views/material/user/payjs.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
<script>
var pid = 0;
var flag = false;
function pay(type) {
if (type = 'wechat') {
}
Expand All @@ -27,38 +27,41 @@
return;
}
$('#readytopay').modal();
$("#readytopay").on('shown.bs.modal', function () {
$.ajax({
url: "/user/payment/purchase",
data: {
price,
type,
},
dataType: 'json',
type: "POST",
success: (data) => {
if (data.code == 0) {
//console.log(data);
$("#readytopay").modal('hide');
{
pid = data.pid;
$$.getElementById('qrarea').innerHTML = '<div class="text-center"><p>使用微信扫描二维码支付.</p><div align="center" id="qrcode" style="padding-top:10px;"></div><p>充值完毕后会自动跳转</p></div>';
var qrcode = new QRCode("qrcode", {
correctLevel: 3, //解决超过200字符的二维码生成问题
render: "canvas",
width: 200,
height: 200,
text: data.url //使用encodeURI()函数报会调低至错误
});
$.ajax({
url: "/user/payment/purchase",
data: {
price,
type,
},
dataType: 'json',
type: "POST",
success: (data) => {
if (data.code == 0) {
//console.log(data);
$("#readytopay").modal('hide');
{
pid = data.pid;
$$.getElementById('qrarea').innerHTML = '<div class="text-center"><p>使用微信扫描二维码支付.</p><div align="center" id="qrcode" style="padding-top:10px;"></div><p>充值完毕后会自动跳转</p></div>';
var qrcode = new QRCode("qrcode", {
correctLevel: 3, //解决超过200字符的二维码生成问题
render: "canvas",
width: 200,
height: 200,
text: data.url //使用encodeURI()函数报会调低至错误
});
if(flag == false){
tid = setTimeout(f, 1000); //循环调用触发setTimeout
flag = true;
}else{
return 0;
}
} else {
$("#result").modal();
$$.getElementById('msg').innerHTML = data.msg;
//console.log(data);
}
} else {
$("#result").modal();
$$.getElementById('msg').innerHTML = data.msg;
//console.log(data);
}
});
}
});
}
Expand Down

0 comments on commit 8043684

Please sign in to comment.