|
|
@ -18,6 +18,7 @@ use app\model\UserContractSecModel; |
|
|
|
use app\model\UserDigitalModel; |
|
|
|
use app\model\UserForexLogModel; |
|
|
|
use app\model\UserForexModel; |
|
|
|
use app\model\UserGoldFuturesLogModel; |
|
|
|
use app\model\UserGoldFuturesModel; |
|
|
|
use app\model\UserHkdPreStockOrderModel; |
|
|
|
use app\model\UserIdnPreStockOrderModel; |
|
|
@ -66,6 +67,7 @@ use app\model\WalletListModel; |
|
|
|
use app\utility\UnqId; |
|
|
|
use think\exception\ValidateException; |
|
|
|
use think\facade\Cache; |
|
|
|
use think\facade\Config; |
|
|
|
use think\facade\Db; |
|
|
|
|
|
|
|
class WalletService extends BaseHomeService |
|
|
@ -1298,8 +1300,6 @@ class WalletService extends BaseHomeService |
|
|
|
return $this->toData('2', 'error'); |
|
|
|
} |
|
|
|
|
|
|
|
//print_r($from_account); |
|
|
|
|
|
|
|
$cha_num = $from_account['usable_num'] - $data['change_num']; |
|
|
|
if ($cha_num < 0) { |
|
|
|
Db::rollback(); |
|
|
@ -1324,7 +1324,6 @@ class WalletService extends BaseHomeService |
|
|
|
return $this->toData('500', lang('data_empty')); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//插入账户资金划转表 |
|
|
|
$transfer_data['user_id'] = $data['user_id']; |
|
|
|
$transfer_data['from_account'] = $data['from_account']; |
|
|
@ -1355,7 +1354,6 @@ class WalletService extends BaseHomeService |
|
|
|
|
|
|
|
//变动类型:1-充值,2-提现,3-买入,4-卖出,5-冻结,6-解冻,7账户转出,8账户转入 |
|
|
|
//插入资金变动日志 |
|
|
|
|
|
|
|
$from_log['user_id'] = $data['user_id']; |
|
|
|
$from_log['change_type'] = 7; |
|
|
|
$from_log['change_num'] = -$data['change_num']; |
|
|
@ -1364,7 +1362,7 @@ class WalletService extends BaseHomeService |
|
|
|
$res = $this->addUserBalanceLog($data['from_account'], $from_log); |
|
|
|
if (empty($res)) { |
|
|
|
Db::rollback(); |
|
|
|
return $this->toData('500', lang('system_busy')); |
|
|
|
return $this->toData('500', 'Logging Failure of from_account'); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1376,7 +1374,7 @@ class WalletService extends BaseHomeService |
|
|
|
$res = $this->addUserBalanceLog($data['to_account'], $to_log); |
|
|
|
if (empty($res)) { |
|
|
|
Db::rollback(); |
|
|
|
return $this->toData('500', lang('system_busy')); |
|
|
|
return $this->toData('500', 'Logging Failure of to_account'); |
|
|
|
} |
|
|
|
|
|
|
|
Db::commit(); |
|
|
@ -1600,7 +1598,7 @@ class WalletService extends BaseHomeService |
|
|
|
case 21: |
|
|
|
return UserGoldFuturesModel::updateUserGoldFutures($update_data, [ |
|
|
|
'user_id' => $user_id, |
|
|
|
'contract_id' => 'GC' |
|
|
|
'contract_id' => 'USD' |
|
|
|
]); |
|
|
|
break; |
|
|
|
default: |
|
|
@ -1687,6 +1685,9 @@ class WalletService extends BaseHomeService |
|
|
|
case 20: |
|
|
|
$log_data['contract_id'] = 'INR'; |
|
|
|
return UserStockIndexInrLogModel::InsertUserBalanceLog($log_data); |
|
|
|
case 21: |
|
|
|
$log_data['contract_id'] = 'USD'; |
|
|
|
return UserGoldFuturesLogModel::InsertUserBalanceLog($log_data); |
|
|
|
default: |
|
|
|
return false; |
|
|
|
break; |
|
|
@ -1836,16 +1837,12 @@ class WalletService extends BaseHomeService |
|
|
|
{ |
|
|
|
try { |
|
|
|
// 1 现货 2 合约 3 美股 4 印尼股 5 马股 6 泰股 7 印度 |
|
|
|
if (empty($data['from_account']) || empty($data['to_account'])) { |
|
|
|
return $this->toData('400', lang('parameter_error')); |
|
|
|
} |
|
|
|
$fromAccount = $data['from_account']; |
|
|
|
$toAccount = $data['to_account']; |
|
|
|
|
|
|
|
if($fromAccount <1 || $fromAccount > 20){ |
|
|
|
return $this->toData('2', 'Transfer out account type is incorrect.'); |
|
|
|
} |
|
|
|
if($toAccount <1 || $toAccount > 20){ |
|
|
|
return $this->toData('2', 'Transfer out account type is incorrect.'); |
|
|
|
} |
|
|
|
|
|
|
|
if ($fromAccount == $toAccount) { |
|
|
|
return $this->toData('500', lang('the_transfer_out_account_and_the_transfer_in_account_cannot_be_the_same_account')); |
|
|
|
} |
|
|
|