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