This commit is contained in:
lingling 2025-02-20 17:56:10 +08:00
commit 4f4b3cd9c0
1 changed files with 46 additions and 22 deletions

View File

@ -10,7 +10,7 @@ use app\model\Userbank;
use support\Request; use support\Request;
use App\Utils\API\Payment; use App\Utils\API\Payment;
use App\Utils\API\PaymentNew; use App\Utils\API\PaymentNew;
use App\Utils\ApiResponse;
use App\Utils\ApiResponseApp; use App\Utils\ApiResponseApp;
use App\dao\UserRewardDao; use App\dao\UserRewardDao;
@ -158,30 +158,16 @@ class WithdrawController
{ {
//金额 //金额
$amount = $request->post('amount'); $amount = $request->post('amount');
//收款户名
$bank_username = $request->post('bank_username');
//收款帐号
$account = $request->post('account');
//收款银行名称
$bank_name = $request->post('bank_name');
//转账订单id //转账订单id
$id = $request->post('id'); $id = $request->post('id');
//管理员审批结果 //管理员审批结果
$type = $request->post('type'); $type = $request->post('type');
//用户id
if ($type == 1) { $user_id = $request->post('user_id');
$res = PaymentNew::pushMoney($amount, $bank_username, $account, $bank_name,$id); //是否同意转账
// var_dump($res); $type = $request->post('type');
// if ($res['Success'] == 200) { //不同意
// $Withdraw = Withdraw::where('id', $id)->first(); if($type==1){
// $Withdraw->status = 2;
// $Withdraw->status_text = '已到账';
// $Withdraw->save();
// return ApiResponseApp::success(null, '转账成功');
// } else {
// return ApiResponseApp::error(null, '转账失败');
// }
} else {
$Withdraw = Withdraw::where('id', $id)->first(); $Withdraw = Withdraw::where('id', $id)->first();
$Withdraw->status = 3; $Withdraw->status = 3;
$Withdraw->status_text = '已驳回'; $Withdraw->status_text = '已驳回';
@ -193,8 +179,46 @@ class WithdrawController
$user_id = $request->data['id']; $user_id = $request->data['id'];
//用户积分增加$money //用户积分增加$money
UserRewardDao::base($user_id, 1, $money, '提现失败返还'); UserRewardDao::base($user_id, 1, $money, '提现失败返还');
return ApiResponseApp::error(null, '操作成功'); return ApiResponse::success(200, null,'操作成功');
} }
//同意
$userbank = Userbank::where('user_id',$user_id)->first();
if ($userbank) {
PaymentNew::pushMoney($amount,$userbank->bank_username, $userbank->account, $userbank->bank_name,$id);
$Withdraw = Withdraw::where('id', $id)->first();
$Withdraw->status = 2;
$Withdraw->status_text = '已到账';
$Withdraw->save();
return ApiResponse::success(200,null,'操作成功');
}else{
return ApiResponse::error(200, null, '用户银行信息存在问题');
}
// if ($type == 1) {
// $res = PaymentNew::pushMoney($amount, $bank_username, $account, $bank_name,$id);
// var_dump($res);
// if ($res['Success'] == 200) {
// $Withdraw = Withdraw::where('id', $id)->first();
// $Withdraw->status = 2;
// $Withdraw->status_text = '已到账';
// $Withdraw->save();
// return ApiResponseApp::success(null, '转账成功');
// } else {
// return ApiResponseApp::error(null, '转账失败');
// }
// } else {
// $Withdraw = Withdraw::where('id', $id)->first();
// $Withdraw->status = 3;
// $Withdraw->status_text = '已驳回';
// $Withdraw->save();
// $rate = ExchangeRate::where('type', 'BDT')->get();
// //计算积分
// $money = $amount * 100 / $rate[0]['points'] + 300;
// //用户id
// $user_id = $request->data['id'];
// //用户积分增加$money
// UserRewardDao::base($user_id, 1, $money, '提现失败返还');
// return ApiResponseApp::error(null, '操作成功');
// }
} }
/** /**