forked from vtquy98/redwin_full
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9739338
Showing
333 changed files
with
24,182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PORT = 80 | ||
NTBA_FIX_319 = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
public/ | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
|
||
/** | ||
* Mini Game | ||
*/ | ||
// Mini Poker | ||
let mini_poker = require('./game/mini_poker'); | ||
|
||
// Big Babol | ||
let big_babol = require('./game/big_babol'); | ||
|
||
|
||
// Bầu Cua | ||
let baucua = require('./game/baucua'); | ||
|
||
// Mini 3 Cây | ||
let mini3cay = require('./game/mini3cay'); | ||
|
||
// Cao Thấp | ||
let caothap = require('./game/caothap'); | ||
|
||
// AngryBirds | ||
let angrybird = require('./game/angrybird'); | ||
|
||
let megaj = require('./game/megaj'); | ||
|
||
|
||
/** | ||
* Game | ||
*/ | ||
// Vương Quốc Red | ||
let vq_red = require('./game/vuong_quoc_red'); | ||
|
||
// Candy | ||
let Candy = require('./game/candy'); | ||
|
||
// Poker | ||
let Poker = require('./game/poker'); | ||
|
||
// Long Lân | ||
let LongLan = require('./game/longlan'); | ||
|
||
// Reg game | ||
let reg = require('./game/reg'); | ||
|
||
|
||
// Xoc Xoc | ||
let XocXoc = require('./game/XocXoc'); | ||
|
||
// Xo So | ||
let xs = require('./game/xs'); | ||
|
||
module.exports = function(client, data){ | ||
if (!!data.mini_poker) { | ||
mini_poker(client, data.mini_poker); | ||
} | ||
if (!!data.big_babol) { | ||
big_babol(client, data.big_babol); | ||
} | ||
if (!!data.vq_red) { | ||
vq_red(client, data.vq_red); | ||
} | ||
if (!!data.baucua) { | ||
baucua(client, data.baucua); | ||
} | ||
if (!!data.mini3cay) { | ||
mini3cay(client, data.mini3cay); | ||
} | ||
if (!!data.caothap) { | ||
caothap(client, data.caothap); | ||
} | ||
if (!!data.angrybird) { | ||
angrybird(client, data.angrybird); | ||
} | ||
if (!!data.megaj) { | ||
megaj(client, data.megaj); | ||
} | ||
|
||
|
||
if (!!data.poker) { | ||
Poker(client, data.poker); | ||
} | ||
|
||
if (!!data.candy) { | ||
Candy(client, data.candy); | ||
} | ||
|
||
if (!!data.longlan) { | ||
LongLan(client, data.longlan); | ||
} | ||
|
||
if (!!data.reg) { | ||
reg(client, data.reg); | ||
} | ||
|
||
if (!!data.xocxoc) { | ||
XocXoc(client, data.xocxoc); | ||
} | ||
|
||
if (!!data.xs) { | ||
xs(client, data.xs); | ||
} | ||
|
||
client = null; | ||
data = null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
module.exports = function(client){ | ||
client.red({ | ||
taixiu: {time_remain: client.redT.TaiXiu_time}, | ||
mini: {baucua:{time_remain: client.redT.BauCua_time}} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
var UserInfo = require('../Models/UserInfo'); | ||
var GiftCode = require('../Models/GiftCode'); | ||
|
||
var validator = require('validator'); | ||
var Helpers = require('../Helpers/Helpers'); | ||
|
||
module.exports = function(client, data){ | ||
if (!!data.captcha && !!data.code) { | ||
if (!validator.isLength(data.captcha, {min: 4, max: 4})) { | ||
client.red({notice: {title: 'LỖI', text: 'Captcha không đúng...'}}); | ||
}else if (!validator.isLength(data.code, {min: 4, max: void 0})) { | ||
client.red({notice: {title: 'LỖI', text: 'GiftCode không tồn tại !!'}}); | ||
} else { | ||
var checkCaptcha = new RegExp('^' + data.captcha + '$', 'i').test(client.captcha); | ||
if (checkCaptcha) { | ||
var code = ''+data.code+''; | ||
code = code.toLowerCase(); | ||
|
||
GiftCode.findOne({'code':code}, {}, function(err, check) { | ||
if (!!check) { | ||
var d1 = Date.parse(new Date()); | ||
var d2 = Date.parse(check.todate); | ||
if (d2 > d1) { | ||
if (void 0 !== check.uid) { | ||
client.red({notice:{title:'THẤT BẠI',text:'Mã Gift Code đã qua sử dụng.' + '\n' + ' Hãy thử một mã khác...'}}); | ||
}else{ | ||
if (validator.isEmpty(check.type)) { | ||
check.uid = client.UID; | ||
check.save(); | ||
UserInfo.findOneAndUpdate({id: client.UID}, {$inc:{red:check.red, xu:check.xu}}).exec(function(err, user){ | ||
client.red({notice:{title:'THÀNH CÔNG',text:'Bạn nhận được: ' + (check.red > 0 ? Helpers.numberWithCommas(check.red) + ' RED' : '') + (check.xu > 0 ? (check.red > 0 ? ' và ' : '') + Helpers.numberWithCommas(check.xu) + ' XU' : '')}, user:{red:user.red*1+check.red, xu:user.xu*1+check.xu}}); | ||
}); | ||
}else{ | ||
GiftCode.findOne({'uid': client.UID, 'type': check.type}, 'code', function(err, check2) { | ||
if (!!check2) { | ||
client.red({notice:{title:'THẤT BẠI',text:'Bạn đã từng sử dụng họ Gift Code này trước đây...!!'}}); | ||
}else{ | ||
check.uid = client.UID; | ||
check.save(); | ||
UserInfo.findOneAndUpdate({id: client.UID}, {$inc:{red:check.red, xu:check.xu}}).exec(function(err, user){ | ||
client.red({notice:{title:'THÀNH CÔNG',text:'Bạn nhận được: ' + (check.red > 0 ? Helpers.numberWithCommas(check.red) + ' RED' : '') + (check.xu > 0 ? (check.red > 0 ? ' và ' : '') + Helpers.numberWithCommas(check.xu) + ' XU' : '')}, user:{red:user.red*1+check.red, xu:user.xu*1+check.xu}}); | ||
}); | ||
} | ||
}) | ||
} | ||
} | ||
}else{ | ||
client.red({notice:{title:'THẤT BẠI',text:'Mã Gift Code Đã hết hạn...!!'}}); | ||
} | ||
}else{ | ||
client.red({notice:{title:'THẤT BẠI',text:'Mã Gift Code không tồn tại...!!'}}); | ||
} | ||
}); | ||
}else{ | ||
client.red({notice:{title:'THẤT BẠI',text:'Captcha không đúng.'}}); | ||
} | ||
} | ||
} | ||
client.c_captcha('giftcode'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
var update = require('./message/update'); | ||
var view = require('./message/view'); | ||
|
||
module.exports = function(client, data){ | ||
if (!!data.update) { | ||
update(client); | ||
} | ||
if (!!data.view) { | ||
view(client, data.view); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
let UserInfo = require('../Models/UserInfo'); | ||
let OTP = require('../Models/OTP'); | ||
let Phone = require('../Models/Phone'); | ||
let telegram = require('../Models/Telegram'); | ||
|
||
let smsOTP = require('../sms').sendOTP; | ||
|
||
function createOTP(client, type){ | ||
type = type>>0; | ||
Phone.findOne({'uid':client.UID}, function(err3, check){ | ||
if (check) { | ||
OTP.findOne({'uid': client.UID, 'phone':check.phone}, {}, {sort:{'_id':-1}}, function(err1, data){ | ||
if (!data || ((new Date()-Date.parse(data.date))/1000) > 180 || data.active) { | ||
// Tạo mã OTP mới | ||
UserInfo.findOne({'id': client.UID}, 'red', function(err2, user){ | ||
if (user) { | ||
let otp = (Math.random()*(9999-1000+1)+1000)>>0; // OTP từ 1000 đến 9999 | ||
if (type == '1') { | ||
// App OTP | ||
telegram.findOne({'phone':check.phone}, 'form', function(err3, teleCheck){ | ||
if (!!teleCheck) { | ||
OTP.create({'uid':client.UID, 'phone':check.phone, 'code':otp, 'date':new Date()}); | ||
client.red({notice:{title:'THÔNG BÁO', text:'Mã OTP đã được gửi tới Telegram của bạn.'}}); | ||
client.redT.telegram.sendMessage(teleCheck.form, '*OTP*: ' + otp + '', {parse_mode:'markdown', reply_markup:{remove_keyboard: true}}); | ||
}else{ | ||
client.red({notice:{title:'THẤT BẠI', text:'Bạn cần sử dụng Telegram để lấy OTP.'}}); | ||
} | ||
}); | ||
} else if (type == '2') { | ||
// SMS OTP | ||
if (user.red < 1000) { | ||
client.red({notice:{title:'THẤT BẠI', text:'Số dư trong tài khoản không đủ để lấy OTP.'}}); | ||
}else{ | ||
// Lấy SMS OTP | ||
user.red -= 1000; | ||
user.save(); | ||
|
||
smsOTP(check.region+check.phone, otp); | ||
|
||
OTP.create({'uid':client.UID, 'phone':check.phone, 'code':otp, 'date':new Date()}); | ||
client.red({notice:{title:'THÔNG BÁO', text:'Mã OTP được gửi tới số điện thoại của bạn.'}, user:{red:user.red}}); | ||
} | ||
} | ||
} | ||
}); | ||
}else{ | ||
client.red({notice:{title:'OTP', text:'Vui lòng kiểm tra hòm thư đến.!'}}); | ||
} | ||
}); | ||
}else{ | ||
client.red({notice:{title:'THÔNG BÁO', text:'Bạn cần kích hoạt số điện thoại để sử dụng chức năng này.', button: {text: 'KÍCH HOẠT', type: 'reg_otp'}}}); | ||
} | ||
}); | ||
} | ||
|
||
module.exports = function(client, data){ | ||
if (!!data.type){ | ||
createOTP(client, data.type); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
var nap_the = require('./shop/nap_the'); | ||
var mua_the = require('./shop/mua_the'); | ||
var mua_xu = require('./shop/mua_xu.js'); | ||
var chuyen_red = require('./shop/chuyen_red'); | ||
var get_daily = require('./shop/get_daily'); | ||
|
||
var info_thanhtoan = require('./shop/info_thanhtoan'); | ||
|
||
var bank = require('./shop/bank'); | ||
|
||
|
||
module.exports = function(client, data){ | ||
if (!!data) { | ||
if (!!data.nap_the) { | ||
nap_the(client, data.nap_the); | ||
} | ||
if (!!data.mua_the) { | ||
mua_the(client, data.mua_the); | ||
} | ||
if (!!data.mua_xu) { | ||
mua_xu(client, data.mua_xu); | ||
} | ||
if (!!data.chuyen_red) { | ||
chuyen_red(client, data.chuyen_red); | ||
} | ||
if (!!data.get_daily) { | ||
get_daily(client); | ||
} | ||
if (void 0 !== data.info_nap) { | ||
info_thanhtoan(client, 1); | ||
} | ||
if (void 0 !== data.info_mua) { | ||
info_thanhtoan(client); | ||
} | ||
|
||
if (!!data.bank) { | ||
bank(client, data.bank); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
var TaiXiu = require('./taixiu/index.js'); | ||
var getLogChat = require('./taixiu/getLogChat'); | ||
|
||
module.exports = function(client, data){ | ||
if (void 0 !== data.view) { | ||
client.gameEvent.viewTaiXiu = !!data.view; | ||
} | ||
if (!!data.getLogs) { | ||
TaiXiu.getLogs(client); | ||
} | ||
if (!!data.cuoc) { | ||
TaiXiu.cuoc(client, data.cuoc); | ||
} | ||
if (!!data.chat) { | ||
TaiXiu.chat(client, data.chat); | ||
} | ||
if (!!data.get_phien) { | ||
TaiXiu.get_phien(client, data.get_phien); | ||
} | ||
if (!!data.get_log) { | ||
TaiXiu.get_log(client, data.get_log); | ||
} | ||
if (!!data.get_top) { | ||
TaiXiu.get_top(client, data.get_top); | ||
} | ||
if (!!data.get_new) { | ||
TaiXiu.getNew(client); | ||
} | ||
if (!!data.getLogChat) { | ||
getLogChat(client); | ||
} | ||
} |
Oops, something went wrong.