|
|
@ -45,6 +45,7 @@ class AuthApiController extends BaseAuthApiController |
|
|
|
'phone' => $user->phone, |
|
|
|
'phone' => $user->phone, |
|
|
|
'last_login' => $user->last_login, |
|
|
|
'last_login' => $user->last_login, |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
$agentUser = AgentUser::where('user_id', $user->id)->latest()->first(); |
|
|
|
$agentUser = AgentUser::where('user_id', $user->id)->latest()->first(); |
|
|
|
if(!empty($agentUser->agent_root_id)){ |
|
|
|
if(!empty($agentUser->agent_root_id)){ |
|
|
|
$agentRootInfo = Agent::find($agentUser->agent_root_id); |
|
|
|
$agentRootInfo = Agent::find($agentUser->agent_root_id); |
|
|
@ -52,12 +53,13 @@ class AuthApiController extends BaseAuthApiController |
|
|
|
if(!empty($agentUser->agent_id)){ |
|
|
|
if(!empty($agentUser->agent_id)){ |
|
|
|
$myAgent = Agent::find($agentUser->agent_id); |
|
|
|
$myAgent = Agent::find($agentUser->agent_id); |
|
|
|
} |
|
|
|
} |
|
|
|
$myAgentCode = $myAgent->code??null; |
|
|
|
|
|
|
|
|
|
|
|
$phone = $myAgent->phone??null; |
|
|
|
$data['general_agents_code'] = $agentRootInfo->code??''; |
|
|
|
$data['general_agents_code'] = $agentRootInfo->code??''; |
|
|
|
$data['general_agents_name'] = $agentRootInfo->name??''; |
|
|
|
$data['general_agents_name'] = $agentRootInfo->name??''; |
|
|
|
$data['downline_register'] = $this->getLinkParam('downline_register', $myAgentCode); |
|
|
|
$data['downline_register'] = $this->getLinkParam('downline_register', $phone); |
|
|
|
$data['promotional_link'] = $this->getLinkParam('promotional_link', $myAgentCode); |
|
|
|
$data['promotional_link'] = $this->getLinkParam('promotional_link', $phone); |
|
|
|
$data['role'] = $user->gender; |
|
|
|
$data['role'] = $user->user_type; |
|
|
|
// Creating a token without scopes... |
|
|
|
// Creating a token without scopes... |
|
|
|
$token = $user->createToken($user->id . ' token ' . time(), ['*'])->accessToken; |
|
|
|
$token = $user->createToken($user->id . ' token ' . time(), ['*'])->accessToken; |
|
|
|
|
|
|
|
|
|
|
@ -145,16 +147,16 @@ class AuthApiController extends BaseAuthApiController |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
function getLinkParam($type, $agentCode){ |
|
|
|
function getLinkParam($type, $phone){ |
|
|
|
$arr = [ |
|
|
|
$arr = [ |
|
|
|
'downline_register' => 'daisu.sundayenglish.com', |
|
|
|
'downline_register' => 'daisu.sundayenglish.com/dk', |
|
|
|
'promotional_link' => 'thongtin.sundayenglish.com' |
|
|
|
'promotional_link' => 'thongtin.sundayenglish.com' |
|
|
|
]; |
|
|
|
]; |
|
|
|
$domain = $arr[$type]??''; |
|
|
|
$domain = $arr[$type]??''; |
|
|
|
if(empty($agentCode)){ |
|
|
|
if(empty($phone)){ |
|
|
|
return $domain; |
|
|
|
return $domain; |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
$params = http_build_query(['mdl' => $agentCode]); |
|
|
|
$params = http_build_query(['mds' => $phone]); |
|
|
|
return $domain.'?'.$params; |
|
|
|
return $domain.'?'.$params; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|