webman/app/controller/RecommendController.php

33 lines
858 B
PHP

<?php
namespace app\controller;
use app\model\Recommend;
use App\Utils\API\Facebook;
use App\Utils\API\PaymentNew;
use support\Request;
use App\Utils\ApiResponse;
use support\Log;
class RecommendController
{
protected $noNeedLogin = ['index'];
/**
* @Apidoc\Title("1.0 推广链接")
* @Apidoc\Url("Recommend/index")
* @Apidoc\Method("POST")
*/
public function index(Request $request)
{
$invite_code = $request->get('invite_code');
$Recommend = Recommend::where('invite_code', $invite_code)->first();
if (!empty($Recommend)) {
$ip=$request->getRealIp($safe_mode = true);
Facebook::handleEvent(3, $invite_code, $ip);
return redirect("https://v8job.online/#/reg?i=$invite_code", 302);
}
return redirect("https://v8job.online/#/", 302);
}
}