feat: 管理员同意提现
This commit is contained in:
parent
3cb6b2f216
commit
fbefd0e045
|
@ -10,7 +10,7 @@ use app\model\Userbank;
|
|||
use support\Request;
|
||||
use App\Utils\API\Payment;
|
||||
use App\Utils\API\PaymentNew;
|
||||
|
||||
use App\Utils\ApiResponse;
|
||||
use App\Utils\ApiResponseApp;
|
||||
|
||||
use App\dao\UserRewardDao;
|
||||
|
@ -158,30 +158,16 @@ class WithdrawController
|
|||
{
|
||||
//金额
|
||||
$amount = $request->post('amount');
|
||||
//收款户名
|
||||
$bank_username = $request->post('bank_username');
|
||||
//收款帐号
|
||||
$account = $request->post('account');
|
||||
//收款银行名称
|
||||
$bank_name = $request->post('bank_name');
|
||||
//转账订单id
|
||||
$id = $request->post('id');
|
||||
//管理员审批结果
|
||||
$type = $request->post('type');
|
||||
|
||||
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 {
|
||||
//用户id
|
||||
$user_id = $request->post('user_id');
|
||||
//是否同意转账
|
||||
$type = $request->post('type');
|
||||
//不同意
|
||||
if($type==1){
|
||||
$Withdraw = Withdraw::where('id', $id)->first();
|
||||
$Withdraw->status = 3;
|
||||
$Withdraw->status_text = '已驳回';
|
||||
|
@ -193,8 +179,46 @@ class WithdrawController
|
|||
$user_id = $request->data['id'];
|
||||
//用户积分增加$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, '操作成功');
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue