@ -311,7 +311,7 @@ class WalletService extends BaseHomeService
];
];
break;
break;
}
}
return $this->toData(0, 'Request successful. ', $result);
return $this->toData(0, 'successful', $result);
}
}
/**
/**
@ -333,7 +333,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -355,7 +355,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
/**
/**
@ -376,7 +376,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -398,7 +398,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -420,7 +420,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -442,7 +442,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -464,7 +464,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -481,7 +481,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -498,7 +498,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -520,7 +520,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -542,7 +542,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -564,7 +564,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -582,7 +582,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -604,7 +604,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
/**
/**
@ -625,7 +625,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
private function getUserFurStock($data, int $type = 0): array
private function getUserFurStock($data, int $type = 0): array
@ -641,7 +641,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
private function getUserEurStock($data, int $type = 0): array
private function getUserEurStock($data, int $type = 0): array
@ -657,7 +657,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
private function getUserBrlStock($data, int $type = 0): array
private function getUserBrlStock($data, int $type = 0): array
@ -673,7 +673,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
private function getUserJpStock($data, int $type = 0): array
private function getUserJpStock($data, int $type = 0): array
@ -689,7 +689,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -711,7 +711,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -730,7 +730,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -739,7 +739,7 @@ class WalletService extends BaseHomeService
$list = WalletListModel::getUserWalletList([
$list = WalletListModel::getUserWalletList([
'wallet_type' => $data['wallet_type']
'wallet_type' => $data['wallet_type']
]);
]);
return $this->toData(0, 'Request successful. ', $list);
return $this->toData(0, 'successful', $list);
}
}
/**
/**
@ -757,7 +757,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -776,7 +776,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -801,7 +801,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -820,7 +820,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -840,7 +840,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -859,7 +859,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -882,7 +882,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -901,7 +901,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -1004,19 +1004,19 @@ class WalletService extends BaseHomeService
$name = env('WALLET.NAME');
$name = env('WALLET.NAME');
$user_info = UserModel::getFieldsByUserId('trade_password,is_real,status', $data['user_id']);
$user_info = UserModel::getFieldsByUserId('trade_password,is_real,status', $data['user_id']);
if (empty($user_info['trade_password'])) {
if (empty($user_info['trade_password'])) {
return $this->toData(3, "Please set a transaction password first." );
return $this->toData(500, lang('please_set_the_transaction_password_first') );
}
}
if ($user_info['is_real'] == 0 & & $name == 'STOCK') {
if ($user_info['is_real'] == 0 & & $name == 'STOCK') {
return $this->toData('20150', 'Please authenticate with real name first', [] );
return $this->toData('500', lang('please_authenticate_with_real_name_first') );
}
}
$check_pwd = (new UnqId())->checkPassword($data['trade_pwd'], $user_info['trade_password'], $salt);
$check_pwd = (new UnqId())->checkPassword($data['trade_pwd'], $user_info['trade_password'], $salt);
if (!$check_pwd) {
if (!$check_pwd) {
return $this->toData(2, "Transaction password is incorrect." );
return $this->toData(500, lang('incorrect_transaction_password') );
}
}
// 检测是否被封禁提款
// 检测是否被封禁提款
$accountFrozen = AccountFrozenModel::where('user_id', $data['user_id'])->findOrEmpty()->toArray();
$accountFrozen = AccountFrozenModel::where('user_id', $data['user_id'])->findOrEmpty()->toArray();
if (isset($accountFrozen['frozen_withdraw']) & & $accountFrozen['frozen_withdraw'] == 1) {
if (isset($accountFrozen['frozen_withdraw']) & & $accountFrozen['frozen_withdraw'] == 1) {
return $this->toData(2, "Withdrawals are frozen" );
return $this->toData(500, lang('withdrawal_is_frozen') );
}
}
$flag = $this->checkOnlyOneNotEmpty($data['bank_id'], $data['address_id'], $data['wallet_address']);
$flag = $this->checkOnlyOneNotEmpty($data['bank_id'], $data['address_id'], $data['wallet_address']);
if ($flag) {
if ($flag) {
@ -1033,7 +1033,7 @@ class WalletService extends BaseHomeService
$pay_info['wallet_address'] = $data['wallet_address'];
$pay_info['wallet_address'] = $data['wallet_address'];
}
}
if (empty($pay_info)) {
if (empty($pay_info)) {
return $this->toData(1, 'The withdrawal information is incorrect.' );
return $this->toData(500, lang('incorrect_withdrawal_information') );
}
}
if ($data['account_type'] > 2 & & ($data['account_type'] != 8)) {
if ($data['account_type'] > 2 & & ($data['account_type'] != 8)) {
$market_rate = (new StockMarketModel())->getRate($data['account_type']);
$market_rate = (new StockMarketModel())->getRate($data['account_type']);
@ -1063,7 +1063,7 @@ class WalletService extends BaseHomeService
$cha_num = bcsub($from_account['usable_num'], $data['apply_num'], 18); //$from_account['usable_num']-$data['apply_num'];
$cha_num = bcsub($from_account['usable_num'], $data['apply_num'], 18); //$from_account['usable_num']-$data['apply_num'];
if ($cha_num < 0 ) {
if ($cha_num < 0 ) {
Db::rollback();
Db::rollback();
return $this->toData(1, 'Insufficient balance.' );
return $this->toData(500, lang('insufficient_balance') );
}
}
//插入提款记录表
//插入提款记录表
@ -1096,15 +1096,15 @@ class WalletService extends BaseHomeService
$res = $this->addUserBalanceLog($data['account_type'], $log_data);
$res = $this->addUserBalanceLog($data['account_type'], $log_data);
if (empty($res)) Db::rollback();
if (empty($res)) Db::rollback();
Db::commit();
Db::commit();
return $this->toData(0, 'Request successful. ');
return $this->toData(0, 'successful');
} catch (\Exception $exception) {
} catch (\Exception $exception) {
// 回滚事务
// 回滚事务
Db::rollback();
Db::rollback();
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
} else {
} else {
return $this->toData(1, "Please fill in the parameters according to the requirements." );
return $this->toData(500, lang('system_busy') );
}
}
}
}
@ -1119,12 +1119,12 @@ class WalletService extends BaseHomeService
'status' => 5,
'status' => 5,
'update_time' => date('Y-m-d H:i:s')
'update_time' => date('Y-m-d H:i:s')
]);
]);
return $this->toData(0, 'Request successful. ');
return $this->toData(0, 'successful');
}else{
}else{
return $this->toData(500, "System error." );
return $this->toData(500, lang('system_busy') );
}
}
} else {
} else {
return $this->toData(300, "Withdrawal orders cannot be cancelled." );
return $this->toData(500, lang('withdrawal_orders_cannot_be_cancelled') );
}
}
}
}
private function checkOnlyOneNotEmpty($value1, $value2, $value3): bool
private function checkOnlyOneNotEmpty($value1, $value2, $value3): bool
@ -1148,12 +1148,12 @@ class WalletService extends BaseHomeService
try {
try {
validate(WalletValidate::class)->scene('getDrawalList')->check($data);
validate(WalletValidate::class)->scene('getDrawalList')->check($data);
$list = UserWithdrawalModel::getUserDrawalList($data);
$list = UserWithdrawalModel::getUserDrawalList($data);
return $this->toData(0, 'Request successful. ', $list);
return $this->toData(0, 'successful', $list);
} catch (ValidateException $validateException) {
} catch (ValidateException $validateException) {
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1 ', $message, []);
return $this->toData('500 ', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -1248,7 +1248,7 @@ class WalletService extends BaseHomeService
$record_list =UserForexLogModel::getUserBalanceLog($data);
$record_list =UserForexLogModel::getUserBalanceLog($data);
break;
break;
default:
default:
return $this->toData(1, "Please fill in the parameters according to the requirements." );
return $this->toData(400, lang('parameter_error') );
break;
break;
}
}
return $this->toData(0, "ok", $record_list);
return $this->toData(0, "ok", $record_list);
@ -1264,7 +1264,7 @@ class WalletService extends BaseHomeService
try {
try {
validate(WalletValidate::class)->scene('transfer')->check($data);
validate(WalletValidate::class)->scene('transfer')->check($data);
if ($data['from_account'] == $data['to_account']) {
if ($data['from_account'] == $data['to_account']) {
return $this->toData('2', 'The transfer out and transfer in accounts cannot be the same account.' );
return $this->toData('500', lang('the_transfer_out_account_and_the_transfer_in_account_cannot_be_the_same_account') );
}
}
//事务开启, 查询用户资金
//事务开启, 查询用户资金
Db::startTrans();
Db::startTrans();
@ -1281,7 +1281,7 @@ class WalletService extends BaseHomeService
$cha_num = $from_account['usable_num'] - $data['change_num'];
$cha_num = $from_account['usable_num'] - $data['change_num'];
if ($cha_num < 0 ) {
if ($cha_num < 0 ) {
Db::rollback();
Db::rollback();
return $this->toData(1, 'Insufficient balance.' );
return $this->toData(500, lang('insufficient_balance') );
}
}
$to_num = $this->getRateToTransfer([
$to_num = $this->getRateToTransfer([
@ -1299,7 +1299,7 @@ class WalletService extends BaseHomeService
$to_account = $this->lockUserBalance($data['to_account'], $data['user_id']);
$to_account = $this->lockUserBalance($data['to_account'], $data['user_id']);
if (empty($to_account)) {
if (empty($to_account)) {
Db::rollback();
Db::rollback();
return $this->toData('2', 'error to_account ' );
return $this->toData('500', lang('data_empty') );
}
}
@ -1320,7 +1320,7 @@ class WalletService extends BaseHomeService
$res = $this->updateUserBalance($data['from_account'], $from_update, $data['user_id']);
$res = $this->updateUserBalance($data['from_account'], $from_update, $data['user_id']);
if (empty($res)) {
if (empty($res)) {
Db::rollback();
Db::rollback();
return $this->toData('2', 'error from_account transfer' );
return $this->toData('500', lang('data_empty') );
}
}
// 新增转入
// 新增转入
@ -1328,7 +1328,7 @@ class WalletService extends BaseHomeService
$res = $this->updateUserBalance($data['to_account'], $to_update, $data['user_id']);
$res = $this->updateUserBalance($data['to_account'], $to_update, $data['user_id']);
if (empty($res)) {
if (empty($res)) {
Db::rollback();
Db::rollback();
return $this->toData('2', 'error to_account transfer ' );
return $this->toData('500', lang('data_empty') );
}
}
//变动类型:1-充值,2-提现,3-买入,4-卖出,5-冻结,6-解冻,7账户转出,8账户转入
//变动类型:1-充值,2-提现,3-买入,4-卖出,5-冻结,6-解冻,7账户转出,8账户转入
@ -1342,7 +1342,7 @@ class WalletService extends BaseHomeService
$res = $this->addUserBalanceLog($data['from_account'], $from_log);
$res = $this->addUserBalanceLog($data['from_account'], $from_log);
if (empty($res)) {
if (empty($res)) {
Db::rollback();
Db::rollback();
return $this->toData('2', 'error from_log transfer' );
return $this->toData('500', lang('system_busy') );
}
}
@ -1354,22 +1354,22 @@ class WalletService extends BaseHomeService
$res = $this->addUserBalanceLog($data['to_account'], $to_log);
$res = $this->addUserBalanceLog($data['to_account'], $to_log);
if (empty($res)) {
if (empty($res)) {
Db::rollback();
Db::rollback();
return $this->toData('2', 'error to_log transfer' );
return $this->toData('500', lang('system_busy') );
}
}
Db::commit();
Db::commit();
return $this->toData(0, 'Request successful. ');
return $this->toData(0, 'successful');
} catch (\Exception $exception) {
} catch (\Exception $exception) {
// 回滚事务
// 回滚事务
Db::rollback();
Db::rollback();
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
} catch (ValidateException $validateException) {
} catch (ValidateException $validateException) {
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
@ -1678,7 +1678,7 @@ class WalletService extends BaseHomeService
$message = $validateException->getMessage();
$message = $validateException->getMessage();
return $this->toData('1', $message, []);
return $this->toData('1', $message, []);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}
public function userHasNotPay(array $data):array
public function userHasNotPay(array $data):array
@ -1708,7 +1708,7 @@ class WalletService extends BaseHomeService
}
}
}
}
return $this->toData(0, 'Request successful. ', $list);
return $this->toData(0, 'successful', $list);
}
}
@ -1720,11 +1720,10 @@ class WalletService extends BaseHomeService
->where('usable_num','>=',$total)
->where('usable_num','>=',$total)
->find();
->find();
if(empty($res)){
if(empty($res)){
return $this->toData(1, 'The balance is not enough.' );
return $this->toData('500', lang('system_busy') );
}
}
$order_list=UserArrearsModel::where('user_id',$data['user_id'])->where('account_type',$data['market_type'])->select();
$order_list=UserArrearsModel::where('user_id',$data['user_id'])->where('account_type',$data['market_type'])->select();
$nowDate=date('Y-m-d H:i:s');
$nowDate=date('Y-m-d H:i:s');
Db::startTrans();
Db::startTrans();
@ -1734,7 +1733,7 @@ class WalletService extends BaseHomeService
->update(['update_time' => $nowDate]);
->update(['update_time' => $nowDate]);
if(!$update_bool){
if(!$update_bool){
Db::rollback();
Db::rollback();
return $this->toData('1', 'system error0', [] );
return $this->toData('500', lang('system_busy') );
}
}
foreach ($order_list as $order){
foreach ($order_list as $order){
@ -1752,7 +1751,7 @@ class WalletService extends BaseHomeService
$log_bool = Db::table($table_obj['log_table'])->insert($insertStockLogArr);
$log_bool = Db::table($table_obj['log_table'])->insert($insertStockLogArr);
if(!$log_bool){
if(!$log_bool){
Db::rollback();
Db::rollback();
return $this->toData('1', 'system error1', [] );
return $this->toData('500', lang('system_busy') );
}
}
// 生成扣手续流水
// 生成扣手续流水
$insertStockLogArrFee = [
$insertStockLogArrFee = [
@ -1777,7 +1776,7 @@ class WalletService extends BaseHomeService
]);
]);
if (!$status_bool) {
if (!$status_bool) {
Db::rollback();
Db::rollback();
return $this->toData('1', 'system error2', [] );
return $this->toData('500', lang('system_busy') );
}
}
//更新订单状态
//更新订单状态
if(env('USER_ARREARS.HAS_USER_ARREARS')==3){
if(env('USER_ARREARS.HAS_USER_ARREARS')==3){
@ -1789,7 +1788,7 @@ class WalletService extends BaseHomeService
]);
]);
if (!$order_bool) {
if (!$order_bool) {
Db::rollback();
Db::rollback();
return $this->toData('1', 'system error3'.Db::table($table_obj['order_table'])->getLastSql(), [] );
return $this->toData('500', lang('system_busy') );
}
}
}
}
@ -1800,7 +1799,7 @@ class WalletService extends BaseHomeService
Db::commit();
Db::commit();
return $this->toData(0, 'Request successful. ',[] );
return $this->toData(0, 'successful');
}
}
// 获取账户之间划转手续费
// 获取账户之间划转手续费
public function getRateToTransfer($data)
public function getRateToTransfer($data)
@ -1818,7 +1817,7 @@ class WalletService extends BaseHomeService
}
}
if ($fromAccount == $toAccount) {
if ($fromAccount == $toAccount) {
return $this->toData('2', 'The transfer out and transfer in accounts cannot be the same account.' );
return $this->toData('500', lang('the_transfer_out_account_and_the_transfer_in_account_cannot_be_the_same_account') );
}
}
// 转出地址对美元的汇率
// 转出地址对美元的汇率
@ -1826,11 +1825,11 @@ class WalletService extends BaseHomeService
$toRate = (new StockMarketModel())->getRate($toAccount);
$toRate = (new StockMarketModel())->getRate($toAccount);
if ($fromRate < = 0) {
if ($fromRate < = 0) {
return $this->toData('2', 'Transfer out account type is incorrect.' );
return $this->toData('500', lang('the_transfer_account_type_is_incorrect') );
}
}
if ($toRate < = 0) {
if ($toRate < = 0) {
return $this->toData('2', 'Transfer in account type is incorrect.' );
return $this->toData('500', lang('incorrect_transfer_account_type') );
}
}
// 是否传递转账数量
// 是否传递转账数量
@ -1845,7 +1844,7 @@ class WalletService extends BaseHomeService
'to_change_num' => $toChangeNum
'to_change_num' => $toChangeNum
]);
]);
} catch (\Exception $exception) {
} catch (\Exception $exception) {
return $this->toData('100500', 'The system is busy. Please try again later.' , [$exception->getMessage(), $exception->getTrace()]);
return $this->toData('500', lang('system_busy') , [$exception->getMessage(), $exception->getTrace()]);
}
}
}
}