Skip to content

Commit 18b0b82

Browse files
committed
GH-230 Move adding free premium to its own util
1 parent 85e022c commit 18b0b82

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

modules/overview/_includes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
include($includePath . './screens/FirstLogin/FirstLogin.screen.php');
1010
include($includePath . './screens/FirstLogin/FirstLogin.utils.php');
1111
include($includePath . './screens/FirstLogin/utils/effects/createUserDevLogDump.effect.php');
12+
include($includePath . './screens/FirstLogin/utils/effects/giveUserPremium.effect.php');
1213
include($includePath . './screens/FirstLogin/utils/effects/handleProxyDetection.effect.php');
1314
include($includePath . './screens/FirstLogin/utils/effects/handleReferralMultiAccountDetection.effect.php');
1415
include($includePath . './screens/FirstLogin/utils/effects/triggerUserReferralTask.effect.php');

modules/overview/screens/FirstLogin/FirstLogin.utils.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ function runEffects($props) {
3434
]);
3535
}
3636

37-
// Check, if this IP is Proxy
3837
FirstLogin\Utils\Effects\handleProxyDetection([
3938
'user' => &$user,
4039
'currentTimestamp' => $currentTimestamp,
4140
]);
4241

43-
// TODO: move this to utils
44-
// Give Free ProAccount for 7 days
45-
// doquery("INSERT INTO {{table}} VALUES (NULL, {$user['id']}, UNIX_TIMESTAMP(), 0, 0, 11, 0);", 'premium_free');
42+
// Note: disabled by default
43+
// FirstLogin\Utils\Effects\giveUserPremium([
44+
// 'userId' => $user['id'],
45+
// 'currentTimestamp' => $currentTimestamp,
46+
// ]);
4647

4748
FirstLogin\Utils\Effects\createUserDevLogDump([
4849
'userId' => $user['id'],
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace UniEngine\Engine\Modules\Overview\Screens\FirstLogin\Utils\Effects;
4+
5+
/**
6+
* Give Free ProAccount for 7 days
7+
*
8+
* @param array $params
9+
* @param number $params['userId']
10+
* @param number $params['currentTimestamp']
11+
*/
12+
function giveUserPremium($props) {
13+
$userId = $props['userId'];
14+
$currentTimestamp = $props['currentTimestamp'];
15+
16+
$itemId = '11';
17+
18+
$insertPremiumEntryQuery = (
19+
"INSERT INTO {{table}} " .
20+
"VALUES " .
21+
"(NULL, {$userId}, {$currentTimestamp}, 0, 0, {$itemId}, 0) " .
22+
";"
23+
);
24+
25+
doquery($insertPremiumEntryQuery, 'premium_free');
26+
}
27+
28+
?>

0 commit comments

Comments
 (0)