Compare commits

...

4 Commits

5 changed files with 35 additions and 18 deletions

View File

@ -31,7 +31,7 @@ class WithdrawController
/**
* 手续费
*/
protected static $handlingFee=0;
protected static $handlingFee = 0;
/**
* @Apidoc\Title("1.0 查询当前用户提现订单")
* @Apidoc\Url("api/withdraw/withdrawCashList")
@ -115,9 +115,20 @@ class WithdrawController
return ApiResponseApp::error(null, '每天只能提现三次');
}
$user = User::find($user_id);
if($money_no>$user->money){
if ($money_no > $user->money) {
return ApiResponseApp::error(null, '提现积分不足');
}
}
// 获取当前时间的 3 分钟前
$threeMinutesAgo = Carbon::now()->subMinutes(3);
// 使用 exists() 查询,判断是否有记录
if (Withdraw::where('user_id', $user_id)
->where('created_at', '>=', $threeMinutesAgo)
->exists()
) {
return ApiResponseApp::error(null, '提现频繁请三分钟后再试');
}
//提现金额
$rate = ExchangeRate::where('type', 'BDT')->get();
$money = (int)$money_no / 100 * $rate[0]['points'];
@ -136,7 +147,7 @@ class WithdrawController
UserRewardDao::base($user_id, 1, - ($money_no + self::$handlingFee), '提现');
return ApiResponseApp::success(null, '等待管理员审核');
}
//用户积分减少$money
UserRewardDao::base($user_id, 1, - ($money_no + self::$handlingFee), '提现');
$userbank = Userbank::where('id', $bank_id)->first();
@ -153,36 +164,36 @@ class WithdrawController
return ApiResponseApp::success(null, '转账成功');
} else {
$errorMsg = '';
if($res->ErrorMessage == "CheckIpAddressFailed"){
if ($res->ErrorMessage == "CheckIpAddressFailed") {
$errorMsg = 'IP 检查失败';
}
if($res->ErrorMessage == "CheckEncryptValueFailed "){
if ($res->ErrorMessage == "CheckEncryptValueFailed ") {
$errorMsg = '加密检查失败';
}
if($res->ErrorMessage == "PaymentChannelClosed"){
if ($res->ErrorMessage == "PaymentChannelClosed") {
$errorMsg = '平台休息中,暂不接单';
}
if($res->ErrorMessage == "InsufficientBalance"){
if ($res->ErrorMessage == "InsufficientBalance") {
$errorMsg = '余额不足';
}
if($res->ErrorMessage == "TryAgainLater"){
if ($res->ErrorMessage == "TryAgainLater") {
$errorMsg = '系统忙碌中,请稍后再试';
}
if($res->ErrorMessage == "DevError"){
if ($res->ErrorMessage == "DevError") {
$errorMsg = '程式错误,请联络开发人员';
}
if($res->ErrorMessage == "PayeeAccountNameFormatError"){
if ($res->ErrorMessage == "PayeeAccountNameFormatError") {
$errorMsg = '收款人帐号格式错误';
}
if($res->ErrorMessage == "PayeeAccountNumberFormatError"){
if ($res->ErrorMessage == "PayeeAccountNumberFormatError") {
$errorMsg = '收款人卡号格式错误';
}
if($errorMsg == ''){
if ($errorMsg == '') {
$errorMsg = '未知错误';
}
$withdraw->update([
'status' => 5, //
'status_text' => trans('支付错误:').$res->ErrorMessage
'status_text' => trans('支付错误:') . $res->ErrorMessage
]);
UserRewardDao::base($user_id, 1, $money_no + self::$handlingFee, '提现失败返还');
// if ($res->ErrorMessage == "PayeeAccountNameFormatError") {
@ -210,7 +221,7 @@ class WithdrawController
$withdraw = Withdraw::where('order_number', $orderId)->first();
//$failedMessage为null就是成功
if ($failedMessage != null) {
if($withdraw->status == 5){
if ($withdraw->status == 5) {
return;
}
$rate = ExchangeRate::where('type', 'BDT')->get();

View File

@ -10,6 +10,7 @@ use support\Model;
* @property string $updated_at 更新时间
* @property string $key key
* @property string $value value
* @property string $remark remark 备注
*/
class Dictionary extends Model
{

View File

@ -6,6 +6,7 @@ use app\dao\UserPhoneLogDao;
use App\Utils\API\SendCode;
use app\model\UserPhone;
use app\dao\UserRewardDao;
use app\model\Dictionary;
use support\Log;
use Workerman\Crontab\Crontab;
use GuzzleHttp\Client;
@ -22,6 +23,8 @@ class Task2
new Crontab('0 */1 * * * *', function () {
$start_time = time();
Rocketgo::test_login();
//查询系统配置 是否自动删除用户
$autodelete=Dictionary::where('key','autodelete')->first();
Log::info("查询任务开始");
// 获取账号列表
$res = Rocketgo::account_list();
@ -44,7 +47,7 @@ class Task2
$updateData = [];
foreach ($res as $v) {
if ($v['failedReason'] !== null) {
if ($v['failedReason'] !== null && $autodelete->value=='1') {
SendCode::delWS($v['username']);
continue;
}

View File

@ -28,5 +28,6 @@ return [
'支付错误:'=>'Payment error:',
'等待银行打款'=>'Waiting for bank transfer',
'已到账'=>'Already arrived',
'提现'=>'Withdraw cash'
'提现'=>'Withdraw cash',
'提现频繁请三分钟后再试'=>'Frequent withdrawals, please try again after three minutes'
];

View File

@ -28,5 +28,6 @@ return [
'支付错误:'=>'支付错误:',
'等待银行打款'=>'等待银行打款',
'已到账'=>'已到账',
'提现'=>'提现'
'提现'=>'提现',
'提现频繁请三分钟后再试'=>'提现频繁请三分钟后再试'
];