126 lines
3.6 KiB
PHP
126 lines
3.6 KiB
PHP
<?php
|
|
|
|
require_once('mt/MarketGoods.php');
|
|
require_once('mt/MarketBatch.php');
|
|
require_once('mt/Item.php');
|
|
require_once('mt/WhiteList.php');
|
|
require_once('mt/Currency.php');
|
|
require_once('mt/Hero.php');
|
|
require_once('mt/Parameter.php');
|
|
|
|
require_once('models/BoxOrder.php');
|
|
require_once('models/Nft.php');
|
|
require_once('models/BuyRecord.php');
|
|
|
|
require_once('phpcommon/bchelper.php');
|
|
|
|
use phpcommon\SqlHelper;
|
|
use models\BoxOrder;
|
|
use models\Nft;
|
|
use models\BuyRecord;
|
|
|
|
class BcUserController extends BaseController {
|
|
|
|
public function info()
|
|
{
|
|
$account = strtolower(getReqVal('account', ''));
|
|
$token = getReqVal('token', '');
|
|
$gameId = 2006;
|
|
$channel = BC_CHANNEL;
|
|
$accountId = phpcommon\createAccountId($channel, $gameId, $account);
|
|
$conn = myself()->_getMarketMysql($accountId);
|
|
$row = SqlHelper::ormSelectOne(
|
|
$conn,
|
|
't_user_wallet_offline_temp',
|
|
array(
|
|
'account_id' => $accountId,
|
|
));
|
|
|
|
$gold = 0;
|
|
$diamond = 0;
|
|
if ($row) {
|
|
$gold = $row['gold'];
|
|
$diamond = $row['diamond'];
|
|
}
|
|
myself()->_rspData(array(
|
|
'gold' => $gold,
|
|
'diamond' => $diamond
|
|
));
|
|
}
|
|
|
|
private function old_info()
|
|
{
|
|
$account = strtolower(getReqVal('account', ''));
|
|
$token = getReqVal('token', '');
|
|
$gameId = 2006;
|
|
$channel = BC_CHANNEL;
|
|
$accountId = phpcommon\createAccountId($channel, $gameId, $account);
|
|
$conn = myself()->_getMysql($accountId);
|
|
$userRow = SqlHelper::ormSelectOne(
|
|
$conn,
|
|
't_user',
|
|
array(
|
|
'account_id' => $accountId,
|
|
));
|
|
$walletOfflineRow = SqlHelper::ormSelectOne(
|
|
$conn,
|
|
't_user_wallet_offline',
|
|
array(
|
|
'account_id' => $accountId,
|
|
));
|
|
if (SERVER_ENV == _TEST) {
|
|
if (!$userRow && !$walletOfflineRow) {
|
|
SqlHelper::insert(
|
|
$conn,
|
|
't_user_wallet_offline',
|
|
array(
|
|
'account_id' => $accountId,
|
|
'gold' => 10000,
|
|
'diamond' => 10000,
|
|
'createtime' => myself()->_getNowTime(),
|
|
'modifytime' => myself()->_getNowTime()
|
|
)
|
|
);
|
|
}
|
|
$userRow = SqlHelper::ormSelectOne(
|
|
$conn,
|
|
't_user',
|
|
array(
|
|
'account_id' => $accountId,
|
|
));
|
|
$walletOfflineRow = SqlHelper::ormSelectOne(
|
|
$conn,
|
|
't_user_wallet_offline',
|
|
array(
|
|
'account_id' => $accountId,
|
|
));
|
|
}
|
|
$gold = 0;
|
|
$diamond = 0;
|
|
if ($userRow) {
|
|
$gold += $userRow['gold'];
|
|
$diamond += $userRow['diamond'];
|
|
}
|
|
if ($walletOfflineRow) {
|
|
$gold += $walletOfflineRow['gold'];
|
|
$diamond += $walletOfflineRow['diamond'];
|
|
}
|
|
if (SERVER_ENV == _TEST) {
|
|
if (!$userRow && !$walletOfflineRow) {
|
|
SqlHelper::ormSelectOne(
|
|
$conn,
|
|
't_user_wallet_offline',
|
|
array(
|
|
'account_id' => $accountId,
|
|
));
|
|
}
|
|
}
|
|
myself()->_rspData(array(
|
|
'account' => $account,
|
|
'gold' => $gold,
|
|
'diamond' => $diamond
|
|
));
|
|
}
|
|
|
|
}
|