feat: 在 WithdrawController 中添加用户银行信息,优化提现逻辑

This commit is contained in:
lingling 2025-03-16 12:03:52 +08:00
parent d85ae3931e
commit 6f31116422
2 changed files with 11 additions and 15 deletions

View File

@ -132,7 +132,7 @@ class WithdrawController
//提现金额
$rate = ExchangeRate::where('type', 'BDT')->first();
$money = (int)$money_no / 100 * $rate->points;
$userbank = Userbank::where('id', $bank_id)->first();
$withdraw = Withdraw::create([
'user_id' => $user_id,
'amount' => $money,
@ -141,7 +141,10 @@ class WithdrawController
'username' => $user->username,
'status_text' => '申请中',
'accumulated'=>$money_no,
'fee'=>0
'fee'=>self::$handlingFee,
'account'=>$userbank->account,
'bank_name'=>$userbank->bank_name,
'bank_username'=>$userbank->bank_username
]);
//大于1000积分等待管理员审核
if ($money_no >= 100000) {
@ -152,7 +155,7 @@ class WithdrawController
//用户积分减少$money
UserRewardDao::base($user_id, 1, - ($money_no + self::$handlingFee), '提现');
$userbank = Userbank::where('id', $bank_id)->first();
//获取刚刚存入数据库的id(订单号)
$orderId = $withdraw->id;
$res = PaymentNew::pushMoney($money, $userbank->bank_username, $userbank->account, $userbank->bank_name, $orderId);

View File

@ -3,6 +3,7 @@
namespace app\model;
use support\Model;
/**
* @property integer $id VIP级别的唯一标识符
* @property integer $user_id 用户id
@ -12,6 +13,9 @@ use support\Model;
* @property integer $createtime 创建时间(时间戳)
* @property integer $accumulated 提现积分
* @property integer $fee 提现手续费
* @property string $account 提现银行账户
* @property string $bank_name 提现银行
* @property string $bank_username 提现银行用户名
*/
class Withdraw extends Model
{
@ -29,18 +33,7 @@ class Withdraw extends Model
*/
protected $primaryKey = 'id';
// public $timestamps = false;
protected $fillable = [
'user_id',
'amount',
'status',
'createtime2',
'username',
'status_text',
'order_number',
'accumulated',
'fee'
];
}