Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
3733c1bf
Commit
3733c1bf
authored
Oct 17, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件统一
parent
147c751f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
357 additions
and
391 deletions
+357
-391
Agent.php
application/index/controller/Agent.php
+0
-382
Broker.php
application/index/controller/Broker.php
+348
-0
route.php
application/route.php
+9
-9
No files found.
application/index/controller/Agent.php
deleted
100644 → 0
View file @
147c751f
<?php
/**
* 经济人表
* id
* store_id ------门店id关联门店表
* district_id --区域id关联区域表
* level ---------等级 10业务员 20店长 30总监
* name ----------经济人姓名
* phone ---------手机号
* password ------登录密码
* sex -----------性别 0保密 1男 2女
* img -----------头像
* status --------账号状态,0正常 1冻结 2离职
* create_time ---创建时间
* update_time ---修改时间
* Created by PhpStorm.
* User: zfc
* Date: 2018/2/26
* Time: 13:51
*/
namespace
app\index\controller
;
use
app\api_broker\service\CallPhoneService
;
use
app\api_broker\service\PushMessageService
;
use
app\index\extend\Basic
;
use
app\model\AAgents
;
use
app\model\ABindingDevice
;
use
app\model\Evaluate
;
use
think\Exception
;
use
think\Session
;
class
Agent
extends
Basic
{
/**
* 经纪人显示页面
*
* @return \think\response\View3
*/
public
function
agent
()
{
return
view
(
'agent'
);
}
/**
* 编辑页面
*
* @return \think\response\View
*/
public
function
saveAgentIndex
()
{
return
view
(
'save_agent'
);
}
/**
* 首页显示列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
AgentList
()
{
$table
=
new
AAgents
();
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
''
;
//获取当前模块可操作按钮start********************************
$userRule
=
Session
::
get
(
'userRule'
);
$data
[
'cz'
]
=
$userRule
[
'cz'
];
//获取当前模块可操作按钮end**********************************
$params
=
$this
->
request
->
param
();
//获取操作权限
$userRule
=
Session
::
get
(
'userRule'
);
$data
[
'userRule'
]
=
$userRule
;
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
//条件
// $where['a.status'] = ['IN',['0,1']];
$where
[
'a.id'
]
=
[
'<>'
,
1
];
if
(
!
empty
(
$params
[
'search'
]))
{
$where
[]
=
[
'EXP'
,
"a.name like '%
{
$params
[
'search'
]
}
%' OR a.phone like '%
{
$params
[
'search'
]
}
%'"
];
}
if
(
!
empty
(
$params
[
'group_name'
]))
{
$where
[
'g.title'
]
=
[
'LIKE'
,
"%
{
$params
[
'group_name'
]
}
%"
];
}
if
(
!
empty
(
$params
[
'store_id'
]))
{
$where
[
'a.store_id'
]
=
$params
[
'store_id'
];
}
if
(
!
empty
(
$params
[
'district_id'
]))
{
$where
[
'a.district_id'
]
=
$params
[
'district_id'
];
}
$field
=
"a.id,a.store_id,a.img,a.district_id,a.`level`,a.`name`,a.phone,a.`status`,a.inviter_id,a.create_time,
ifnull(s.store_name,'')store_name,ifnull(d.district_name,'')district_name,ifnull(g.title,'无')groupname"
;
$order
=
'a.id DESC'
;
$join
=
[
[
'a_store s'
,
' a.store_id=s.id'
,
'left'
],
[
'a_district d'
,
'a.district_id=d.id'
,
'left'
],
[
'auth_group g'
,
'a.auth_group_id=g.id'
,
'left'
]
];
$data
[
'list'
]
=
$table
->
getListJoin
(
$pageNo
,
$pageSize
,
$order
,
$field
,
$join
,
$where
);
foreach
(
$data
[
'list'
]
as
$k
=>
$v
)
{
$data
[
'list'
][
$k
][
'agent_img'
]
=
$v
[
'img'
]
?
AGENTHEADERIMGURL
.
$v
[
'img'
]
:
AGENTHEADERIMGURL
.
'icon_head.png'
;
}
$data
[
'total'
]
=
$table
->
getTotal2
(
$join
,
$where
);
return
$this
->
response
(
200
,
'成功'
,
$data
);
}
/**
* 经纪人设备绑定列表
* @return \think\Response
*/
public
function
deviceList
()
{
$agent_id
=
$this
->
request
->
param
(
"agent_id"
);
if
(
!
$agent_id
)
{
return
$this
->
response
(
101
,
'经纪人id不能为空'
);
}
$aBD
=
new
ABindingDevice
();
$params
[
"agent_id"
]
=
$agent_id
;
$field
=
"id,agent_id,device_id,model,is_forbidden,is_pc,create_time,update_time"
;
$result
=
$aBD
->
getDeviceByAgentId
(
$params
,
$field
);
if
(
count
(
$result
)
>
0
)
{
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
else
{
return
$this
->
response
(
"101"
,
"此账号未绑定过设备"
);
}
}
/**
* 绑定或者解绑
* @return \think\Response
*/
public
function
updateDevice
()
{
$params
=
$this
->
request
->
param
();
/* $params = array(
"agent_id" => 1,//解绑或者绑定的经纪人id
"id" => 1, //关系id
"operator_id" => 12,//操作人id 登陆后台的经纪人id
"is_forbidden" => 0,//0正常 1禁止
);*/
$checkResult
=
$this
->
validate
(
$params
,
"VerifyValidate.verifyIsForbidden"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$aBD
=
new
ABindingDevice
();
try
{
$id
=
$aBD
->
updateDevice
(
$params
);
if
(
$id
>
0
)
{
return
$this
->
response
(
"200"
,
"update success"
,
[
"id"
=>
$id
]);
}
else
{
return
$this
->
response
(
"101"
,
"请求异常"
);
}
}
catch
(
Exception
$exception
)
{
return
$this
->
response
(
"101"
,
"请求错误:"
.
$exception
);
}
}
/**
* 新增or修改or查看
* $group_id !=0为查看
* post存在id为新增
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
saveAgent
()
{
$m_agent
=
new
AAgents
();
$id
=
$this
->
params
[
'id'
];
if
(
$this
->
request
->
isPost
())
{
if
(
empty
(
$this
->
params
[
'store_id'
]))
{
return
$this
->
response
(
101
,
'门店id为空!'
);
}
if
(
empty
(
$this
->
params
[
'district_id'
]))
{
return
$this
->
response
(
101
,
'部门id为空!'
);
}
$num
=
0
;
//判断重复手机号
//新增或者编辑数据
if
(
empty
(
$this
->
params
[
'id'
]))
{
$num
=
$m_agent
->
getListDistrictTotal
([
'phone'
=>
$this
->
params
[
'phone'
]
]);
$data
[
'create_time'
]
=
date
(
'Y-m-d H:i:s'
,
time
());
$data
[
'update_time'
]
=
date
(
'Y-m-d H:i:s'
,
time
());
$id
=
0
;
$data
[
'password'
]
=
md5
(
substr
(
$this
->
params
[
'phone'
],
-
6
));
//默认号码后6位
$data
[
'auth_group_id'
]
=
5
;
}
else
{
$agent_data
=
$m_agent
->
verifyUser
(
'phone,password'
,
''
,
[
'id'
=>
$this
->
params
[
'id'
]
]);
if
(
$agent_data
[
'phone'
]
!=
$this
->
params
[
'phone'
])
{
$num
=
$m_agent
->
getListDistrictTotal
([
'phone'
=>
$this
->
params
[
'phone'
]
]);
}
$data
[
'update_time'
]
=
date
(
'Y-m-d H:i:s'
,
time
());
if
(
!
empty
(
$this
->
params
[
'password'
])
&&
!
empty
(
$agent_data
[
'password'
]))
{
$md5_password
=
md5
(
$this
->
params
[
'password'
]);
if
((
$md5_password
!=
$agent_data
[
'password'
])
&&
(
$agent_data
[
'password'
]
!=
$this
->
params
[
'password'
]))
{
$data
[
'password'
]
=
$md5_password
;
}
}
}
if
(
$num
>
0
)
{
return
$this
->
response
(
101
,
'手机号重复'
);
}
$data
[
'district_id'
]
=
$this
->
params
[
'district_id'
];
$data
[
'name'
]
=
trim
(
$this
->
params
[
'name'
]);
$data
[
'store_id'
]
=
$this
->
params
[
'store_id'
];
$data
[
'phone'
]
=
trim
(
$this
->
params
[
'phone'
]);
$data
[
'admin_off'
]
=
$this
->
params
[
'admin_off'
];
$data
[
'sex'
]
=
$this
->
params
[
'sex'
];
$data
[
'remarks'
]
=
$this
->
params
[
'remarks'
];
if
(
$m_agent
->
editData
(
$data
,
$id
))
{
return
$this
->
response
(
200
,
'成功'
);
}
else
{
return
$this
->
response
(
101
,
'无修改'
);
}
}
else
{
//查看
$info
=
$m_agent
->
verifyUser
(
'id,name,phone,password,district_id,store_id,sex,admin_off,remarks'
,
''
,
[
'id'
=>
$id
]);
return
$this
->
response
(
200
,
'查看'
,
$info
);
}
}
/**
* 删除(冻结)
*
* @return \think\Response
*/
public
function
updateStatus
()
{
$data
=
$this
->
request
->
param
();
$ids
=
$data
[
'ids'
];
//排除超级管理员
if
(
is_array
(
$ids
))
{
if
(
in_array
(
1
,
$ids
))
{
return
$this
->
response
(
100
,
'超级管理员不允许操作'
,
$data
);
}
}
else
{
if
(
$ids
===
1
)
{
return
$this
->
response
(
100
,
'超级管理员不允许操作'
,
$data
);
}
}
try
{
$m_agent
=
new
AAgents
();
if
(
$m_agent
->
saveStatus
(
'status'
,
$data
[
'status'
],
$ids
))
{
if
(
$data
[
'status'
]
!=
0
)
{
$is_forbidden
=
1
;
}
else
{
$is_forbidden
=
0
;
}
//同时修改设备绑定表
$m_agent_device
=
new
ABindingDevice
();
$m_agent_device
->
updateDate
([
'is_forbidden'
=>
$is_forbidden
],
[
'agent_id'
=>
$ids
]);
if
(
$data
[
'status'
]
==
1
)
{
$where
[
'a.id'
]
=
$ids
;
$where
[
'b.status'
]
=
1
;
$agent_phone
=
$m_agent
->
getAgentCallPhone
(
'b.phone_a,b.phone_b,c.phone_x'
,
$where
);
if
(
!
empty
(
$agent_phone
[
'data'
])
&&
$agent_phone
[
'status'
]
!=
'fail'
)
{
$call
=
new
CallPhoneService
();
foreach
(
$agent_phone
[
'data'
]
as
$k
=>
$v
)
{
$call
->
agentsUnBind
(
$v
[
'phone_a'
],
$v
[
'phone_b'
],
$v
[
'phone_x'
],
0
);
}
}
$push
=
new
PushMessageService
();
$message_data
[
'message'
]
=
'你的账号被冻结。'
;
$message_data
[
'agent_id'
]
=
$ids
;
$push
->
record
(
4
,
0
,
0
,
$this
->
userId
,
$message_data
);
}
return
$this
->
response
(
200
,
'成功'
,
$data
);
}
else
{
return
$this
->
response
(
100
,
'失败'
,
$data
);
}
}
catch
(
\Exception
$e
)
{
return
$this
->
response
(
100
,
'修改失败'
.
$e
->
getMessage
(),
$data
);
}
}
/**
* 批量变更角色
*
* @post ids 用户组id
* @post group_id 变更的角色组id
*/
public
function
updateRole
()
{
$table
=
New
AAgents
;
$data
=
$this
->
request
->
param
();
$ids
=
trim
(
$data
[
'ids'
],
','
);
$code
=
200
;
if
(
!
empty
(
$ids
)
&&
!
empty
(
$data
[
'group_id'
]))
{
if
(
$table
->
saveStatus
(
'auth_group_id'
,
$data
[
'group_id'
],
$ids
))
{
$msg
=
'成功'
;
}
else
{
$code
=
101
;
$msg
=
'失败'
;
}
}
else
{
$msg
=
'数据为空'
;
$code
=
101
;
}
return
$this
->
response
(
$code
,
$msg
,
$data
);
}
/**
* 经纪人列表计算-评价次数和分数
* 朱伟 2018年07月03日
*/
public
function
agentEvaluateNumAndFraction
()
{
$data
=
$this
->
request
->
param
();
/*$data = array(
"agents_id" => '869,5758,5757,5756,5755,5754,5753,5752,5751,5750,5749,5748,5747,5746,5745'
);*/
$agents_ids
=
$data
[
'agents_id'
];
if
(
!
isset
(
$agents_ids
))
{
return
$this
->
response
(
"300"
,
"参数不全"
);
}
$model
=
new
Evaluate
();
foreach
(
explode
(
','
,
$agents_ids
)
as
$k
=>
$v
)
{
$params
[
'agents_id'
]
=
$v
;
//dump($v);
$field
=
'sum(evaluate_grade) as agent_evaluate_fraction'
;
$agent_evaluate_num
=
$model
->
getAgentEvaluateNum
(
$params
);
$agent_evaluate_fraction_res
=
$model
->
getAgentEvaluateFraction
(
$field
,
$params
);
$agent_evaluate_fraction
=
0
;
if
(
$agent_evaluate_fraction_res
[
0
][
'agent_evaluate_fraction'
])
{
$agent_evaluate_fraction
=
floor
(
$agent_evaluate_fraction_res
[
0
][
'agent_evaluate_fraction'
]
/
2
/
$agent_evaluate_num
);
}
$res
[
'agents_id'
]
=
$v
;
$res
[
'agent_evaluate_num'
]
=
$agent_evaluate_num
;
$res
[
'agent_evaluate_fraction'
]
=
$agent_evaluate_fraction
;
$result
[]
=
$res
;
}
if
(
$result
)
{
return
$this
->
response
(
200
,
'成功'
,
$result
);
}
else
{
return
$this
->
response
(
100
,
'失败'
);
}
}
}
\ No newline at end of file
application/index/controller/Broker.php
View file @
3733c1bf
...
...
@@ -9,10 +9,15 @@
namespace
app\index\controller
;
use
app\api_broker\service\CallPhoneService
;
use
app\api_broker\service\PushMessageService
;
use
app\extra\RedisExt
;
use
app\index\extend\Basic
;
use
app\model\AAgents
;
use
app\model\ABindingDevice
;
use
app\model\Evaluate
;
use
app\model\GHousesToAgents
;
use
think\Session
;
class
Broker
extends
Basic
{
...
...
@@ -282,4 +287,346 @@ class Broker extends Basic
return
$this
->
response
(
$code
,
$msg
);
}
/**
* 经纪人显示页面
*
* @return \think\response\View
*/
public
function
agent
()
{
return
view
(
'agent'
);
}
/**
* 编辑页面
*
* @return \think\response\View
*/
public
function
saveAgentIndex
()
{
return
view
(
'save_agent'
);
}
/**
* 首页显示列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
AgentList
()
{
$table
=
new
AAgents
();
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
''
;
//获取当前模块可操作按钮start********************************
$userRule
=
Session
::
get
(
'userRule'
);
$data
[
'cz'
]
=
$userRule
[
'cz'
];
//获取当前模块可操作按钮end**********************************
$params
=
$this
->
request
->
param
();
//获取操作权限
$userRule
=
Session
::
get
(
'userRule'
);
$data
[
'userRule'
]
=
$userRule
;
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
//条件
// $where['a.status'] = ['IN',['0,1']];
$where
[
'a.id'
]
=
[
'<>'
,
1
];
if
(
!
empty
(
$params
[
'search'
]))
{
$where
[]
=
[
'EXP'
,
"a.name like '%
{
$params
[
'search'
]
}
%' OR a.phone like '%
{
$params
[
'search'
]
}
%'"
];
}
if
(
!
empty
(
$params
[
'group_name'
]))
{
$where
[
'g.title'
]
=
[
'LIKE'
,
"%
{
$params
[
'group_name'
]
}
%"
];
}
if
(
!
empty
(
$params
[
'store_id'
]))
{
$where
[
'a.store_id'
]
=
$params
[
'store_id'
];
}
if
(
!
empty
(
$params
[
'district_id'
]))
{
$where
[
'a.district_id'
]
=
$params
[
'district_id'
];
}
$field
=
"a.id,a.store_id,a.img,a.district_id,a.`level`,a.`name`,a.phone,a.`status`,a.inviter_id,a.create_time,
ifnull(s.store_name,'')store_name,ifnull(d.district_name,'')district_name,ifnull(g.title,'无')groupname"
;
$order
=
'a.id DESC'
;
$join
=
[
[
'a_store s'
,
' a.store_id=s.id'
,
'left'
],
[
'a_district d'
,
'a.district_id=d.id'
,
'left'
],
[
'auth_group g'
,
'a.auth_group_id=g.id'
,
'left'
]
];
$data
[
'list'
]
=
$table
->
getListJoin
(
$pageNo
,
$pageSize
,
$order
,
$field
,
$join
,
$where
);
foreach
(
$data
[
'list'
]
as
$k
=>
$v
)
{
$data
[
'list'
][
$k
][
'agent_img'
]
=
$v
[
'img'
]
?
AGENTHEADERIMGURL
.
$v
[
'img'
]
:
AGENTHEADERIMGURL
.
'icon_head.png'
;
}
$data
[
'total'
]
=
$table
->
getTotal2
(
$join
,
$where
);
return
$this
->
response
(
200
,
'成功'
,
$data
);
}
/**
* 经纪人设备绑定列表
* @return \think\Response
*/
public
function
deviceList
()
{
$agent_id
=
$this
->
request
->
param
(
"agent_id"
);
if
(
!
$agent_id
)
{
return
$this
->
response
(
101
,
'经纪人id不能为空'
);
}
$aBD
=
new
ABindingDevice
();
$params
[
"agent_id"
]
=
$agent_id
;
$field
=
"id,agent_id,device_id,model,is_forbidden,is_pc,create_time,update_time"
;
$result
=
$aBD
->
getDeviceByAgentId
(
$params
,
$field
);
if
(
count
(
$result
)
>
0
)
{
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
else
{
return
$this
->
response
(
"101"
,
"此账号未绑定过设备"
);
}
}
/**
* 绑定或者解绑
* @return \think\Response
*/
public
function
updateDevice
()
{
$params
=
$this
->
request
->
param
();
/* $params = array(
"agent_id" => 1,//解绑或者绑定的经纪人id
"id" => 1, //关系id
"operator_id" => 12,//操作人id 登陆后台的经纪人id
"is_forbidden" => 0,//0正常 1禁止
);*/
$checkResult
=
$this
->
validate
(
$params
,
"VerifyValidate.verifyIsForbidden"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$aBD
=
new
ABindingDevice
();
try
{
$id
=
$aBD
->
updateDevice
(
$params
);
if
(
$id
>
0
)
{
return
$this
->
response
(
"200"
,
"update success"
,
[
"id"
=>
$id
]);
}
else
{
return
$this
->
response
(
"101"
,
"请求异常"
);
}
}
catch
(
\Exception
$exception
)
{
return
$this
->
response
(
"101"
,
"请求错误:"
.
$exception
->
getMessage
());
}
}
/**
* 新增or修改or查看
* $group_id !=0为查看
* post存在id为新增
*
* @return \think\Response
*/
public
function
saveAgent
()
{
$m_agent
=
new
AAgents
();
$id
=
$this
->
params
[
'id'
];
if
(
$this
->
request
->
isPost
())
{
if
(
empty
(
$this
->
params
[
'store_id'
]))
{
return
$this
->
response
(
101
,
'门店id为空!'
);
}
if
(
empty
(
$this
->
params
[
'district_id'
]))
{
return
$this
->
response
(
101
,
'部门id为空!'
);
}
$num
=
0
;
//判断重复手机号
//新增或者编辑数据
if
(
empty
(
$this
->
params
[
'id'
]))
{
$num
=
$m_agent
->
getListDistrictTotal
([
'phone'
=>
$this
->
params
[
'phone'
]
]);
$data
[
'create_time'
]
=
date
(
'Y-m-d H:i:s'
,
time
());
$data
[
'update_time'
]
=
date
(
'Y-m-d H:i:s'
,
time
());
$id
=
0
;
$data
[
'password'
]
=
md5
(
substr
(
$this
->
params
[
'phone'
],
-
6
));
//默认号码后6位
$data
[
'auth_group_id'
]
=
5
;
}
else
{
$agent_data
=
$m_agent
->
verifyUser
(
'phone,password'
,
''
,
[
'id'
=>
$this
->
params
[
'id'
]
]);
if
(
$agent_data
[
'phone'
]
!=
$this
->
params
[
'phone'
])
{
$num
=
$m_agent
->
getListDistrictTotal
([
'phone'
=>
$this
->
params
[
'phone'
]
]);
}
$data
[
'update_time'
]
=
date
(
'Y-m-d H:i:s'
,
time
());
if
(
!
empty
(
$this
->
params
[
'password'
])
&&
!
empty
(
$agent_data
[
'password'
]))
{
$md5_password
=
md5
(
$this
->
params
[
'password'
]);
if
((
$md5_password
!=
$agent_data
[
'password'
])
&&
(
$agent_data
[
'password'
]
!=
$this
->
params
[
'password'
]))
{
$data
[
'password'
]
=
$md5_password
;
}
}
}
if
(
$num
>
0
)
{
return
$this
->
response
(
101
,
'手机号重复'
);
}
$data
[
'district_id'
]
=
$this
->
params
[
'district_id'
];
$data
[
'name'
]
=
trim
(
$this
->
params
[
'name'
]);
$data
[
'store_id'
]
=
$this
->
params
[
'store_id'
];
$data
[
'phone'
]
=
trim
(
$this
->
params
[
'phone'
]);
$data
[
'admin_off'
]
=
$this
->
params
[
'admin_off'
];
$data
[
'sex'
]
=
$this
->
params
[
'sex'
];
$data
[
'remarks'
]
=
$this
->
params
[
'remarks'
];
if
(
$m_agent
->
editData
(
$data
,
$id
))
{
return
$this
->
response
(
200
,
'成功'
);
}
else
{
return
$this
->
response
(
101
,
'无修改'
);
}
}
else
{
//查看
$info
=
$m_agent
->
verifyUser
(
'id,name,phone,password,district_id,store_id,sex,admin_off,remarks'
,
''
,
[
'id'
=>
$id
]);
return
$this
->
response
(
200
,
'查看'
,
$info
);
}
}
/**
* 删除(冻结)
*
* @return \think\Response
*/
public
function
updateStatus
()
{
$data
=
$this
->
request
->
param
();
$ids
=
$data
[
'ids'
];
//排除超级管理员
if
(
is_array
(
$ids
))
{
if
(
in_array
(
1
,
$ids
))
{
return
$this
->
response
(
100
,
'超级管理员不允许操作'
,
$data
);
}
}
else
{
if
(
$ids
===
1
)
{
return
$this
->
response
(
100
,
'超级管理员不允许操作'
,
$data
);
}
}
try
{
$m_agent
=
new
AAgents
();
if
(
$m_agent
->
saveStatus
(
'status'
,
$data
[
'status'
],
$ids
))
{
if
(
$data
[
'status'
]
!=
0
)
{
$is_forbidden
=
1
;
}
else
{
$is_forbidden
=
0
;
}
//同时修改设备绑定表
$m_agent_device
=
new
ABindingDevice
();
$m_agent_device
->
updateDate
([
'is_forbidden'
=>
$is_forbidden
],
[
'agent_id'
=>
$ids
]);
if
(
$data
[
'status'
]
==
1
)
{
$where
[
'a.id'
]
=
$ids
;
$where
[
'b.status'
]
=
1
;
$agent_phone
=
$m_agent
->
getAgentCallPhone
(
'b.phone_a,b.phone_b,c.phone_x'
,
$where
);
if
(
!
empty
(
$agent_phone
[
'data'
])
&&
$agent_phone
[
'status'
]
!=
'fail'
)
{
$call
=
new
CallPhoneService
();
foreach
(
$agent_phone
[
'data'
]
as
$k
=>
$v
)
{
$call
->
agentsUnBind
(
$v
[
'phone_a'
],
$v
[
'phone_b'
],
$v
[
'phone_x'
],
0
);
}
}
$push
=
new
PushMessageService
();
$message_data
[
'message'
]
=
'你的账号被冻结。'
;
$message_data
[
'agent_id'
]
=
$ids
;
$push
->
record
(
4
,
0
,
0
,
$this
->
userId
,
$message_data
);
}
return
$this
->
response
(
200
,
'成功'
,
$data
);
}
else
{
return
$this
->
response
(
100
,
'失败'
,
$data
);
}
}
catch
(
\Exception
$e
)
{
return
$this
->
response
(
100
,
'修改失败'
.
$e
->
getMessage
(),
$data
);
}
}
/**
* 批量变更角色
*
* @post ids 用户组id
* @post group_id 变更的角色组id
*/
public
function
updateRole
()
{
$table
=
New
AAgents
;
$data
=
$this
->
request
->
param
();
$ids
=
trim
(
$data
[
'ids'
],
','
);
$code
=
200
;
if
(
!
empty
(
$ids
)
&&
!
empty
(
$data
[
'group_id'
]))
{
if
(
$table
->
saveStatus
(
'auth_group_id'
,
$data
[
'group_id'
],
$ids
))
{
$msg
=
'成功'
;
}
else
{
$code
=
101
;
$msg
=
'失败'
;
}
}
else
{
$msg
=
'数据为空'
;
$code
=
101
;
}
return
$this
->
response
(
$code
,
$msg
,
$data
);
}
/**
* 经纪人列表计算-评价次数和分数
* 朱伟 2018年07月03日
*/
public
function
agentEvaluateNumAndFraction
()
{
$data
=
$this
->
request
->
param
();
/*$data = array(
"agents_id" => '869,5758,5757,5756,5755,5754,5753,5752,5751,5750,5749,5748,5747,5746,5745'
);*/
$agents_ids
=
$data
[
'agents_id'
];
$result
=
[];
if
(
!
isset
(
$agents_ids
))
{
return
$this
->
response
(
"300"
,
"参数不全"
);
}
$model
=
new
Evaluate
();
foreach
(
explode
(
','
,
$agents_ids
)
as
$k
=>
$v
)
{
$params
[
'agents_id'
]
=
$v
;
//dump($v);
$field
=
'sum(evaluate_grade) as agent_evaluate_fraction'
;
$agent_evaluate_num
=
$model
->
getAgentEvaluateNum
(
$params
);
$agent_evaluate_fraction_res
=
$model
->
getAgentEvaluateFraction
(
$field
,
$params
);
$agent_evaluate_fraction
=
0
;
if
(
$agent_evaluate_fraction_res
[
0
][
'agent_evaluate_fraction'
])
{
$agent_evaluate_fraction
=
floor
(
$agent_evaluate_fraction_res
[
0
][
'agent_evaluate_fraction'
]
/
2
/
$agent_evaluate_num
);
}
$res
[
'agents_id'
]
=
$v
;
$res
[
'agent_evaluate_num'
]
=
$agent_evaluate_num
;
$res
[
'agent_evaluate_fraction'
]
=
$agent_evaluate_fraction
;
$result
[]
=
$res
;
}
if
(
$result
)
{
return
$this
->
response
(
200
,
'成功'
,
$result
);
}
else
{
return
$this
->
response
(
100
,
'失败'
);
}
}
}
\ No newline at end of file
application/route.php
View file @
3733c1bf
...
...
@@ -143,14 +143,14 @@ Route::group('index', [
'updateRoleStatus'
=>
[
'index/auth/updateRoleStatus'
,
[
'method'
=>
'post'
]
],
//--规则编辑【接口】
'agent'
=>
[
'index/
agent
/agent'
,
[
'method'
=>
'get'
]
],
//首页列表界面
'saveAgentIndex'
=>
[
'index/
agent
/saveAgentIndex'
,
[
'method'
=>
'get'
]
],
//编辑列表列表界面
'AgentList'
=>
[
'index/
agent
/AgentList'
,
[
'method'
=>
'get'
]
],
//首页列表【接口】
'saveAgent'
=>
[
'index/
agent
/saveAgent'
,
[
'method'
=>
'get|post'
]
],
//修改经纪人【接口】
'updateStatus'
=>
[
'index/
agent
/updateStatus'
,
[
'method'
=>
'post'
]
],
//状态修改【接口】
'updateRole'
=>
[
'index/
agent
/updateRole'
,
[
'method'
=>
'post'
]
],
//经纪人角色修改【接口】
'deviceList'
=>
[
'index/
agent
/deviceList'
,
[
'method'
=>
'post|get'
]
],
//经纪人设备id绑定列表
'updateDevice'
=>
[
'index/
agent
/updateDevice'
,
[
'method'
=>
'post|get'
]
],
//解绑或绑定经纪人设备id
'agent'
=>
[
'index/
broker
/agent'
,
[
'method'
=>
'get'
]
],
//首页列表界面
'saveAgentIndex'
=>
[
'index/
broker
/saveAgentIndex'
,
[
'method'
=>
'get'
]
],
//编辑列表列表界面
'AgentList'
=>
[
'index/
broker
/AgentList'
,
[
'method'
=>
'get'
]
],
//首页列表【接口】
'saveAgent'
=>
[
'index/
broker
/saveAgent'
,
[
'method'
=>
'get|post'
]
],
//修改经纪人【接口】
'updateStatus'
=>
[
'index/
broker
/updateStatus'
,
[
'method'
=>
'post'
]
],
//状态修改【接口】
'updateRole'
=>
[
'index/
broker
/updateRole'
,
[
'method'
=>
'post'
]
],
//经纪人角色修改【接口】
'deviceList'
=>
[
'index/
broker
/deviceList'
,
[
'method'
=>
'post|get'
]
],
//经纪人设备id绑定列表
'updateDevice'
=>
[
'index/
broker
/updateDevice'
,
[
'method'
=>
'post|get'
]
],
//解绑或绑定经纪人设备id
//客户标签
'getULabelsList'
=>
[
'index/label/getULabelsList'
,
[
'method'
=>
'get'
]
],
//客户标签列表接口/界面
...
...
@@ -285,7 +285,7 @@ Route::group('index', [
'delNews'
=>
[
'index/news/delNews'
,
[
'method'
=>
'POST'
]
],
//删除商学院文章
'new_text'
=>
[
'index/news/newText'
,
[
'method'
=>
'GET'
]
],
'delNewsFile'
=>
[
'index/news/delNewsFile'
,
[
'method'
=>
'POST'
]
],
//删除商学院附件
'agentEvaluateNumAndFraction'
=>
[
'index/
agent
/agentEvaluateNumAndFraction'
,
[
'method'
=>
'POST|GET'
]
],
//经纪人列表计算-评价次数和分数 朱伟 2018-07-03
'agentEvaluateNumAndFraction'
=>
[
'index/
broker
/agentEvaluateNumAndFraction'
,
[
'method'
=>
'POST|GET'
]
],
//经纪人列表计算-评价次数和分数 朱伟 2018-07-03
'uploadImg'
=>
[
'index/UploadImg/uploadImg'
,
[
'method'
=>
'POST'
]
],
//全局图片上传
'followUpList'
=>
[
'index/HouseFollowUp/followUpList'
,
[
'method'
=>
'GET'
]
],
//商铺跟进liu
'inspectionRecordList'
=>
[
'index/InspectionRecord/inspectionRecordList'
,
[
'method'
=>
'GET'
]
],
//约带看记录liu
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment