修改:转换积分可以超出持有积分的问题

This commit is contained in:
wuhui_zzw 2023-11-10 16:15:09 +08:00
parent 9925ef1918
commit 8a0c9cce6b
1 changed files with 3 additions and 0 deletions

View File

@ -477,6 +477,9 @@ class User extends BaseController
$user = app()->make(UserRepository::class)->get($uid); $user = app()->make(UserRepository::class)->get($uid);
$integralMake = app()->make(\app\common\repositories\user\IntegralRepository::class); $integralMake = app()->make(\app\common\repositories\user\IntegralRepository::class);
$bills = []; $bills = [];
// 判断:是否允许转换
$holdIntegral = $integralMake->getMerIntegral((int)$uid,(int)$merId);
if($holdIntegral < $convertIntegral) throw new Exception('转换失败,持有积分不足!');
// 计算转换后的积分 应得平台积分 // 计算转换后的积分 应得平台积分
$convertAfterIntegral = (float)sprintf("%.2f",$convertIntegral * $mer_integral_platform_rate); $convertAfterIntegral = (float)sprintf("%.2f",$convertIntegral * $mer_integral_platform_rate);
// 减少商户积分 // 减少商户积分