diff --git a/app/Http/Controllers/Api/AuthApiController.php b/app/Http/Controllers/Api/AuthApiController.php index 5f5ced2..9a4d333 100755 --- a/app/Http/Controllers/Api/AuthApiController.php +++ b/app/Http/Controllers/Api/AuthApiController.php @@ -60,7 +60,8 @@ class AuthApiController extends BaseAuthApiController $myAgent = Agent::find($agentUser->agent_id); } - $phone = $myAgent->phone ?? null; + $phone = $user->phone ?? null; + $data['general_agents_code'] = $agentRootInfo->code ?? ''; $data['general_agents_name'] = $agentRootInfo->name ?? ''; $data['downline_register'] = $this->getLinkParam('downline_register', $phone); @@ -107,12 +108,18 @@ class AuthApiController extends BaseAuthApiController ]; $agentInsertId = Agent::insertGetId($dataAgentInsert); if($agentInsertId){ - AgentUser::insert(['user_id' => $userId, 'agent_id' => $agentInsertId, 'status' => 1, 'code' => $dataInsert['phone']]); + AgentUser::insert([ + 'user_id' => $userId, + 'agent_id' => $agentInsertId, + 'status' => 1, + 'code' => $dataInsert['phone'], + 'agent_root_id' => $checkUserAgent->agent_root_id + ]); }; } return response()->json(['status' => true, 'msg' => $this->getMessageReponse(1)]); } - + return response()->json(['status' => false, 'msg' => $this->getMessageReponse(2)]); } public function logout(Request $request)