feat: 在后台管理添加AI小班长钓鱼触发概率配置
This commit is contained in:
@@ -130,7 +130,7 @@ class AiHeartbeatCommand extends Command
|
||||
|
||||
// 7. 钓鱼小游戏随机参与逻辑
|
||||
$fishingEnabled = Sysparam::getValue('chatbot_fishing_enabled', '0') === '1';
|
||||
$fishingChance = (int) Sysparam::getValue('chatbot_fishing_chance', '5'); // 默认 5% 概率
|
||||
$fishingChance = (int) Sysparam::getValue('chatbot_fishing_chance', '100'); // 默认 5% 概率
|
||||
if ($fishingEnabled && $fishingChance > 0 && rand(1, 100) <= $fishingChance && \App\Models\GameConfig::isEnabled('fishing')) {
|
||||
$cost = (int) (\App\Models\GameConfig::param('fishing', 'fishing_cost') ?? Sysparam::getValue('fishing_cost', '5'));
|
||||
if ($user->jjb >= $cost) {
|
||||
|
||||
@@ -49,11 +49,12 @@ class AiProviderController extends Controller
|
||||
$chatbotMaxGold = Sysparam::getValue('chatbot_max_gold', '5000');
|
||||
$chatbotMaxDailyRewards = Sysparam::getValue('chatbot_max_daily_rewards', '1');
|
||||
$chatbotFishingEnabled = Sysparam::getValue('chatbot_fishing_enabled', '0') === '1';
|
||||
$chatbotFishingChance = Sysparam::getValue('chatbot_fishing_chance', '5');
|
||||
$chatbotBaccaratEnabled = Sysparam::getValue('chatbot_baccarat_enabled', '0') === '1';
|
||||
|
||||
return view('admin.ai-providers.index', compact(
|
||||
'providers', 'chatbotEnabled', 'chatbotMaxGold',
|
||||
'chatbotMaxDailyRewards', 'chatbotFishingEnabled', 'chatbotBaccaratEnabled'
|
||||
'chatbotMaxDailyRewards', 'chatbotFishingEnabled', 'chatbotFishingChance', 'chatbotBaccaratEnabled'
|
||||
));
|
||||
}
|
||||
|
||||
@@ -66,6 +67,7 @@ class AiProviderController extends Controller
|
||||
'chatbot_max_gold' => 'required|integer|min:1',
|
||||
'chatbot_max_daily_rewards' => 'required|integer|min:1',
|
||||
'chatbot_fishing_enabled' => 'required|in:0,1',
|
||||
'chatbot_fishing_chance' => 'required|integer|min:1|max:100',
|
||||
'chatbot_baccarat_enabled' => 'required|in:0,1',
|
||||
]);
|
||||
Sysparam::updateOrCreate(
|
||||
@@ -95,6 +97,15 @@ class AiProviderController extends Controller
|
||||
);
|
||||
Sysparam::clearCache('chatbot_fishing_enabled');
|
||||
|
||||
Sysparam::updateOrCreate(
|
||||
['alias' => 'chatbot_fishing_chance'],
|
||||
[
|
||||
'body' => (string) $data['chatbot_fishing_chance'],
|
||||
'guidetxt' => 'AI 钓鱼抛竿概率 (每分钟)',
|
||||
]
|
||||
);
|
||||
Sysparam::clearCache('chatbot_fishing_chance');
|
||||
|
||||
Sysparam::updateOrCreate(
|
||||
['alias' => 'chatbot_baccarat_enabled'],
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user