Skip to content

Commit

Permalink
GH-230 Move adding free premium to its own util
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Jul 3, 2022
1 parent 85e022c commit 18b0b82
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
1 change: 1 addition & 0 deletions modules/overview/_includes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
include($includePath . './screens/FirstLogin/FirstLogin.screen.php');
include($includePath . './screens/FirstLogin/FirstLogin.utils.php');
include($includePath . './screens/FirstLogin/utils/effects/createUserDevLogDump.effect.php');
include($includePath . './screens/FirstLogin/utils/effects/giveUserPremium.effect.php');
include($includePath . './screens/FirstLogin/utils/effects/handleProxyDetection.effect.php');
include($includePath . './screens/FirstLogin/utils/effects/handleReferralMultiAccountDetection.effect.php');
include($includePath . './screens/FirstLogin/utils/effects/triggerUserReferralTask.effect.php');
Expand Down
9 changes: 5 additions & 4 deletions modules/overview/screens/FirstLogin/FirstLogin.utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ function runEffects($props) {
]);
}

// Check, if this IP is Proxy
FirstLogin\Utils\Effects\handleProxyDetection([
'user' => &$user,
'currentTimestamp' => $currentTimestamp,
]);

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

FirstLogin\Utils\Effects\createUserDevLogDump([
'userId' => $user['id'],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace UniEngine\Engine\Modules\Overview\Screens\FirstLogin\Utils\Effects;

/**
* Give Free ProAccount for 7 days
*
* @param array $params
* @param number $params['userId']
* @param number $params['currentTimestamp']
*/
function giveUserPremium($props) {
$userId = $props['userId'];
$currentTimestamp = $props['currentTimestamp'];

$itemId = '11';

$insertPremiumEntryQuery = (
"INSERT INTO {{table}} " .
"VALUES " .
"(NULL, {$userId}, {$currentTimestamp}, 0, 0, {$itemId}, 0) " .
";"
);

doquery($insertPremiumEntryQuery, 'premium_free');
}

?>

0 comments on commit 18b0b82

Please sign in to comment.