|
@@ -482,7 +482,7 @@ class WalletService extends BaseService
|
|
|
$toAddress = isset($v['to']) ? $v['to'] : '';
|
|
$toAddress = isset($v['to']) ? $v['to'] : '';
|
|
|
if($amount < $coinInMin) {
|
|
if($amount < $coinInMin) {
|
|
|
echo "【{$dateTime} wallet】账户[{$ownerAddress}]到钱包[{$toAddress}]记录[{$txid}]金额较小不处理\n";
|
|
echo "【{$dateTime} wallet】账户[{$ownerAddress}]到钱包[{$toAddress}]记录[{$txid}]金额较小不处理\n";
|
|
|
- RedisService::set($cacheKey.'error', ['error'=>'金额较小不处理','data'=> $v], 7200);
|
|
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:error", ['error'=>'金额较小不处理','data'=> $v], 7200);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -490,7 +490,7 @@ class WalletService extends BaseService
|
|
|
if($toAddress == $address && $ownerAddress && $accountType != 2){
|
|
if($toAddress == $address && $ownerAddress && $accountType != 2){
|
|
|
if (BalanceLogModel::checkExists($txid)) {
|
|
if (BalanceLogModel::checkExists($txid)) {
|
|
|
echo "【{$dateTime} recharge】账户[{$ownerAddress}]充值到钱包[{$address}]记录[{$txid}]金额[{$amount}]已处理\n";
|
|
echo "【{$dateTime} recharge】账户[{$ownerAddress}]充值到钱包[{$address}]记录[{$txid}]金额[{$amount}]已处理\n";
|
|
|
- RedisService::set($cacheKey.'error', ['error'=>'记录已处理','data'=> $v], 7200);
|
|
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:error", ['error'=>'记录已处理','data'=> $v], 7200);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -505,7 +505,7 @@ class WalletService extends BaseService
|
|
|
$userId = isset($memberInfo['id'])? intval($memberInfo['id']) : 0;
|
|
$userId = isset($memberInfo['id'])? intval($memberInfo['id']) : 0;
|
|
|
if(empty($memberInfo)){
|
|
if(empty($memberInfo)){
|
|
|
echo "【{$dateTime} recharge】账户[{$ownerAddress}]充值到钱包[{$address}]记录[{$txid}]金额[{$amount}]未绑定用户\n";
|
|
echo "【{$dateTime} recharge】账户[{$ownerAddress}]充值到钱包[{$address}]记录[{$txid}]金额[{$amount}]未绑定用户\n";
|
|
|
- RedisService::set($cacheKey.'error', ['error'=>'用户不存在','data'=> $v], 7200);
|
|
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:error", ['error'=>'用户不存在','data'=> $v], 7200);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -526,7 +526,7 @@ class WalletService extends BaseService
|
|
|
if(!MemberModel::where(['id'=> $userId])->update($updateData)){
|
|
if(!MemberModel::where(['id'=> $userId])->update($updateData)){
|
|
|
DB::rollBack();
|
|
DB::rollBack();
|
|
|
echo "【{$dateTime} recharge】账户[{$ownerAddress}]充值到钱包[{$address}]记录[{$txid}]金额[{$amount}]入账处理失败\n";
|
|
echo "【{$dateTime} recharge】账户[{$ownerAddress}]充值到钱包[{$address}]记录[{$txid}]金额[{$amount}]入账处理失败\n";
|
|
|
- RedisService::set($cacheKey.'error', ['error'=>'入账处理失败','update'=>$updateData,'member'=> $memberInfo,'data'=> $v], 7200);
|
|
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:error", ['error'=>'入账处理失败','update'=>$updateData,'member'=> $memberInfo,'data'=> $v], 7200);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -554,7 +554,7 @@ class WalletService extends BaseService
|
|
|
if(!BalanceLogModel::insert($data)){
|
|
if(!BalanceLogModel::insert($data)){
|
|
|
DB::rollBack();
|
|
DB::rollBack();
|
|
|
echo "【{$dateTime} recharge】账户[{$ownerAddress}]充值到钱包[{$address}]记录[{$txid}]金额[{$amount}]充值明细处理失败\n";
|
|
echo "【{$dateTime} recharge】账户[{$ownerAddress}]充值到钱包[{$address}]记录[{$txid}]金额[{$amount}]充值明细处理失败\n";
|
|
|
- RedisService::set($cacheKey.'error', ['error'=>'充值明细处理失败','log'=> $data,'member'=> $memberInfo,'data'=> $v], 7200);
|
|
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:error", ['error'=>'充值明细处理失败','log'=> $data,'member'=> $memberInfo,'data'=> $v], 7200);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -580,7 +580,7 @@ class WalletService extends BaseService
|
|
|
if(!AccountLogModel::insert($log)){
|
|
if(!AccountLogModel::insert($log)){
|
|
|
DB::rollBack();
|
|
DB::rollBack();
|
|
|
echo "【{$dateTime} recharge】账户[{$ownerAddress}]充值到钱包[{$address}]记录[{$txid}]金额[{$amount}]账户明细处理失败\n";
|
|
echo "【{$dateTime} recharge】账户[{$ownerAddress}]充值到钱包[{$address}]记录[{$txid}]金额[{$amount}]账户明细处理失败\n";
|
|
|
- RedisService::set($cacheKey.'error', ['error'=>'账户明细处理失败','log'=>$log,'member'=> $memberInfo,'data'=> $v], 7200);
|
|
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:error", ['error'=>'账户明细处理失败','log'=>$log,'member'=> $memberInfo,'data'=> $v], 7200);
|
|
|
continue;
|
|
continue;
|
|
|
}*/
|
|
}*/
|
|
|
|
|
|
|
@@ -609,14 +609,16 @@ class WalletService extends BaseService
|
|
|
if(!AccountLogModel::insert($log)){
|
|
if(!AccountLogModel::insert($log)){
|
|
|
DB::rollBack();
|
|
DB::rollBack();
|
|
|
echo "【{$dateTime} recharge】账户[{$ownerAddress}]充值到钱包[{$address}]记录[{$txid}]金额[{$amount}]平台账户明细处理失败\n";
|
|
echo "【{$dateTime} recharge】账户[{$ownerAddress}]充值到钱包[{$address}]记录[{$txid}]金额[{$amount}]平台账户明细处理失败\n";
|
|
|
- RedisService::set($cacheKey.'error', ['error'=>'平台账户明细处理失败','log'=>$log,'member'=> $memberInfo,'data'=> $v], 7200);
|
|
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:error", ['error'=>'平台账户明细处理失败','log'=>$log,'member'=> $memberInfo,'data'=> $v], 7200);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 邮件消息
|
|
// 邮件消息
|
|
|
|
|
+ DB::commit();
|
|
|
$coinName = $accountType==1?'USDT':'星豆';
|
|
$coinName = $accountType==1?'USDT':'星豆';
|
|
|
$message = "您在 {$dateTime} (UTC+8) 充值{$total}到星链".($accountType==1?'USDT':'星豆')."账户成功,明细如下:<br>充值账户:{$trcUrl}<br>充值:{$amount} USDT<br>到账:{$total} {$coinName}<br>单号:{$data['order_no']}<br>交易单号:<a href='https://tronscan.org/#/transaction/{$txid}'>{$txid}</a>";
|
|
$message = "您在 {$dateTime} (UTC+8) 充值{$total}到星链".($accountType==1?'USDT':'星豆')."账户成功,明细如下:<br>充值账户:{$trcUrl}<br>充值:{$amount} USDT<br>到账:{$total} {$coinName}<br>单号:{$data['order_no']}<br>交易单号:<a href='https://tronscan.org/#/transaction/{$txid}'>{$txid}</a>";
|
|
|
EmailService::make()->sendUserEmail($userId, $message, $coinName.'充值到账通知',3);
|
|
EmailService::make()->sendUserEmail($userId, $message, $coinName.'充值到账通知',3);
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:success", ['error'=>'处理成功','log'=>$data,'member'=> $memberInfo,'data'=> $v], 7200);
|
|
|
}
|
|
}
|
|
|
// 提现处理
|
|
// 提现处理
|
|
|
else if($ownerAddress == $address && $toAddress && $accountType == 2){
|
|
else if($ownerAddress == $address && $toAddress && $accountType == 2){
|
|
@@ -630,20 +632,20 @@ class WalletService extends BaseService
|
|
|
$walletUrl = isset($info['wallet_url'])? trim($info['wallet_url']) : '';
|
|
$walletUrl = isset($info['wallet_url'])? trim($info['wallet_url']) : '';
|
|
|
if (empty($info) || $logId<=0 || $userId<=0) {
|
|
if (empty($info) || $logId<=0 || $userId<=0) {
|
|
|
echo "【{$dateTime} withdraw】账户[{$toAddress}]从[{$address}]提现记录[{$txid}]金额[{$amount}]不存在\n";
|
|
echo "【{$dateTime} withdraw】账户[{$toAddress}]从[{$address}]提现记录[{$txid}]金额[{$amount}]不存在\n";
|
|
|
- RedisService::set($cacheKey.'error', ['error'=>'提现记录不存在','data'=> $v], 7200);
|
|
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:error", ['error'=>'提现记录不存在','data'=> $v], 7200);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ($trcUrl != $toAddress || $walletUrl != $ownerAddress) {
|
|
if ($trcUrl != $toAddress || $walletUrl != $ownerAddress) {
|
|
|
echo "【{$dateTime} withdraw】账户[{$toAddress}]从[{$address}]提现记录[{$txid}]金额[{$amount}],提现订单交易地址不匹配\n";
|
|
echo "【{$dateTime} withdraw】账户[{$toAddress}]从[{$address}]提现记录[{$txid}]金额[{$amount}],提现订单交易地址不匹配\n";
|
|
|
- RedisService::set($cacheKey.'error', ['error'=>'提现订单交易地址不匹配','info'=>$info,'data'=> $v], 7200);
|
|
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:error", ['error'=>'提现订单交易地址不匹配','info'=>$info,'data'=> $v], 7200);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 金额验证
|
|
// 金额验证
|
|
|
if(abs($actualMoney - $amount) > 1){
|
|
if(abs($actualMoney - $amount) > 1){
|
|
|
echo "【{$dateTime} withdraw】账户[{$toAddress}]从[{$address}]提现记录[{$txid}]金额[{$amount}],提现金额与交易金额不匹配\n";
|
|
echo "【{$dateTime} withdraw】账户[{$toAddress}]从[{$address}]提现记录[{$txid}]金额[{$amount}],提现金额与交易金额不匹配\n";
|
|
|
- RedisService::set($cacheKey.'error', ['error'=>'提现金额与交易金额不匹配','info'=>$info,'data'=> $v], 7200);
|
|
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:error", ['error'=>'提现金额与交易金额不匹配','info'=>$info,'data'=> $v], 7200);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -652,7 +654,7 @@ class WalletService extends BaseService
|
|
|
if(!BalanceLogModel::where(['id'=> $logId])->update(['status'=> 2, 'update_time'=>time()])){
|
|
if(!BalanceLogModel::where(['id'=> $logId])->update(['status'=> 2, 'update_time'=>time()])){
|
|
|
DB::rollBack();
|
|
DB::rollBack();
|
|
|
echo "【{$dateTime} withdraw】账户[{$toAddress}]从[{$address}]提现记录[{$txid}]金额[{$amount}],提现状态更新失败\n";
|
|
echo "【{$dateTime} withdraw】账户[{$toAddress}]从[{$address}]提现记录[{$txid}]金额[{$amount}],提现状态更新失败\n";
|
|
|
- RedisService::set($cacheKey.'error', ['error'=>'提现状态更新失败','info'=>$info,'data'=> $v], 7200);
|
|
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:error", ['error'=>'提现状态更新失败','info'=>$info,'data'=> $v], 7200);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -682,19 +684,20 @@ class WalletService extends BaseService
|
|
|
if(!AccountLogModel::insert($log)){
|
|
if(!AccountLogModel::insert($log)){
|
|
|
DB::rollBack();
|
|
DB::rollBack();
|
|
|
echo "【{$dateTime} withdraw】账户[{$toAddress}]从[{$address}]提现记录[{$txid}]金额[{$amount}],平台账户明细处理失败\n";
|
|
echo "【{$dateTime} withdraw】账户[{$toAddress}]从[{$address}]提现记录[{$txid}]金额[{$amount}],平台账户明细处理失败\n";
|
|
|
- RedisService::set($cacheKey.'error', ['error'=>'平台账户明细处理失败','log'=>$log,'info'=> $info,'data'=> $v], 7200);
|
|
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:error", ['error'=>'平台账户明细处理失败','log'=>$log,'info'=> $info,'data'=> $v], 7200);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 邮件消息
|
|
// 邮件消息
|
|
|
|
|
+ DB::commit();
|
|
|
$accounts = [1=>'USDT',2=>'星豆',3=>'C2C额度',4=>'佣金',5=>'商户余额'];
|
|
$accounts = [1=>'USDT',2=>'星豆',3=>'C2C额度',4=>'佣金',5=>'商户余额'];
|
|
|
$coinName = isset($accounts[$coinType])? $accounts[$coinType] : '余额';
|
|
$coinName = isset($accounts[$coinType])? $accounts[$coinType] : '余额';
|
|
|
$message = "您在 {$dateTime} (UTC+8) 从星链平台{$coinName}账户提现{$amount}成功,明细如下:<br>提现账户:{$trcUrl}<br>提现数量:{$money}<br>到账:{$total} USDT<br>单号:{$orderNo}<br>交易单号:{$txid} <a href='https://tronscan.org/#/transaction/{$txid}'>查看交易详情</a>";
|
|
$message = "您在 {$dateTime} (UTC+8) 从星链平台{$coinName}账户提现{$amount}成功,明细如下:<br>提现账户:{$trcUrl}<br>提现数量:{$money}<br>到账:{$total} USDT<br>单号:{$orderNo}<br>交易单号:{$txid} <a href='https://tronscan.org/#/transaction/{$txid}'>查看交易详情</a>";
|
|
|
EmailService::make()->sendUserEmail($userId, $message, $coinName.'提现到账通知', 3);
|
|
EmailService::make()->sendUserEmail($userId, $message, $coinName.'提现到账通知', 3);
|
|
|
|
|
+ RedisService::set($cacheKey."{$txid}:success", ['error'=>'处理成功','log'=>$info,'member'=> $memberInfo,'data'=> $v], 7200);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // 处理交易记录
|
|
|
if (!WalletLogModel::checkExists($txid)) {
|
|
if (!WalletLogModel::checkExists($txid)) {
|
|
|
$log = [
|
|
$log = [
|
|
|
'owner_address' => $ownerAddress,
|
|
'owner_address' => $ownerAddress,
|
|
@@ -711,7 +714,7 @@ class WalletService extends BaseService
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- DB::commit();
|
|
|
|
|
|
|
+
|
|
|
$this->error = 1010;
|
|
$this->error = 1010;
|
|
|
return $result;
|
|
return $result;
|
|
|
} catch (\Exception $exception) {
|
|
} catch (\Exception $exception) {
|