This commit is contained in:
aozhiwei 2022-03-30 09:44:05 +08:00
parent 86055a89f9
commit 5ddbf481ff
3 changed files with 51 additions and 1 deletions

View File

@ -149,7 +149,7 @@ DROP TABLE IF EXISTS `t_withdrawal`;
CREATE TABLE `t_withdrawal` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`account` varchar(255) NOT NULL DEFAULT '' COMMENT 'account',
`type` int(11) NOT NULL DEFAULT '0' COMMENT 'type',
`type` int(11) NOT NULL DEFAULT '0' COMMENT '货币类型 1:金币 2钻石',
`net_id` int(11) NOT NULL DEFAULT '0' COMMENT 'net_id',
`amount` bigint NOT NULL DEFAULT '0' COMMENT 'amount',
`state` int(11) NOT NULL DEFAULT '0' COMMENT 'state 0:等待上链 1:上链中2:上链成功 3:提现失败',

View File

@ -41,6 +41,33 @@ class BcUserController extends BaseController {
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) {
@ -51,6 +78,16 @@ class BcUserController extends BaseController {
$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(
'gold' => $gold,
'diamond' => $diamond

View File

@ -30,6 +30,19 @@ class WalletController extends BaseController {
myself()->_rspErr(1, 'More withdrawals than today');
return;
}
if (!in_array($type, array(1, 2))){
myself()->_rspErr(2, 'parameter error');
return;
}
if (strlen($amount) <= 18){
myself()->_rspErr(4, 'parameter error');
return;
}
$value = substr($amount, 0, -18);
if ($value < 0 || empty($value)) {
myself()->_rspErr(4, 'parameter error');
return;
}
$seqId = Withdrawal::add($account, $type, $netId, $amount);
myself()->_rspData(array(
'seq_id' => $seqId