优化
This commit is contained in:
@@ -35,7 +35,7 @@ use Illuminate\Support\Facades\DB;
|
||||
class RedPacketController extends Controller
|
||||
{
|
||||
/** 礼包固定总数量 */
|
||||
private const TOTAL_AMOUNT = 888;
|
||||
private const TOTAL_AMOUNT = 8888;
|
||||
|
||||
/** 礼包固定份数 */
|
||||
private const TOTAL_COUNT = 10;
|
||||
|
||||
@@ -28,7 +28,9 @@ class FishingService
|
||||
private readonly VipService $vipService,
|
||||
private readonly UserCurrencyService $currencyService,
|
||||
private readonly ShopService $shopService,
|
||||
) {}
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理收竿逻辑:计算结果、发放积分并全服广播。
|
||||
@@ -51,15 +53,12 @@ class FishingService
|
||||
$finalJjb = 0;
|
||||
|
||||
if ($result['exp'] !== 0) {
|
||||
$finalExp = $result['exp'] > 0
|
||||
? (int) round($result['exp'] * $expMul)
|
||||
: $result['exp'];
|
||||
// 当经验为 正数 则可使用会员翻倍,负数则不
|
||||
$finalExp = $result['exp'] > 0 ? (int)round($result['exp'] * $expMul) : $result['exp'];
|
||||
}
|
||||
|
||||
if ($result['jjb'] !== 0) {
|
||||
$finalJjb = $result['jjb'] > 0
|
||||
? (int) round($result['jjb'] * $jjbMul)
|
||||
: $result['jjb'];
|
||||
$finalJjb = $result['jjb'] > 0 ? (int)round($result['jjb'] * $jjbMul) : $result['jjb'];
|
||||
}
|
||||
|
||||
// 4. 计算会员额外加成部分
|
||||
@@ -83,25 +82,13 @@ class FishingService
|
||||
|
||||
// 6. 更新经验
|
||||
if ($finalExp !== 0) {
|
||||
$this->currencyService->change(
|
||||
$user,
|
||||
'exp',
|
||||
$finalExp,
|
||||
CurrencySource::FISHING_GAIN,
|
||||
"钓鱼收竿:{$finalMessage}",
|
||||
$roomId,
|
||||
$this->currencyService->change($user, 'exp', $finalExp, CurrencySource::FISHING_GAIN, "钓鱼收竿:{$finalMessage}", $roomId,
|
||||
);
|
||||
}
|
||||
|
||||
// 7. 更新金币
|
||||
if ($finalJjb !== 0) {
|
||||
$this->currencyService->change(
|
||||
$user,
|
||||
'gold',
|
||||
$finalJjb,
|
||||
CurrencySource::FISHING_GAIN,
|
||||
"钓鱼收竿:{$finalMessage}",
|
||||
$roomId,
|
||||
$this->currencyService->change($user, 'gold', $finalJjb, CurrencySource::FISHING_GAIN, "钓鱼收竿:{$finalMessage}", $roomId,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@
|
||||
icon: '🧧',
|
||||
title: '发出礼包',
|
||||
name: '选择礼包类型',
|
||||
body: '将发出 <b>888</b> 数量共 <b>10</b> 份的礼包,系统凭空发放,房间成员先到先得!',
|
||||
body: '将发出 <b>8888</b> 数量共 <b>10</b> 份的礼包,系统凭空发放,房间成员先到先得!',
|
||||
gradient: ['#991b1b', '#dc2626', '#ea580c'],
|
||||
titleColor: '#fde68a',
|
||||
autoClose: 0,
|
||||
|
||||
Reference in New Issue
Block a user