main
nocode 1 year ago
parent c795450464
commit 6b90a0a51c
  1. 13
      Modules/Agents/Services/AgentService.php

@ -157,6 +157,15 @@ class AgentService
$myAgentDown->onlyGrant($input['grant']); $myAgentDown->onlyGrant($input['grant']);
} }
$listAgentGet = $myAgentDown->get(); $listAgentGet = $myAgentDown->get();
$allAgentInGeneral = $this->modelAgentUser->byAgentRoot($agentId)->joinAgent()->get();
$AgentById = [];
if(!empty($allAgentInGeneral)){
foreach($allAgentInGeneral as $vAgent){
$AgentById[$vAgent->agent_id] = $vAgent;
}
}
if (!empty($listAgentGet)) { if (!empty($listAgentGet)) {
$listAgentById = []; $listAgentById = [];
foreach ($listAgentGet as $kAgent) { foreach ($listAgentGet as $kAgent) {
@ -169,8 +178,8 @@ class AgentService
if (!empty($listAgentById)) { if (!empty($listAgentById)) {
foreach ($listAgentById as $vByAgent) { foreach ($listAgentById as $vByAgent) {
if (!empty($listAgentById[$vByAgent->grant_parent_id])) { if (!empty($AgentById[$vByAgent->grant_parent_id])) {
$agentParent = $listAgentById[$vByAgent->grant_parent_id]; $agentParent = $AgentById[$vByAgent->grant_parent_id];
$upGrant = $agentParent->code ?? null; $upGrant = $agentParent->code ?? null;
} }
if ($agentId == $vByAgent->agent_id) if ($agentId == $vByAgent->agent_id)

Loading…
Cancel
Save