|
@@ -373,12 +373,12 @@ proto.savePlayer = P.coroutine(function* (userid,address) {
|
|
|
.then(() => app.event.emit('transactionSuccess'), () => app.event.emit('transactionFail'));
|
|
.then(() => app.event.emit('transactionSuccess'), () => app.event.emit('transactionFail'));
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-proto.getDepositAddress = P.coroutine(function* (suffix) {
|
|
|
|
|
|
|
+proto.getDepositAddress = P.coroutine(function* (suffix,coinurl) {
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
- const url = 'https://bar-coinpay.ala456.com/api/deposit/address?' + suffix;
|
|
|
|
|
|
|
+ const url = "https://"+coinurl+'/api/deposit/address?' + suffix;
|
|
|
|
|
|
|
|
https.get(url, (res) => {
|
|
https.get(url, (res) => {
|
|
|
- console.warn("300");
|
|
|
|
|
|
|
+ console.warn("300 url:",url);
|
|
|
res.setEncoding('utf8');
|
|
res.setEncoding('utf8');
|
|
|
|
|
|
|
|
if (res.statusCode !== 200) {
|
|
if (res.statusCode !== 200) {
|
|
@@ -445,7 +445,9 @@ proto.payUsdtLoctionAsync = P.coroutine(function* (query, method, res) {
|
|
|
response.address = player.address
|
|
response.address = player.address
|
|
|
return self.writeOut(response, res);
|
|
return self.writeOut(response, res);
|
|
|
}
|
|
}
|
|
|
- let parsedData = yield self.getDepositAddress(suffix)
|
|
|
|
|
|
|
+ let sgjconfigs = yield app.models.SGJConfig.findMongoAsync();
|
|
|
|
|
+ var sgjconfig = sgjconfigs[0]
|
|
|
|
|
+ let parsedData = yield self.getDepositAddress(suffix,sgjconfig.coinurl)
|
|
|
console.log("parsedData:",parsedData)
|
|
console.log("parsedData:",parsedData)
|
|
|
yield self.savePlayer(userid,parsedData.data.address);
|
|
yield self.savePlayer(userid,parsedData.data.address);
|
|
|
response.address = parsedData.data.address
|
|
response.address = parsedData.data.address
|
|
@@ -619,7 +621,7 @@ proto.withdrawstartAsync = P.coroutine(function* (query, method, res){
|
|
|
response.message = "param is wrong"
|
|
response.message = "param is wrong"
|
|
|
return this.writeOut(response, res);
|
|
return this.writeOut(response, res);
|
|
|
}
|
|
}
|
|
|
- if (amount < sgjconfig.withdrawlowlimit) {
|
|
|
|
|
|
|
+ if (amount < sgjconfig.withdrawlowlimit || amount <= 0) {
|
|
|
response.code = "1"
|
|
response.code = "1"
|
|
|
response.message = "withdraw must bigger than " + sgjconfig.withdrawlowlimit
|
|
response.message = "withdraw must bigger than " + sgjconfig.withdrawlowlimit
|
|
|
return this.writeOut(response, res);
|
|
return this.writeOut(response, res);
|
|
@@ -705,7 +707,7 @@ proto.withdrawstartAsync = P.coroutine(function* (query, method, res){
|
|
|
yield diamondrecord.saveAsync()
|
|
yield diamondrecord.saveAsync()
|
|
|
yield player.saveAsync()
|
|
yield player.saveAsync()
|
|
|
yield record.saveAsync();
|
|
yield record.saveAsync();
|
|
|
- var data = yield self.withdrawSubmit(amount-sgjconfig.withdrawfee, targetAddress, userid,timestamp)
|
|
|
|
|
|
|
+ var data = yield self.withdrawSubmit(amount-sgjconfig.withdrawfee, targetAddress, userid,timestamp,sgjconfig.coinurl)
|
|
|
if (!data.success) {
|
|
if (!data.success) {
|
|
|
beforeusdt = player.diamond
|
|
beforeusdt = player.diamond
|
|
|
afterusdt = (Number(player.diamond) + Number(amount)).toFixed(2)
|
|
afterusdt = (Number(player.diamond) + Number(amount)).toFixed(2)
|
|
@@ -724,7 +726,7 @@ proto.withdrawstartAsync = P.coroutine(function* (query, method, res){
|
|
|
SGJUserTongji.feeconfigusdt = (Number(SGJUserTongji.feeconfigusdt) -Number(sgjconfig.withdrawfee)).toFixed(2)//下注
|
|
SGJUserTongji.feeconfigusdt = (Number(SGJUserTongji.feeconfigusdt) -Number(sgjconfig.withdrawfee)).toFixed(2)//下注
|
|
|
record.time = Date.now()
|
|
record.time = Date.now()
|
|
|
record.callBackTime = Date.now()
|
|
record.callBackTime = Date.now()
|
|
|
- record.msg = data.data.message
|
|
|
|
|
|
|
+ record.msg = data.message
|
|
|
record.status = 2
|
|
record.status = 2
|
|
|
yield record.saveAsync();
|
|
yield record.saveAsync();
|
|
|
yield player.saveAsync()
|
|
yield player.saveAsync()
|
|
@@ -766,7 +768,6 @@ proto.clearAsync = P.coroutine(function* (query, method, res){
|
|
|
var players = yield app.models.Player.findMongoAsync()
|
|
var players = yield app.models.Player.findMongoAsync()
|
|
|
for (var i = 0; i < players.length; i++) {
|
|
for (var i = 0; i < players.length; i++) {
|
|
|
console.warn("685 players:", players[i].userId)
|
|
console.warn("685 players:", players[i].userId)
|
|
|
- yield players[i].saveAsync()
|
|
|
|
|
yield players[i].removeAsync()
|
|
yield players[i].removeAsync()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -919,7 +920,7 @@ proto.clearAsync = P.coroutine(function* (query, method, res){
|
|
|
|
|
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-proto.withdrawSubmit = P.coroutine(function* (amount, targetAddress, userid,timestamp) {
|
|
|
|
|
|
|
+proto.withdrawSubmit = P.coroutine(function* (amount, targetAddress, userid,timestamp, coinurl) {
|
|
|
// https://bar-coinpay.ala456.com/api/withdraw/submit?additionalAudit=false&amount=0.01&chainCode=tron&refOrderId=ORDER20260228001&targetAddress=TD92sxkgUHHadcoSiHY6Bus5fA9rsAYAKZ×tamp=1772270280000&tokenCode=usdt&userId=123&sign=bfb1d7bf14f5217cac9204b929ca4334
|
|
// https://bar-coinpay.ala456.com/api/withdraw/submit?additionalAudit=false&amount=0.01&chainCode=tron&refOrderId=ORDER20260228001&targetAddress=TD92sxkgUHHadcoSiHY6Bus5fA9rsAYAKZ×tamp=1772270280000&tokenCode=usdt&userId=123&sign=bfb1d7bf14f5217cac9204b929ca4334
|
|
|
|
|
|
|
|
|
|
|
|
@@ -933,7 +934,7 @@ proto.withdrawSubmit = P.coroutine(function* (amount, targetAddress, userid,time
|
|
|
let postDataStr = '';
|
|
let postDataStr = '';
|
|
|
|
|
|
|
|
let options = {
|
|
let options = {
|
|
|
- hostname: 'bar-coinpay.ala456.com',
|
|
|
|
|
|
|
+ hostname: coinurl,
|
|
|
port: '',
|
|
port: '',
|
|
|
path: '/api/withdraw/submit?'+suffix,
|
|
path: '/api/withdraw/submit?'+suffix,
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
@@ -1209,7 +1210,7 @@ proto.withdrawOkAsync = P.coroutine(function* (query, method, res) {
|
|
|
let records = yield app.models.UsdtWithdrawRecord.findMongoAsync({ refOrderId: refOrderId });
|
|
let records = yield app.models.UsdtWithdrawRecord.findMongoAsync({ refOrderId: refOrderId });
|
|
|
if (records.length > 0) {
|
|
if (records.length > 0) {
|
|
|
var record = records[0]
|
|
var record = records[0]
|
|
|
- if ((record.amount-record.submifee).toFixed(2) != am.toFixed(2) ) {
|
|
|
|
|
|
|
+ if ((record.amount-record.submitfee).toFixed(2) != am.toFixed(2) ) {
|
|
|
response.code = "1"
|
|
response.code = "1"
|
|
|
response.message = "金额不匹配"
|
|
response.message = "金额不匹配"
|
|
|
console.warn("1208")
|
|
console.warn("1208")
|