mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 23:18:44 -07:00
feat: Enhance API endpoints and add new features
- Added support for v3 gift generation in AvatarGiftsController. - Updated club report messages to include club IDs for better tracking in CompatibilityFeatureController. - Introduced new endpoints for voice moderation and whitelisted emojis in ConfigController. - Modified image retrieval logic to support single image lookups by name in ImagesController. - Adjusted incentivized referrals to return an empty array when no rewards are available in IncentivizedReferralsController. - Implemented trial invention functionality in InventionsController. - Added top creators today endpoint in PlayerSubscriptionsController. - Expanded room earnings distribution functionality in RoomEarningsDistributionsController. - Enhanced room search capabilities with pagination in RoomsController. - Improved account name generation options in AccountsController. - Added party invite privacy settings in PlayerSettingsController. - Created CommentsController for handling unread comment counts. - Established PurchaseCampaignController for handling purchase campaign telemetry.
This commit is contained in:
+17
-6
@@ -34,17 +34,23 @@ public class IncentivizedReferralsController(DorkNetDbContext db, LevelService l
|
||||
});
|
||||
}
|
||||
|
||||
// Client contract: the claim response deserializes as a top-level
|
||||
// List<RewardSelection> where each entry is
|
||||
// { rewardSelectionId: long, rewardType: string } (RecNet.Runtime
|
||||
// AFEFBIKADAP/GLOFCEJBIGB). Returning a {Success,...} object crashes the
|
||||
// strict array reader. When there's nothing to grant, return an empty
|
||||
// array — a valid empty list, not an error object.
|
||||
[HttpPost("claim")]
|
||||
public async Task<IActionResult> Claim()
|
||||
{
|
||||
var referralCount = await db.PlayerSettings
|
||||
.CountAsync(s => s.Key.StartsWith($"referral:credited:{Me}:"));
|
||||
if (referralCount < 1)
|
||||
return Ok(new { Success = false, Error = "not_enough_referrals" });
|
||||
if (await db.PlayerSettings.AnyAsync(s => s.PlayerId == Me && s.Key == "referral:reward_claimed"))
|
||||
return Ok(new { Success = false, Error = "already_claimed" });
|
||||
var alreadyClaimed = await db.PlayerSettings
|
||||
.AnyAsync(s => s.PlayerId == Me && s.Key == "referral:reward_claimed");
|
||||
if (referralCount < 1 || alreadyClaimed)
|
||||
return Ok(Array.Empty<object>());
|
||||
|
||||
var balance = await level.GrantCurrencyAsync(Me, 2, 250, "incentivized_referral");
|
||||
await level.GrantCurrencyAsync(Me, 2, 250, "incentivized_referral");
|
||||
db.PlayerSettings.Add(new PlayerSettingEntity
|
||||
{
|
||||
PlayerId = Me,
|
||||
@@ -52,6 +58,11 @@ public class IncentivizedReferralsController(DorkNetDbContext db, LevelService l
|
||||
Value = DateTime.UtcNow.ToString("O"),
|
||||
});
|
||||
await db.SaveChangesAsync();
|
||||
return Ok(new { Success = true, Balance = balance, CurrencyType = 2, Currency = 250 });
|
||||
|
||||
// One granted reward selection: 250 of currency type 2.
|
||||
return Ok(new[]
|
||||
{
|
||||
new { rewardSelectionId = unchecked(Me * 397L + 2), rewardType = "Currency" },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user