Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
el3ab-Player
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
el3ab-Player
Commits
020477e0
Commit
020477e0
authored
Jun 03, 2026
by
Mahmoud Aglan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: daily reward uses only existing columns (coins), no streak tracking
Co-Authored-By:
Claude Opus 4.6
<
noreply@anthropic.com
>
parent
31dae71d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
28 deletions
+7
-28
daily-reward.php
api/daily-reward.php
+7
-28
No files found.
api/daily-reward.php
View file @
020477e0
...
@@ -18,49 +18,28 @@ $action = $input['action'] ?? 'claim';
...
@@ -18,49 +18,28 @@ $action = $input['action'] ?? 'claim';
$db
=
supabase
(
$token
);
$db
=
supabase
(
$token
);
if
(
$action
===
'claim'
)
{
if
(
$action
===
'claim'
)
{
$profiles
=
$db
->
get
(
'profiles'
,
[
'id'
=>
'eq.'
.
$userId
,
'select'
=>
'coins
,last_daily_claim,daily_streak
'
,
'limit'
=>
1
]);
$profiles
=
$db
->
get
(
'profiles'
,
[
'id'
=>
'eq.'
.
$userId
,
'select'
=>
'coins'
,
'limit'
=>
1
]);
$profile
=
is_array
(
$profiles
)
&&
!
empty
(
$profiles
)
&&
!
isset
(
$profiles
[
'error'
])
?
$profiles
[
0
]
:
null
;
$profile
=
is_array
(
$profiles
)
&&
!
empty
(
$profiles
)
&&
!
isset
(
$profiles
[
'error'
])
?
$profiles
[
0
]
:
null
;
if
(
!
$profile
)
jsonError
(
'Profile not found'
);
if
(
!
$profile
)
jsonError
(
'Profile not found'
);
$
lastClaim
=
$profile
[
'last_daily_claim'
]
??
null
;
$
reward
=
100
;
$
today
=
date
(
'Y-m-d'
)
;
$
newCoins
=
(
$profile
[
'coins'
]
??
0
)
+
$reward
;
if
(
$lastClaim
&&
substr
(
$lastClaim
,
0
,
10
)
===
$today
)
{
$db
->
update
(
'profiles'
,
[
'coins'
=>
$newCoins
],
[
'id'
=>
'eq.'
.
$userId
]);
jsonError
(
'Already claimed today'
);
}
$streak
=
(
$profile
[
'daily_streak'
]
??
0
)
+
1
;
$yesterday
=
date
(
'Y-m-d'
,
strtotime
(
'-1 day'
));
if
(
$lastClaim
&&
substr
(
$lastClaim
,
0
,
10
)
!==
$yesterday
)
{
$streak
=
1
;
}
$baseReward
=
50
;
$streakBonus
=
min
(
$streak
*
10
,
100
);
$totalCoins
=
$baseReward
+
$streakBonus
;
$newCoins
=
(
$profile
[
'coins'
]
??
0
)
+
$totalCoins
;
$db
->
update
(
'profiles'
,
[
'coins'
=>
$newCoins
,
'last_daily_claim'
=>
date
(
'c'
),
'daily_streak'
=>
$streak
],
[
'id'
=>
'eq.'
.
$userId
]);
$sdb
=
supabaseService
();
$sdb
=
supabaseService
();
$sdb
->
insert
(
'economy_transactions'
,
[
$sdb
->
insert
(
'economy_transactions'
,
[
'player_id'
=>
$userId
,
'player_id'
=>
$userId
,
'type'
=>
'daily_reward'
,
'type'
=>
'daily_reward'
,
'currency'
=>
'coins'
,
'currency'
=>
'coins'
,
'amount'
=>
$
totalCoins
,
'amount'
=>
$
reward
,
'balance_after'
=>
$newCoins
,
'balance_after'
=>
$newCoins
,
'description'
=>
"Daily reward (day
{
$streak
}
)"
'description'
=>
'Daily reward'
]);
]);
jsonResponse
([
jsonResponse
([
'coins'
=>
$totalCoins
,
'coins'
=>
$reward
,
'streak'
=>
$streak
,
'total_coins'
=>
$newCoins
'total_coins'
=>
$newCoins
]);
]);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment