1
This commit is contained in:
parent
86055a89f9
commit
5ddbf481ff
@ -149,7 +149,7 @@ DROP TABLE IF EXISTS `t_withdrawal`;
|
|||||||
CREATE TABLE `t_withdrawal` (
|
CREATE TABLE `t_withdrawal` (
|
||||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
`account` varchar(255) NOT NULL DEFAULT '' COMMENT 'account',
|
`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',
|
`net_id` int(11) NOT NULL DEFAULT '0' COMMENT 'net_id',
|
||||||
`amount` bigint NOT NULL DEFAULT '0' COMMENT 'amount',
|
`amount` bigint NOT NULL DEFAULT '0' COMMENT 'amount',
|
||||||
`state` int(11) NOT NULL DEFAULT '0' COMMENT 'state 0:等待上链 1:上链中2:上链成功 3:提现失败',
|
`state` int(11) NOT NULL DEFAULT '0' COMMENT 'state 0:等待上链 1:上链中2:上链成功 3:提现失败',
|
||||||
|
@ -41,6 +41,33 @@ class BcUserController extends BaseController {
|
|||||||
array(
|
array(
|
||||||
'account_id' => $accountId,
|
'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;
|
$gold = 0;
|
||||||
$diamond = 0;
|
$diamond = 0;
|
||||||
if ($userRow) {
|
if ($userRow) {
|
||||||
@ -51,6 +78,16 @@ class BcUserController extends BaseController {
|
|||||||
$gold += $walletOfflineRow['gold'];
|
$gold += $walletOfflineRow['gold'];
|
||||||
$diamond += $walletOfflineRow['diamond'];
|
$diamond += $walletOfflineRow['diamond'];
|
||||||
}
|
}
|
||||||
|
if (SERVER_ENV == _TEST) {
|
||||||
|
if (!$userRow && !$walletOfflineRow) {
|
||||||
|
SqlHelper::ormSelectOne(
|
||||||
|
$conn,
|
||||||
|
't_user_wallet_offline',
|
||||||
|
array(
|
||||||
|
'account_id' => $accountId,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
myself()->_rspData(array(
|
myself()->_rspData(array(
|
||||||
'gold' => $gold,
|
'gold' => $gold,
|
||||||
'diamond' => $diamond
|
'diamond' => $diamond
|
||||||
|
@ -30,6 +30,19 @@ class WalletController extends BaseController {
|
|||||||
myself()->_rspErr(1, 'More withdrawals than today');
|
myself()->_rspErr(1, 'More withdrawals than today');
|
||||||
return;
|
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);
|
$seqId = Withdrawal::add($account, $type, $netId, $amount);
|
||||||
myself()->_rspData(array(
|
myself()->_rspData(array(
|
||||||
'seq_id' => $seqId
|
'seq_id' => $seqId
|
||||||
|
Loading…
x
Reference in New Issue
Block a user