|
|
@@ -683,7 +683,7 @@ proto.queryBalanceAsync = P.coroutine(function* (query, method, res){var respons
|
|
|
|
|
|
proto.deductUsdtAsync = P.coroutine(function* (query, method, res){var response = {}
|
|
|
response.code = 200
|
|
|
- response.message = ""
|
|
|
+ response.message = "success"
|
|
|
console.warn("deductUsdtAsync query:",query)
|
|
|
var app_key = query["app_key"]
|
|
|
if (!app_key) {
|
|
|
@@ -714,6 +714,7 @@ proto.deductUsdtAsync = P.coroutine(function* (query, method, res){var response
|
|
|
response.message = "token invalid"
|
|
|
return this.writeOut(response, res);
|
|
|
}
|
|
|
+ usdt_amount = Number(usdt_amount)
|
|
|
if (!checkFishUSDTSign(query)) {
|
|
|
response.code = 403
|
|
|
response.message = "sign error"
|
|
|
@@ -751,21 +752,25 @@ proto.deductUsdtAsync = P.coroutine(function* (query, method, res){var response
|
|
|
timestamp: Date.now(),
|
|
|
gameType:query["game_type"]
|
|
|
});
|
|
|
- player.diamond -= usdt_amount
|
|
|
+
|
|
|
response.usdt = player.diamond
|
|
|
var diamondrecord = new app.models.DiamondRecord({
|
|
|
_id: uuid.v1(),
|
|
|
playerId: player._id,
|
|
|
dType: 25,//withdraw fail
|
|
|
- dSource: player.diamon ,
|
|
|
+ dSource: player.diamond,
|
|
|
dSwap: 0-usdt_amount,
|
|
|
dNow: player.diamond - usdt_amount,
|
|
|
- tableId: -amount,
|
|
|
+ tableId: -usdt_amount,
|
|
|
gameType:query["game_type"],
|
|
|
});
|
|
|
+ player.diamond -= usdt_amount
|
|
|
yield diamondrecord.saveAsync()
|
|
|
yield record.saveAsync()
|
|
|
yield player.saveAsync()
|
|
|
+ response.deduct_usdt = String(usdt_amount)
|
|
|
+ response.remain_usdt = String(player.diamond)
|
|
|
+ console.warn("deductUsdtAsync response:",response)
|
|
|
return self.writeOut(response, res);
|
|
|
}), app.getServerId())
|
|
|
.then(() => app.event.emit('transactionSuccess'), () => app.event.emit('transactionFail'));
|
|
|
@@ -774,7 +779,7 @@ proto.deductUsdtAsync = P.coroutine(function* (query, method, res){var response
|
|
|
|
|
|
proto.addUsdtAsync = P.coroutine(function* (query, method, res){var response = {}
|
|
|
response.code = 200
|
|
|
- response.message = ""
|
|
|
+ response.message = "success"
|
|
|
console.warn("addUsdtAsync query:",query)
|
|
|
var app_key = query["app_key"]
|
|
|
if (!app_key) {
|
|
|
@@ -805,6 +810,7 @@ proto.addUsdtAsync = P.coroutine(function* (query, method, res){var response = {
|
|
|
response.message = "token invalid"
|
|
|
return this.writeOut(response, res);
|
|
|
}
|
|
|
+ usdt_amount = Number(usdt_amount)
|
|
|
if (!checkFishUSDTSign(query)) {
|
|
|
response.code = 403
|
|
|
response.message = "sign error"
|
|
|
@@ -836,7 +842,6 @@ proto.addUsdtAsync = P.coroutine(function* (query, method, res){var response = {
|
|
|
timestamp: Date.now(),
|
|
|
gameType:query["game_type"],
|
|
|
});
|
|
|
- player.diamond += usdt_amount
|
|
|
response.usdt = player.diamond
|
|
|
var diamondrecord = new app.models.DiamondRecord({
|
|
|
_id: uuid.v1(),
|
|
|
@@ -845,12 +850,15 @@ proto.addUsdtAsync = P.coroutine(function* (query, method, res){var response = {
|
|
|
dSource: player.diamond,
|
|
|
dSwap: usdt_amount,
|
|
|
dNow: player.diamond + usdt_amount,
|
|
|
- tableId: -amount,
|
|
|
+ tableId: usdt_amount,
|
|
|
gameType:query["game_type"],
|
|
|
});
|
|
|
+ player.diamond += usdt_amount
|
|
|
yield diamondrecord.saveAsync()
|
|
|
yield record.saveAsync()
|
|
|
yield player.saveAsync()
|
|
|
+ response.add_usdt = String(usdt_amount)
|
|
|
+ response.remain_usdt = String(player.diamond)
|
|
|
return self.writeOut(response, res);
|
|
|
}), app.getServerId())
|
|
|
.then(() => app.event.emit('transactionSuccess'), () => app.event.emit('transactionFail'));
|
|
|
@@ -859,7 +867,7 @@ proto.addUsdtAsync = P.coroutine(function* (query, method, res){var response = {
|
|
|
|
|
|
proto.refundUsdtAsync = P.coroutine(function* (query, method, res){var response = {}
|
|
|
response.code = 200
|
|
|
- response.message = ""
|
|
|
+ response.message = "success"
|
|
|
console.warn("refundUsdtAsync query:",query)
|
|
|
var app_key = query["app_key"]
|
|
|
if (!app_key) {
|
|
|
@@ -896,6 +904,7 @@ proto.refundUsdtAsync = P.coroutine(function* (query, method, res){var response
|
|
|
response.message = "token invalid"
|
|
|
return this.writeOut(response, res);
|
|
|
}
|
|
|
+ usdt_amount = Number(usdt_amount)
|
|
|
if (!checkFishUSDTSign(query)) {
|
|
|
response.code = 403
|
|
|
response.message = "sign error"
|
|
|
@@ -959,6 +968,8 @@ proto.refundUsdtAsync = P.coroutine(function* (query, method, res){var response
|
|
|
response.usdt = player.diamond
|
|
|
yield thirdRefundRecord.saveAsync()
|
|
|
yield player.saveAsync()
|
|
|
+ response.refund_usdt = String(usdt_amount)
|
|
|
+ response.remain_usdt = String(player.diamond)
|
|
|
return self.writeOut(response, res);
|
|
|
}), app.getServerId())
|
|
|
.then(() => app.event.emit('transactionSuccess'), () => app.event.emit('transactionFail'));
|
|
|
@@ -1408,7 +1419,7 @@ function checkFishUSDTSign(query) {
|
|
|
return key + '=' + value; // 避免模板字符串,用字符串拼接更兼容
|
|
|
})
|
|
|
.join('&');
|
|
|
- var signKey = md5(queryStr+"&key=TGv4NBh80V7JbED39xyjX6PdsWnHZK2tcpAueFMm").toLowerCase();
|
|
|
+ var signKey = md5("TGv4NBh80V7JbED39xyjX6PdsWnHZK2tcpAueFMm"+queryStr).toLowerCase();
|
|
|
console.warn("queryStr:",queryStr)
|
|
|
console.warn("signKey:",signKey)
|
|
|
var sign = query["sign"]
|