Skip to content

Commit 66abbb8

Browse files
peterpeter
authored andcommitted
v1.2.0
1 parent e25a67b commit 66abbb8

File tree

7 files changed

+94
-90
lines changed

7 files changed

+94
-90
lines changed

app/public/scripts/home.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -343,24 +343,24 @@ const QTGateRegionsSetup = [
343343
];
344344
const nextExpirDate = (expire) => {
345345
const now = new Date();
346+
const _expire = new Date(expire);
346347
now.setHours(0, 0, 0, 0);
347-
if (now.getTime() > expire.getTime()) {
348-
return expire;
348+
if (now.getTime() > _expire.getTime()) {
349+
return _expire;
349350
}
350351
const nextExpirDate = new Date(expire);
351352
nextExpirDate.setMonth(now.getMonth());
352353
nextExpirDate.setFullYear(now.getFullYear());
353354
if (nextExpirDate.getTime() < now.getTime()) {
354355
nextExpirDate.setMonth(now.getMonth() + 1);
356+
return nextExpirDate;
355357
}
356-
if (nextExpirDate.getTime() >= expire.getTime()) {
357-
return expire;
358-
}
359-
return nextExpirDate;
358+
return _expire;
360359
};
361360
const getRemainingMonth = (expire) => {
361+
const _expire = new Date(expire);
362362
const _nextExpirDate = nextExpirDate(expire);
363-
return expire.getFullYear() === _nextExpirDate.getFullYear() ? expire.getMonth() - _nextExpirDate.getMonth() : (11 - _nextExpirDate.getMonth() + expire.getMonth());
363+
return _expire.getFullYear() === _nextExpirDate.getFullYear() ? _expire.getMonth() - _nextExpirDate.getMonth() : (11 - _nextExpirDate.getMonth() + _expire.getMonth());
364364
};
365365
const infoDefine = [
366366
{
@@ -1397,7 +1397,7 @@ const infoDefine = [
13971397
CancelSuccess: (PlanExpire, isAnnual, returnAmount) => {
13981398
return `Your subscriptions was cancelled. You may keep use QTGate service with this plan until ${PlanExpire.toLocaleDateString()}. Restrictions apply to free accounts and accounts using promotions. ${isAnnual ? `us$${returnAmount} will return to your paid card in 5 working day.` : `Automatically canceled.`} `;
13991399
},
1400-
currentPlanExpire: ['Plan expires at:', 'Renews at'],
1400+
currentPlanExpire: ['Plan expires at:', 'Renews at', 'monthly reset day '],
14011401
currentAnnualPlan: ['Monthly plan', 'Annual plan'],
14021402
cardPaymentErrorMessage: ['Error: card number or have an unsupported card type.', 'Error: expiration!', 'Error: Card Security Code', 'Error: Card owner postcode',
14031403
'Error: payment failed. Please try again late.',
@@ -1927,7 +1927,7 @@ const infoDefine = [
19271927
paymentProblem1: '支付遇到問題',
19281928
paymentProblem: '您目前的所在區域看上去銀行網關被和諧,您可以使用QTGate網關支付來完成支付',
19291929
title: '賬戶管理',
1930-
currentPlanExpire: ['訂閱截止日期:', '下一次自動續訂日'],
1930+
currentPlanExpire: ['訂閱截止日期:', '下一次自動續訂日', '每月數據重置日'],
19311931
CancelSuccess: (PlanExpire, isAnnual, returnAmount) => {
19321932
return `中止訂閱成功。您可以一直使用您的原訂閱到${PlanExpire.toLocaleDateString()}為止。以後您將會自動成為QTGate免費用戶可以繼續使用QTGate的各項免費功能。 ${isAnnual ? `您的餘款us$${returnAmount}會在5個工作日內退還到您的支付卡。 ` : '下月起QTGate系統不再自動扣款。 '} 祝您網絡衝浪愉快。`;
19331933
},
@@ -3389,7 +3389,7 @@ var view_layout;
33893389
this.showCurrentPlanBalance = ko.computed(() => {
33903390
if (!this.getCurrentPlan() || !this.QTTransferData())
33913391
return null;
3392-
return getCurrentPlanUpgradelBalance(new Date(this.QTTransferData().expire), this.QTTransferData().productionPackage, this.QTTransferData().isAnnual);
3392+
return getCurrentPlanUpgradelBalance(this.QTTransferData().expire, this.QTTransferData().productionPackage, this.QTTransferData().isAnnual);
33933393
});
33943394
this.selectPlanPrice = ko.computed(() => {
33953395
if (!this.getPaymentPlan())
@@ -4502,8 +4502,8 @@ var view_layout;
45024502
}
45034503
clearAllPaymentErrorTimeUP() {
45044504
return setTimeout(() => {
4505-
this.showSuccessPayment(false);
4506-
this.showCancelSuccess(false);
4505+
//this.showSuccessPayment ( false )
4506+
//this.showCancelSuccess ( false )
45074507
return this.clearPaymentError();
45084508
}, 5000);
45094509
}
@@ -4746,6 +4746,8 @@ var view_layout;
47464746
if (!this.keyPair().passwordOK || !this.getCurrentPlan()) {
47474747
return;
47484748
}
4749+
this.showSuccessPayment(false);
4750+
this.showCancelSuccess(false);
47494751
this.UserPerment(true);
47504752
if (!this.QTTransferData().paidID) {
47514753
$('.CancelPlanButton').popup({
@@ -4770,7 +4772,7 @@ var view_layout;
47704772
this.QTGateAccountPlan(value);
47714773
this.UserPermentShapeDetail(true);
47724774
return $('.CancelMessage').popup({
4773-
position: 'Right Center',
4775+
position: 'bottom right',
47744776
on: 'click',
47754777
delay: {
47764778
show: 300,

app/public/scripts/home.ts

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -391,29 +391,29 @@ const QTGateRegionsSetup: IQTGateRegionsSetup[] = [
391391
}
392392
]
393393

394-
const nextExpirDate = ( expire: Date ) => {
395-
const now = new Date ()
394+
const nextExpirDate = ( expire: string ) => {
395+
const now = new Date ()
396+
const _expire = new Date ( expire )
396397
now.setHours ( 0,0,0,0 )
397-
if ( now.getTime() > expire.getTime ()) {
398-
return expire
398+
if ( now.getTime() > _expire.getTime ()) {
399+
return _expire
399400
}
400401
const nextExpirDate = new Date ( expire )
401402
nextExpirDate.setMonth ( now.getMonth())
402403
nextExpirDate.setFullYear ( now.getFullYear())
403404

404405
if ( nextExpirDate.getTime() < now.getTime ()) {
405406
nextExpirDate.setMonth ( now.getMonth() + 1 )
407+
return nextExpirDate
406408
}
407409

408-
if ( nextExpirDate.getTime () >= expire.getTime ()) {
409-
return expire
410-
}
411-
return nextExpirDate
410+
return _expire
412411
}
413412

414-
const getRemainingMonth = ( expire: Date ) => {
415-
const _nextExpirDate = nextExpirDate( expire )
416-
return expire.getFullYear () === _nextExpirDate.getFullYear () ? expire.getMonth() - _nextExpirDate.getMonth() : ( 11 - _nextExpirDate.getMonth() + expire.getMonth() )
413+
const getRemainingMonth = ( expire: string ) => {
414+
const _expire = new Date ( expire )
415+
const _nextExpirDate = nextExpirDate ( expire )
416+
return _expire.getFullYear () === _nextExpirDate.getFullYear () ? _expire.getMonth() - _nextExpirDate.getMonth() : ( 11 - _nextExpirDate.getMonth() + _expire.getMonth() )
417417
}
418418

419419
const infoDefine = [
@@ -480,8 +480,8 @@ const infoDefine = [
480480
multiRegion:['单一代理区域并发代理','多代理区域混合并发代理','多代理区域混合并发代理','多代理区域混合并发代理'],
481481
downGradeMessage:'您正在操作降级您的订阅,如果操作成功您将从下月您的订阅之日起,实行新的订阅,如果您是。',
482482
cancelPlanMessage:'QTGate的订阅是以月为基本的单位。您的月订阅将在下月您的订阅起始日前被终止,您可以继续使用您的本月订阅计划,您将自动回到免费用户。如果您是每月自动扣款,则下月将不再扣款。如果您是年度订阅计划,您的退款将按普通每月订阅费,扣除您已经使用的月份后计算的差额,将自动返还您所支付的信用卡账号,如果您是使用促销码,或您是测试用户,您的终止订阅将不能被接受。',
483-
cancelPlanMessage1: ( planName: string, isAnnual: boolean, expire: Date ) => {
484-
return `您的订阅计划是${ isAnnual ? `年度订阅,退还金额将按照您已付年订阅费 us$[${ getPlanPrice ( planName, true )}] - 您已使用月份原价 us$[${ getPlanPrice( planName, false )}] X 已使用月数[${ 12 - getRemainingMonth ( expire )}] = 余额 us$[${ getCurrentPlanCancelBalance ( expire, planName )}]将退还到您用来支付的信用卡。`: `月订阅,您的订阅将下次更新日${ nextExpirDate(expire).toLocaleDateString() }时不再被自动扣款和更新。`}`
483+
cancelPlanMessage1: ( planName: string, isAnnual: boolean, expire: string ) => {
484+
return `您的订阅计划是${ isAnnual ? `年度订阅,退还金额将按照您已付年订阅费 us$[${ getPlanPrice ( planName, true )}] - 您已使用月份原价 us$[${ getPlanPrice( planName, false )}] X 已使用月数[${ 12 - getRemainingMonth ( expire )}] = 余额 us$[${ getCurrentPlanCancelBalance ( expire, planName )}]将退还到您用来支付的信用卡。`: `月订阅,您的订阅将下次更新日${ nextExpirDate( expire ).toLocaleDateString() }时不再被自动扣款和更新。`}`
485485
}
486486
},
487487

@@ -1007,7 +1007,7 @@ const infoDefine = [
10071007
serverShareData1:'並列ゲットウェイ技術を使う際に、同時使う数が独占数を超える場合には、独占リソースを他人と割合にチェアする場合もあります。',
10081008
maxmultigateway: ['最大二つ並列ゲットウェイ','最大四つ並列ゲットウェイ*','最大四つ並列ゲットウェイ'],
10091009
cancelPlanMessage:'QTGateプランは月毎に計算し、来月のあなたの最初加入した日まで、今のプランのままご利用ですます。キャンセルした日から自動的にQTGateの無料ユーザーになります。おアカウトは(月)払いの場合は、来月の自動払いは中止となります。年払いの場合は、ご使った分に月普通料金と計算し控除してから、お支払いを使ったクレジットカードに戻ります。販促コードまたはテストユーザーにはキャンセルすることができません。',
1010-
cancelPlanMessage1: ( planName: string, isAnnual: boolean, expire: Date ) => {
1010+
cancelPlanMessage1: ( planName: string, isAnnual: boolean, expire: string ) => {
10111011
return `あなたのプランは${ isAnnual ? `一年契約です。キャンセルをした場合は、ご利用して頂いた月に普通料金と請求を計算されます。お返し金額はプラン年契約料金 us$[${ getPlanPrice ( planName, true )}] - プラン普通月料金 us$[${ getPlanPrice( planName, false )}] X ご利用頂いた月[${ 12 - getRemainingMonth ( expire )}] = 戻る金額 us$[${ getCurrentPlanCancelBalance ( expire, planName )}]となります。`: `月プランです。キャンセルにすると次の更新日[${ nextExpirDate(expire).toLocaleDateString() }]に自動更新はしませんです。`}`
10121012
}
10131013
},
@@ -1497,7 +1497,7 @@ const infoDefine = [
14971497
CancelSuccess: ( PlanExpire: Date, isAnnual: boolean, returnAmount: number ) => {
14981498
return `Your subscriptions was cancelled. You may keep use QTGate service with this plan until ${ PlanExpire.toLocaleDateString() }. Restrictions apply to free accounts and accounts using promotions. ${ isAnnual ? `us$${ returnAmount } will return to your paid card in 5 working day.` : `Automatically canceled.` } `
14991499
},
1500-
currentPlanExpire: ['Plan expires at:','Renews at'],
1500+
currentPlanExpire: ['Plan expires at:','Renews at','monthly reset day '],
15011501
currentAnnualPlan: ['Monthly plan','Annual plan'],
15021502
cardPaymentErrorMessage:['Error: card number or have an unsupported card type.','Error: expiration!','Error: Card Security Code','Error: Card owner postcode',
15031503
'Error: payment failed. Please try again late.',
@@ -1542,8 +1542,8 @@ const infoDefine = [
15421542
aboutCancel: 'About cancel subscription',
15431543
cancelPlanMessage: 'You may cancel your QTGate subscription at any time, and you will continue to have access to the QTGate services through the end of your paid period until all remaining subscription time in your account is used up. Restrictions apply to free accounts and accounts using promotions.',
15441544
serverShareData1:'Your dedicated server will be share ratio when you connected over your dedicated count via use Multi-gateway technology.',
1545-
cancelPlanMessage1: ( planName: string, isAnnual: boolean, expire: Date ) => {
1546-
return `Your plan is ${ isAnnual ? `annual paid ${ getPlanPrice ( planName, true )}. The passed ${ 12 - getRemainingMonth ( expire )} month will being normal price us$${ getPlanPrice( planName, false )}, QTGate will refunds us$${ getCurrentPlanCancelBalance ( expire, planName )} to your paid card.`: `monthly, it will not be renew at ${ nextExpirDate(expire).toLocaleDateString() } if you cancel this plan.`}`
1545+
cancelPlanMessage1: ( planName: string, isAnnual: boolean, expire: string ) => {
1546+
return `Your plan is ${ isAnnual ? `annual paid ${ getPlanPrice ( planName, true )}. The passed ${ 12 - getRemainingMonth ( expire )} month will being normal price us$${ getPlanPrice( planName, false )}, QTGate will refunds us$${ getCurrentPlanCancelBalance ( expire, planName )} to your paid card.`: `monthly, it will not be renew at ${ nextExpirDate (expire).toLocaleDateString() } if you cancel this plan.`}`
15471547
}
15481548
},
15491549

@@ -2063,7 +2063,7 @@ const infoDefine = [
20632063
paymentProblem1:'支付遇到問題',
20642064
paymentProblem:'您目前的所在區域看上去銀行網關被和諧,您可以使用QTGate網關支付來完成支付',
20652065
title: '賬戶管理',
2066-
currentPlanExpire: ['訂閱截止日期:','下一次自動續訂日'],
2066+
currentPlanExpire: ['訂閱截止日期:','下一次自動續訂日','每月數據重置日'],
20672067
CancelSuccess: ( PlanExpire: Date, isAnnual: boolean, returnAmount: number ) => {
20682068
return `中止訂閱成功。您可以一直使用您的原訂閱到${ PlanExpire.toLocaleDateString() }為止。以後您將會自動成為QTGate免費用戶可以繼續使用QTGate的各項免費功能。 ${ isAnnual ? `您的餘款us$${ returnAmount }會在5個工作日內退還到您的支付卡。 `: '下月起QTGate系統不再自動扣款。 '} 祝您網絡衝浪愉快。`
20692069
},
@@ -2111,8 +2111,8 @@ const infoDefine = [
21112111
internetShareData:['共享高速帶寬','獨享高速帶寬*','獨享雙線高速帶寬*','獨享四線高速帶寬'],
21122112
serverShareData1:'OPN併發多代理技術,同時使用數大於獨占數時,會相應分享您所獨占的資源',
21132113
cancelPlanMessage:'可隨時終止您的訂閱,QTGate的訂閱是以月為基本的單位。您的月訂閱將在下月您的訂閱起始日前被終止,您可以繼續使用您的本月訂閱計劃,您將自動回到免費用戶。如果您是每月自動扣款,則下月將不再扣款。如果您是年度訂閱計劃,您的退款將按普通每月訂閱費,扣除您已經使用的月份後計算的差額,將自動返還您所支付的信用卡賬號,如果您是使用促銷碼,或您是測試用戶,您的終止訂閱將不能被接受。 ',
2114-
cancelPlanMessage1: ( planName: string, isAnnual: boolean, expire: Date ) => {
2115-
return `您的訂閱計劃是${ isAnnual ? `年度訂閱,退還金額將按照您已付年訂閱費 us$[${ getPlanPrice ( planName, true )}] - 您已使用月份原價 us$[${ getPlanPrice( planName, false )}] X 已使用月數[${ 12 - getRemainingMonth ( expire )}] = 餘額 us$[${ getCurrentPlanCancelBalance ( expire, planName )}]將退還到您用來支付的信用卡。`: `月訂閱,您的訂閱將下次更新日${ nextExpirDate(expire).toLocaleDateString() }時不再被自動扣款和更新。`}`
2114+
cancelPlanMessage1: ( planName: string, isAnnual: boolean, expire: string ) => {
2115+
return `您的訂閱計劃是${ isAnnual ? `年度訂閱,退還金額將按照您已付年訂閱費 us$[${ getPlanPrice ( planName, true )}] - 您已使用月份原價 us$[${ getPlanPrice( planName, false )}] X 已使用月數[${ 12 - getRemainingMonth ( expire )}] = 餘額 us$[${ getCurrentPlanCancelBalance ( expire, planName )}]將退還到您用來支付的信用卡。`: `月訂閱,您的訂閱將下次更新日${ nextExpirDate (expire).toLocaleDateString() }時不再被自動扣款和更新。`}`
21162116
}
21172117

21182118
},
@@ -4838,10 +4838,10 @@ module view_layout {
48384838

48394839
private clearAllPaymentErrorTimeUP () {
48404840
return setTimeout (() => {
4841-
this.showSuccessPayment ( false )
4842-
this.showCancelSuccess ( false )
4841+
//this.showSuccessPayment ( false )
4842+
//this.showCancelSuccess ( false )
48434843
return this.clearPaymentError ()
4844-
}, 5000)
4844+
}, 5000 )
48454845
}
48464846

48474847
private paymentCallBackFromQTGate ( err, data: QTGateAPIRequestCommand ) {
@@ -5144,9 +5144,12 @@ module view_layout {
51445144
})
51455145

51465146
public showUserDetail () {
5147+
51475148
if ( ! this.keyPair().passwordOK || ! this.getCurrentPlan()) {
51485149
return
51495150
}
5151+
this.showSuccessPayment ( false )
5152+
this.showCancelSuccess ( false )
51505153
this.UserPerment ( true )
51515154
if ( !this.QTTransferData().paidID ) {
51525155
$('.CancelPlanButton').popup({
@@ -5171,7 +5174,7 @@ module view_layout {
51715174
this.QTGateAccountPlan ( value )
51725175
this.UserPermentShapeDetail( true )
51735176
return $('.CancelMessage').popup({
5174-
position: 'Right Center',
5177+
position: 'bottom right',
51755178
on: 'click',
51765179
delay: {
51775180
show: 300,
@@ -5186,7 +5189,7 @@ module view_layout {
51865189
public showCurrentPlanBalance = ko.computed (() => {
51875190
if ( !this.getCurrentPlan() || !this.QTTransferData())
51885191
return null
5189-
return getCurrentPlanUpgradelBalance ( new Date(this.QTTransferData().expire), this.QTTransferData().productionPackage, this.QTTransferData().isAnnual )
5192+
return getCurrentPlanUpgradelBalance ( this.QTTransferData().expire, this.QTTransferData().productionPackage, this.QTTransferData().isAnnual )
51905193
})
51915194

51925195
public selectPlanPrice = ko.computed (() => {
@@ -5387,7 +5390,7 @@ const getPlanPrice = ( plan: string, isAnnualPlan: boolean ) => {
53875390
}
53885391
}
53895392

5390-
const getCurrentPlanCancelBalance = ( expiration: Date, planName: string ) => {
5393+
const getCurrentPlanCancelBalance = ( expiration: string, planName: string ) => {
53915394

53925395
const price = getPlanPrice ( planName, true )
53935396
const normalPrice = getPlanPrice ( planName, false )
@@ -5404,7 +5407,7 @@ const getExpire = ( startDate: Date, isAnnual: boolean ) => {
54045407
return start
54055408
}
54065409

5407-
const getCurrentPlanUpgradelBalance = ( expiration: Date, planName: string, isAnnual: boolean ) => {
5410+
const getCurrentPlanUpgradelBalance = ( expiration: string, planName: string, isAnnual: boolean ) => {
54085411
if ( !isAnnual ) {
54095412
return getPlanPrice ( planName, false )
54105413
}

app/server.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,9 @@ class localServer {
654654
console.log(err);
655655
return saveLog('getAvaliableRegion QTClass.request callback error! STOP');
656656
}
657-
if (res && res.dataTransfer && res.dataTransfer.productionPackage)
657+
if (res && res.dataTransfer && res.dataTransfer.productionPackage) {
658658
this.config.freeUser = /free/i.test(res.dataTransfer.productionPackage);
659+
}
659660
CallBack(res.Args[0], res.dataTransfer, this.config);
660661
saveLog(`getAvaliableRegion ${JSON.stringify(res)} `);
661662
// Have gateway connect!
@@ -1750,6 +1751,7 @@ class ImapConnect extends Imap.imapPeer {
17501751
}
17511752
}
17521753
}
1754+
saveLog(`on newMail command [${ret.command}] have requestSerial [${ret.requestSerial}]`);
17531755
const poolData = this.commandCallBackPool.get(ret.requestSerial);
17541756
if (!poolData || typeof poolData.CallBack !== 'function') {
17551757
return saveLog(`QTGateAPIRequestCommand got commandCallBackPool ret.requestSerial [${ret.requestSerial}] have not callback `);

0 commit comments

Comments
 (0)