Commit f6209d6b authored by hujun's avatar hujun

去除无门店和部门的经纪人

parent 04d358b4
......@@ -278,11 +278,26 @@ class Agent extends Basic
$table2 = new Agents();
$field = 'id,device_id,father_id,role_id,level,realname,phone,password,sex,head_portrait,inuse,created,modified,is_inside';
$where['level'] = ['in','2,5'];
$where['father_id'] = ['<>', 0];
$list = $table2->field($field)->where($where)->select();
$li = collection($list)->toArray();//转化arr
$data=array();
foreach ($li as $k=> $v){
/*******************************************************************/
$district_id=Db::table("a_district")
->field('id')
->where("agent_id in(select agent_id from chiefs_agents where sub_agent_id='{$v['father_id']}')")
->value();
if($district_id){
$data[$k]['district_id']=$district_id;/*部门Id 对应部门表*/
}else{
continue;
$data[$k]['district_id']=0;/*部门Id 对应部门表*/
}
/*******************************************************************/
$data[$k]['id'] = $v['id'];/* '经济人表'*/
$data[$k]['device_id']=$v['device_id']; /* '设备id'*/
$data[$k]['store_id']=$v['father_id']; /* '门店id关联门店表'*/
......@@ -308,17 +323,6 @@ class Agent extends Basic
default :/*默认权限*/
$data[$k]['auth_group_id']=7;
}
/*******************************************************************/
$district_id=Db::table("a_district")
->field('id')
->where("agent_id in(select agent_id from chiefs_agents where sub_agent_id='{$v['father_id']}')")
->value();
if($district_id){
$data[$k]['district_id']=$district_id;/*部门Id 对应部门表*/
}else{
$data[$k]['district_id']=0;/*部门Id 对应部门表*/
}
/*******************************************************************/
/************************级别****************************************/
if($v['level']==2){
......
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