Commit 6341a110 authored by hujun's avatar hujun

根据经纪人手机号 获取经纪人全部账号

parent f6791767
......@@ -186,8 +186,11 @@ class PayLogOpenService
public function getOpenList($agent_id, $status, $pageNo, $pageSize)
{
$verifyService = new VerifyService();
$agent_ids = $verifyService->getAgentsByAgentId($agent_id);
$agent_ids = $verifyService->getAgentsByAgentPhone($agent_id);
if (empty($agent_ids)) {
return null;
}
$where['a.agent_id'] = array("in", $agent_ids);
$where['a.status'] = $status;
$where['a.is_del'] = 0;
......
......@@ -63,6 +63,58 @@ class VerifyService
return null;
}
/**
* 根据经纪人手机号 获取经纪人全部账号
*
* @param $agent_id
* @return int|string
*/
public function getAgentsByAgentPhone($agent_id)
{
$s_redis = new RedisCacheService();
$agent_data = $s_redis->getRedisCache(2, $agent_id);
$params["phone"] = $agent_data['phone'];
$result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", $params);
$where['status'] = ['in', '0,3'];
$id_string = '';
foreach ($result as $value) {
switch ($value["level"]) {
case 10:
return $value["id"];
case 20:
$where['store_id'] = $value['store_id'];
$arr_list = $this->agentModel->getAgentsByWhereColumn($where, 'id');
if ($arr_list){
$id_string .= implode(',', $arr_list).',';
}
break;
case 30:
$where['district_id'] = $value['district_id'];
$arr_list = $this->agentModel->getAgentsByWhereColumn($where, 'id');
if ($arr_list) {
$id_string .= implode(',', $arr_list).',';
}
break;
case 40:
$where[] = ['EXP', 'district_id='.$value['district_id'].' or store_id='.$value['store_id']];
$arr_list = $this->agentModel->getAgentsByWhereColumn($where, 'id');
if ($arr_list) {
$id_string .= implode(',', $arr_list).',';
}
break;
default:
return $agent_id;
break;
}
}
if (isset($id_string)) {
$ids = rtrim($id_string, ',');
} else {
$ids = 0;
}
return $ids;
}
/**
* @param $agent_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment