Skip to content

Commit

Permalink
GH-230 Move triggering referral task to an util
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Jul 3, 2022
1 parent e3ea5a9 commit b35b26c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 19 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/utils/effects/handleProxyDetection.effect.php');
include($includePath . './screens/FirstLogin/utils/effects/handleReferralMultiAccountDetection.effect.php');
include($includePath . './screens/FirstLogin/utils/effects/triggerUserReferralTask.effect.php');
include($includePath . './screens/FirstLogin/utils/helpers/getReferrerTasksData.helper.php');

});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

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

/**
* @param array $params
* @param arrayRef $params['referringUserWithTasksData']
*/
function triggerUserReferralTask($props) {
$referringUserWithTasksData = &$props['referringUserWithTasksData'];

if (empty($referringUserWithTasksData)) {
return;
}

Tasks_TriggerTask(
$referringUserWithTasksData,
'NEWUSER_REGISTER',
[
'mainCheck' => function ($JobArray, $ThisCat, $TaskID, $JobID) use (&$referringUserWithTasksData) {
$taskStatusCheckResult = Tasks_TriggerTask_MainCheck_Progressive($JobArray, $ThisCat, $TaskID, $JobID, $referringUserWithTasksData, 1);

$referringUserWithTasksData['TaskData'][] = [
'TaskID' => $TaskID,
'TaskStatus' => $referringUserWithTasksData['tasks_done_parsed']['status'][$ThisCat][$TaskID][$JobID],
'TaskLimit' => $JobArray[$JobArray['statusField']]
];

return $taskStatusCheckResult;
}
]
);
}

?>
22 changes: 3 additions & 19 deletions overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,9 @@
'referredById' => $_User['referred'],
]);

if(!empty($referringUserWithTasksData))
{
Tasks_TriggerTask($referringUserWithTasksData, 'NEWUSER_REGISTER', array
(
'mainCheck' => function($JobArray, $ThisCat, $TaskID, $JobID) use (&$referringUserWithTasksData)
{
$Return = Tasks_TriggerTask_MainCheck_Progressive($JobArray, $ThisCat, $TaskID, $JobID, $referringUserWithTasksData, 1);
$referringUserWithTasksData['TaskData'][] = array
(
'TaskID' => $TaskID,
'TaskStatus' => $referringUserWithTasksData['tasks_done_parsed']['status'][$ThisCat][$TaskID][$JobID],
'TaskLimit' => $JobArray[$JobArray['statusField']]
);
return $Return;
}
));
}

// Check IP Intersection
Overview\Screens\FirstLogin\Utils\Effects\triggerUserReferralTask([
'referringUserWithTasksData' => &$referringUserWithTasksData,
]);
Overview\Screens\FirstLogin\Utils\Effects\handleReferralMultiAccountDetection([
'user' => &$_User,
'referredById' => $_User['referred'],
Expand Down

0 comments on commit b35b26c

Please sign in to comment.