功能:随机浮漂钓鱼防挂机 + 商店自动钓鱼卡
核心变更: 1. FishingController 重写 - cast(): 生成随机浮漂坐标(x/y%) + 一次性 token - reel(): 必须携带 token 才能收竿(防脚本绕过) - 检测自动钓鱼卡剩余时间并返回给前端 2. 前端钓鱼逻辑重写 - 抛竿后显示随机位置 🪝 浮漂动画(全屏飘动) - 鱼上钩时浮漂「下沉」动画,8秒内点击浮漂才能收竿 - 超时未点击:鱼跑了,token 也失效 - 持有自动钓鱼卡:自动点击,紫色提示剩余时间 3. 商店新增「🎣 自动钓鱼卡」分组 - 3档:2h(800金)/8h(2500金)/24h(6000金) - 图标徽章显示剩余有效时间(紫色) - 购买后即时激活,无需手动操作 4. 数据库 - shop_items.type 加 auto_fishing 枚举 - shop_items.duration_minutes 新字段(分钟精度) - Seeder 写入 3 张卡数据 防挂机原理:按钮 → 浮漂随机位置,脚本无法固定坐标点击
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 文件功能:为 shop_items.type 枚举添加 auto_fishing(自动钓鱼卡)类型
|
||||
*
|
||||
* 自动钓鱼卡激活后,钓鱼无需点击随机浮漂,系统自动收竿。
|
||||
* 以 duration_hours 字段控制有效期(使用 duration_days 字段,1day=24h)。
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* 添加 auto_fishing 枚举值。
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement("ALTER TABLE `shop_items` MODIFY `type` ENUM('instant','duration','one_time','ring','auto_fishing') NOT NULL COMMENT '道具类型'");
|
||||
}
|
||||
|
||||
/**
|
||||
* 回滚:先将 auto_fishing 记录改为 one_time,再删除枚举值。
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
DB::statement("UPDATE `shop_items` SET `type` = 'one_time' WHERE `type` = 'auto_fishing'");
|
||||
DB::statement("ALTER TABLE `shop_items` MODIFY `type` ENUM('instant','duration','one_time','ring') NOT NULL COMMENT '道具类型'");
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 文件功能:为 shop_items 表添加 duration_minutes 字段
|
||||
*
|
||||
* 用于自动钓鱼卡等按分钟计算有效期的道具,
|
||||
* 避免复用 duration_days(天级精度不够)。
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* 添加 duration_minutes 字段。
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('shop_items', function (Blueprint $table): void {
|
||||
$table->unsignedSmallInteger('duration_minutes')->default(0)->after('duration_days')->comment('道具有效时长(分钟),0=不适用');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 回滚:删除字段。
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('shop_items', function (Blueprint $table): void {
|
||||
$table->dropColumn('duration_minutes');
|
||||
});
|
||||
}
|
||||
};
|
||||
68
database/seeders/AutoFishingCardSeeder.php
Normal file
68
database/seeders/AutoFishingCardSeeder.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 文件功能:初始化自动钓鱼卡商品数据
|
||||
*
|
||||
* 共 3 档:2小时卡、8小时卡、24小时卡。
|
||||
* 激活后钓鱼无需手动点击浮漂,系统自动收竿。
|
||||
* 可重复运行(updateOrCreate 幂等)。
|
||||
*/
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\ShopItem;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AutoFishingCardSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* 写入 3 档自动钓鱼卡数据。
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$cards = [
|
||||
[
|
||||
'slug' => 'auto_fishing_2h',
|
||||
'name' => '自动钓鱼卡(2小时)',
|
||||
'icon' => '🎣',
|
||||
'description' => '激活后2小时内,钓鱼无需手动点击浮漂,系统自动收竿。',
|
||||
'price' => 800,
|
||||
'type' => 'auto_fishing',
|
||||
'duration_minutes' => 120,
|
||||
'sort_order' => 201,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'auto_fishing_8h',
|
||||
'name' => '自动钓鱼卡(8小时)',
|
||||
'icon' => '🎣',
|
||||
'description' => '激活后8小时内,钓鱼无需手动点击浮漂,系统自动收竿。超值之选!',
|
||||
'price' => 2500,
|
||||
'type' => 'auto_fishing',
|
||||
'duration_minutes' => 480,
|
||||
'sort_order' => 202,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'auto_fishing_24h',
|
||||
'name' => '自动钓鱼卡(24小时)',
|
||||
'icon' => '🎣',
|
||||
'description' => '激活后24小时内,钓鱼无需手动点击浮漂,系统自动收竿。重度钓鱼爱好者必备!',
|
||||
'price' => 6000,
|
||||
'type' => 'auto_fishing',
|
||||
'duration_minutes' => 1440,
|
||||
'sort_order' => 203,
|
||||
'is_active' => true,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($cards as $card) {
|
||||
ShopItem::updateOrCreate(
|
||||
['slug' => $card['slug']],
|
||||
$card
|
||||
);
|
||||
}
|
||||
|
||||
$this->command->info('✅ 3 张自动钓鱼卡已写入 shop_items。');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user