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
f606ff05
Commit
f606ff05
authored
Feb 27, 2019
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
冻结经纪人
parent
5a07c181
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
16 deletions
+34
-16
AAgents.php
application/model/AAgents.php
+7
-5
FrostAgentTask.php
application/task/controller/FrostAgentTask.php
+27
-11
No files found.
application/model/AAgents.php
View file @
f606ff05
...
...
@@ -388,15 +388,17 @@ class AAgents extends BaseModel
public
function
selectFollowUpNumByAgent
(
$field
=
"a.id"
,
$table
,
$params
,
$num
)
{
$
where
[
"district_id"
]
=
array
(
'not in'
,
array
(
'13'
,
'14'
,
'15'
)
);
return
Db
::
table
(
$this
->
table
)
$
params
[
"district_id"
]
=
array
(
'not in'
,
array
(
'13'
,
'14'
,
'15'
)
);
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
$table
.
" as b"
,
"a.id = b.agent_id"
,
"righ
t"
)
->
join
(
"
$table
b"
,
"a.id = b.agent_id"
,
"lef
t"
)
->
where
(
$params
)
->
group
(
"
b.agent_
id"
)
->
having
(
"count
>
$num
"
)
->
group
(
"
a.
id"
)
->
having
(
"count
<
$num
"
)
->
select
();
//echo $this->getLastSql();
return
$result
;
}
/**
...
...
application/task/controller/FrostAgentTask.php
View file @
f606ff05
...
...
@@ -7,6 +7,7 @@ namespace app\task\controller;
* Date: 2019/2/27
* Time: 16:05
*/
use
app\extra\RedisExt
;
use
app\model\AAgents
;
use
app\model\ASite
;
...
...
@@ -15,36 +16,51 @@ class FrostAgentTask{
private
$table
=
'u_phone_follow_up_'
;
private
$date
;
private
$siteModel
;
private
$redis_
;
function
__construct
()
{
$this
->
agentsModel
=
new
AAgents
();
$this
->
date
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$this
->
siteModel
=
new
ASite
();
$this
->
agentsModel
=
new
AAgents
();
$this
->
date
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$this
->
siteModel
=
new
ASite
();
$this
->
redis_
=
RedisExt
::
getRedis
();
}
public
function
frostAgent
(){
//select count(1) as count,a.phone from a_agents a RIGHT JOIN u_phone_follow_up_10001 b on a.id = b.agent_id
//GROUP BY b.agent_id HAVING count >15 ;
$num
=
$this
->
redis_
->
get
(
"s_agent_suspend"
);
//大于30不合理,容错
if
(
$num
<
0
&&
$num
>
30
){
return
;
}
$site_arr
=
$this
->
siteModel
->
getSite
(
"id,name,city,is_del"
,
[
"is_del"
=>
0
]);
if
(
count
(
$site_arr
)
<=
0
)
{
return
;
}
$field
=
"count(1) as count,a.id"
;
$params
[
"a.status"
]
=
0
;
$params
[
"a.level"
]
=
10
;
$params
[
"a.level"
]
=
10
;
foreach
(
$site_arr
as
$item
)
{
$table_name
=
$this
->
table
.
$item
[
"id"
]
.
"_"
.
$this
->
date
;
$params
[
"a.site_id"
]
=
$item
[
"id"
];
$agent_arr
=
$this
->
agentsModel
->
selectFollowUpNumByAgent
(
$field
,
$table_name
,
$params
,
15
);
//execute_update
$this
->
execute_update
(
$agent_arr
);
$agent_arr
=
$this
->
agentsModel
->
selectFollowUpNumByAgent
(
$field
,
$table_name
,
$params
,
$num
);
if
(
count
(
$agent_arr
)
>
0
){
$this
->
execute_update
(
$agent_arr
);
}
}
}
private
function
execute_update
(
$agent_arr
){
dump
(
$agent_arr
);
$ids
=
""
;
foreach
(
$agent_arr
as
$item
)
{
$ids
.=
$item
[
"id"
]
.
","
;
}
$ids
=
rtrim
(
$ids
,
","
);
$this
->
agentsModel
->
saveStatus
(
"status"
,
"5"
,
$ids
);
}
...
...
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