1
This commit is contained in:
parent
bda42a1bb4
commit
354dfb34d0
@ -28,14 +28,14 @@ class BcUserController extends BaseController {
|
|||||||
$gameId = 2006;
|
$gameId = 2006;
|
||||||
$channel = BC_CHANNEL;
|
$channel = BC_CHANNEL;
|
||||||
$accountId = phpcommon\createAccountId($channel, $gameId, $account);
|
$accountId = phpcommon\createAccountId($channel, $gameId, $account);
|
||||||
$conn = myself()->_getMysql($accontId);
|
$conn = myself()->_getMysql($accountId);
|
||||||
$userRow = SqlHelper::ormSelect(
|
$userRow = SqlHelper::ormSelectOne(
|
||||||
$conn,
|
$conn,
|
||||||
't_user',
|
't_user',
|
||||||
array(
|
array(
|
||||||
'account_id' => $accountId,
|
'account_id' => $accountId,
|
||||||
));
|
));
|
||||||
$walletOfflineRow = SqlHelper::ormSelect(
|
$walletOfflineRow = SqlHelper::ormSelectOne(
|
||||||
$conn,
|
$conn,
|
||||||
't_user_wallet_offline',
|
't_user_wallet_offline',
|
||||||
array(
|
array(
|
||||||
|
@ -18,7 +18,7 @@ use models\Withdrawal;
|
|||||||
use models\Transfer;
|
use models\Transfer;
|
||||||
use models\UserWalletRecord;
|
use models\UserWalletRecord;
|
||||||
|
|
||||||
class Callback extends BaseController {
|
class CallbackController extends BaseController {
|
||||||
|
|
||||||
private function isTestMode()
|
private function isTestMode()
|
||||||
{
|
{
|
||||||
@ -31,13 +31,13 @@ class Callback extends BaseController {
|
|||||||
$account = strtolower(getReqVal('account', ''));
|
$account = strtolower(getReqVal('account', ''));
|
||||||
$txHash = getReqVal('txhash', '');
|
$txHash = getReqVal('txhash', '');
|
||||||
$type = getReqVal('type', '');
|
$type = getReqVal('type', '');
|
||||||
$value = getReqVal('value', '');
|
$value = getReqVal('value', '0');
|
||||||
|
|
||||||
$gameId = 2006;
|
$gameId = 2006;
|
||||||
$channel = BC_CHANNEL;
|
$channel = BC_CHANNEL;
|
||||||
$accountId = phpcommon\createAccountId($channel, $gameId, $account);
|
$accountId = phpcommon\createAccountId($channel, $gameId, $account);
|
||||||
|
|
||||||
$conn = myself()->_getMysql($accontId);
|
$conn = myself()->_getMysql($accountId);
|
||||||
if (UserWalletRecord::find($conn, $txHash)) {
|
if (UserWalletRecord::find($conn, $txHash)) {
|
||||||
myself()->_rspOk();
|
myself()->_rspOk();
|
||||||
return;
|
return;
|
||||||
@ -52,10 +52,14 @@ class Callback extends BaseController {
|
|||||||
myself()->_rspErr(2, '');
|
myself()->_rspErr(2, '');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ($value < 0) {
|
||||||
|
myself()->_rspErr(3, '');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$gold = 0;
|
$gold = 0;
|
||||||
$diamond = 0;
|
$diamond = 0;
|
||||||
if ($type == 0) {
|
if ($type == 1) {
|
||||||
$gold = $value;
|
$gold = $value;
|
||||||
} else {
|
} else {
|
||||||
$diamond = $value;
|
$diamond = $value;
|
||||||
@ -80,10 +84,10 @@ class Callback extends BaseController {
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'gold' => function() use($gold) {
|
'gold' => function() use($gold) {
|
||||||
return 'max(0, gold + ${gold})';
|
return "CASE WHEN gold + ${gold} < 0 THEN 0 ELSE gold + ${gold} END";
|
||||||
},
|
},
|
||||||
'diamond' => function() use($diamond) {
|
'diamond' => function() use($diamond) {
|
||||||
return 'max(0, diamond + ${diamond}';
|
return "CASE WHEN diamond + ${diamond} < 0 THEN 0 ELSE diamond + ${diamond} END";
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
@ -95,10 +99,10 @@ class Callback extends BaseController {
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'gold' => function() use($gold) {
|
'gold' => function() use($gold) {
|
||||||
return 'max(0, gold + ${gold})';
|
return "CASE WHEN gold + ${gold} < 0 THEN 0 ELSE gold + ${gold} END";
|
||||||
},
|
},
|
||||||
'diamond' => function() use($diamond) {
|
'diamond' => function() use($diamond) {
|
||||||
return 'max(0, diamond + ${diamond})';
|
return "CASE WHEN diamond + ${diamond} < 0 THEN 0 ELSE diamond + ${diamond} END";
|
||||||
},
|
},
|
||||||
'modifytime' => myself()->_getNowTime()
|
'modifytime' => myself()->_getNowTime()
|
||||||
),
|
),
|
||||||
@ -111,7 +115,7 @@ class Callback extends BaseController {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
UserWalletRecord::add($txHash, $dir, $accontId, $type, $value);
|
UserWalletRecord::add($conn, $txHash, $dir, $account, $type, $value);
|
||||||
if ($this->isTestMode()) {
|
if ($this->isTestMode()) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,13 @@ class UserWalletRecord extends BaseModel {
|
|||||||
$conn,
|
$conn,
|
||||||
't_user_wallet_record',
|
't_user_wallet_record',
|
||||||
array(
|
array(
|
||||||
'txHash' => $txHash,
|
'txhash' => $txHash,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function add($txHash, $dir, $accountId, $type, $value)
|
public static function add($conn, $txHash, $dir, $accountId, $type, $value)
|
||||||
{
|
{
|
||||||
SqlHelper::insert(
|
SqlHelper::insert(
|
||||||
$conn,
|
$conn,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user