Commit 8ac46f93 authored by Olivia Madrid's avatar Olivia Madrid
Browse files

(wip): Referrals - add comments, give one free token on join rewards

parent 9d7add84
Loading
Loading
Loading
Loading
+5 −22
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ class referrals implements Interfaces\Api
        $response = [];

        $referrer_guid = isset($pages[0]) ? $pages[0] : Core\Session::getLoggedInUser()->guid;
        $limit = isset($_GET['limit']) ? $_GET['limit'] : 24;
        $limit = isset($_GET['limit']) ? $_GET['limit'] : 12;
        $offset = isset($_GET['offset']) ? $_GET['offset'] : "";

        $manager = Di::_()->get('Referrals\Manager');
@@ -47,23 +47,6 @@ class referrals implements Interfaces\Api
        $response['referrals'] = Factory::exportable(array_values($referrals->toArray()));
        $response['load-next'] = (string) $referrals->getPagingToken();

        // $tempProspect = (object) [
        //     "guid" => "988145006634078224",
        //     "verified" => true,
        //     "username" => "oldprospector",
        //     "name" => "oldprospector",
        //     "icontime" => "1560987887"
        // ];
        // $tempRef = (object) [
        //     'referrer_guid' => '987892327202689039',
        //     'state' => 'complete',
        //     'register_timestamp' => "1560857128000",
        //     'join_timestamp' => "1560867128000",
        //     'prospect' => $tempProspect
        // ];
        
        // array_push($response['referrals'], $tempRef);

        return Factory::response($response);
    }

+10 −10
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ class Manager
     */
    public function update($referral)
    {
        // Update the join timestamp
        // Update join_timestamp
        $this->repository->update($referral);

        // Send a notification to the referrer
@@ -91,7 +91,7 @@ class Manager
     */
    public function ping($referral)
    {
        // Update the ping timestamp
        // Update ping_timestamp
        $this->repository->ping($referral);

        // Send a ping notification to the prospect
+4 −4
Original line number Diff line number Diff line
@@ -65,12 +65,12 @@ class Referral
    public function getPingable()
    {

        // determines duration a referrer must wait before re-pinging
        // Duration referrer must wait before re-pinging
        $waitTime= 1000*60*60*24*7; // 7 days
        $now = time();

        $now = time() * 1000;
        $elapsedTime = $now - $this->pingTimestamp;

        // referrer can't send another ping notification until a week has gone by
        if ($this->pingTimestamp && $elapsedTime < $waitTime ) {
            return false;
        }