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
3d501c75
Commit
3d501c75
authored
Jan 10, 2019
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
name
parent
957725d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
12 deletions
+56
-12
route.php
application/route.php
+3
-2
FollowUpTask.php
application/task/controller/FollowUpTask.php
+53
-10
No files found.
application/route.php
View file @
3d501c75
...
...
@@ -555,8 +555,9 @@ Route::group('task', [
'updateLandlordLimit'
=>
[
'task/JobTask/updateLandlordLimit'
,
[
'method'
=>
'get'
]],
//转换房东手机号
'test'
=>
[
'task/FollowUpTask/test'
,
[
'method'
=>
'get'
]],
'isExistTable'
=>
[
'task/FollowUpTask/isExistTable'
,
[
'method'
=>
'get'
]],
'test'
=>
[
'task/FollowUpTask/test'
,
[
'method'
=>
'get'
]],
'isExistTable'
=>
[
'task/FollowUpTask/isExistTable'
,
[
'method'
=>
'get'
]],
'moveFollowUpList'
=>
[
'task/FollowUpTask/moveFollowUpList'
,
[
'method'
=>
'get'
]],
]);
Route
::
group
(
'broker'
,
[
...
...
application/task/controller/FollowUpTask.php
View file @
3d501c75
...
...
@@ -4,6 +4,7 @@ namespace app\task\controller;
use
app\extra\RedisExt
;
use
app\model\ASite
;
use
app\model\UPhoneFollowUp
;
use
app\model\UPhoneFollowUpTemporary
;
/**
...
...
@@ -17,15 +18,17 @@ class FollowUpTask
{
private
$redis_
;
private
$table
=
'u_phone_follow_up_'
;
private
$siteModel
;
public
function
__construct
()
{
$this
->
redis_
=
RedisExt
::
getRedis
();
$this
->
siteModel
=
new
ASite
();
}
public
function
test
()
{
$this
->
isExistTable
(
"2019-01-10"
,
10006
);
$this
->
isExistTable
(
"2019-01-10"
,
10006
);
}
/**
...
...
@@ -37,11 +40,8 @@ class FollowUpTask
*/
public
function
isExistTable
(
$time
,
$siteId
)
{
$siteModel
=
new
ASite
();
$site_field
=
'city'
;
$site_params
[
'id'
]
=
$siteId
;
$site_arr
=
$siteModel
->
findByOne
(
$site_field
,
$site_params
);
if
(
count
(
$site_arr
)
<=
0
){
$site_arr
=
$this
->
siteModel
->
findByOne
(
'city'
,
[
"id"
=>
$siteId
]);
if
(
count
(
$site_arr
)
<=
0
)
{
return
false
;
}
//todo 1.判断表是否存在,不存在则创建,
...
...
@@ -62,12 +62,17 @@ class FollowUpTask
return
true
;
//存在表
}
else
{
//创建表
return
$this
->
createTemp
(
$phoneFollowUpModel
,
$table_name
);
return
$this
->
createTemp
(
$phoneFollowUpModel
,
$table_name
);
}
}
}
public
function
createTemp
(
$db
,
$tableName
)
/**
* @param $db
* @param $tableName
* @return bool
*/
public
function
createTemp
(
$db
,
$tableName
)
{
if
(
!
$tableName
)
{
return
false
;
...
...
@@ -92,10 +97,47 @@ class FollowUpTask
KEY `idx_city` (`city`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8"
;
if
(
false
!==
$db
->
execute
(
$sql
))
{
if
(
false
!==
$db
->
execute
(
$sql
))
{
return
true
;
}
else
{
return
false
;
return
false
;
}
}
/**
* 每天0.30执行移动操作
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
public
function
moveFollowUpList
()
{
$site_arr
=
$this
->
siteModel
->
getSite
(
"id,name,city,is_del"
,
[
"is_del"
=>
0
]);
if
(
count
(
$site_arr
)
<=
0
)
{
return
;
}
$date
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
foreach
(
$site_arr
as
$item
)
{
$site_id
=
$item
[
"id"
];
//判断此站点是否执行过
if
(
$this
->
redis_
->
get
(
"is_run_"
.
$date
.
"_"
.
$site_id
)
>
0
)
{
continue
;
}
$table_name
=
$this
->
table
.
$site_id
.
"_"
.
$date
;
$phoneFollowUpModel
=
new
UPhoneFollowUpTemporary
(
$site_id
);
$isTable
=
$phoneFollowUpModel
->
query
(
'SHOW TABLES LIKE "'
.
$table_name
.
'"'
);
if
(
$isTable
)
{
$sql
=
"INSERT into u_phone_follow_up_"
.
$site_id
.
"
(content,labels_id,user_id,agent_id,province,city,disc,type,create_time,update_time,user_status )
select content,labels_id,user_id,agent_id,province,city,disc,type,create_time,update_time,user_status
from `"
.
$table_name
.
"`"
;
$followUpModel
=
new
UPhoneFollowUp
(
$site_id
);
if
(
false
!==
$followUpModel
->
execute
(
$sql
))
{
$this
->
redis_
->
set
(
"is_run_"
.
$date
.
"_"
.
$site_id
,
1
,
24
*
3600
);
}
}
}
}
}
\ No newline at end of file
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