补充座驾购买流水筛选
This commit is contained in:
@@ -177,7 +177,7 @@ enum CurrencySource: string
|
|||||||
self::RECV_GIFT => '收到礼物',
|
self::RECV_GIFT => '收到礼物',
|
||||||
self::NEWBIE_BONUS => '新人礼包',
|
self::NEWBIE_BONUS => '新人礼包',
|
||||||
self::SHOP_BUY => '商城购买',
|
self::SHOP_BUY => '商城购买',
|
||||||
self::RIDE_BUY => '座驾购买',
|
self::RIDE_BUY => '座驾购买(金币)',
|
||||||
self::ADMIN_ADJUST => '管理员调整',
|
self::ADMIN_ADJUST => '管理员调整',
|
||||||
self::POSITION_REWARD => '职务奖励',
|
self::POSITION_REWARD => '职务奖励',
|
||||||
self::SIGN_IN => '每日签到',
|
self::SIGN_IN => '每日签到',
|
||||||
|
|||||||
@@ -61,4 +61,46 @@ class AdminCurrencyLogControllerTest extends TestCase
|
|||||||
$response->viewData('logs')->getCollection()->pluck('source')->sort()->values()->all()
|
$response->viewData('logs')->getCollection()->pluck('source')->sort()->values()->all()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证后台流水来源筛选包含座驾购买金币选项并可正常筛选。
|
||||||
|
*/
|
||||||
|
public function test_admin_can_filter_currency_logs_by_ride_buy_source(): void
|
||||||
|
{
|
||||||
|
Sysparam::updateOrCreate(['alias' => 'superlevel'], ['body' => '100']);
|
||||||
|
$admin = User::factory()->create(['user_level' => 100]);
|
||||||
|
|
||||||
|
UserCurrencyLog::query()->create([
|
||||||
|
'user_id' => $admin->id,
|
||||||
|
'username' => $admin->username,
|
||||||
|
'currency' => 'gold',
|
||||||
|
'amount' => -18888,
|
||||||
|
'balance_after' => 11112,
|
||||||
|
'source' => CurrencySource::RIDE_BUY->value,
|
||||||
|
'remark' => CurrencySource::RIDE_BUY->label(),
|
||||||
|
'created_at' => now(),
|
||||||
|
]);
|
||||||
|
UserCurrencyLog::query()->create([
|
||||||
|
'user_id' => $admin->id,
|
||||||
|
'username' => $admin->username,
|
||||||
|
'currency' => 'gold',
|
||||||
|
'amount' => -1000,
|
||||||
|
'balance_after' => 10112,
|
||||||
|
'source' => CurrencySource::SHOP_BUY->value,
|
||||||
|
'remark' => CurrencySource::SHOP_BUY->label(),
|
||||||
|
'created_at' => now()->subMinute(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $this->actingAs($admin)->get(route('admin.currency-logs.index', [
|
||||||
|
'sources' => [CurrencySource::RIDE_BUY->value],
|
||||||
|
]));
|
||||||
|
|
||||||
|
$response->assertOk();
|
||||||
|
$response->assertSee('座驾购买(金币)');
|
||||||
|
$response->assertViewHas('selectedSources', [CurrencySource::RIDE_BUY->value]);
|
||||||
|
$this->assertSame(
|
||||||
|
[CurrencySource::RIDE_BUY->value],
|
||||||
|
$response->viewData('logs')->getCollection()->pluck('source')->values()->all()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user