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
473550dd
Commit
473550dd
authored
Aug 14, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商铺跟进优化
parent
ef7e9f6f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
19 deletions
+108
-19
HomePageLog.php
application/api_broker/controller/HomePageLog.php
+46
-18
AAgents.php
application/model/AAgents.php
+33
-0
GHouses.php
application/model/GHouses.php
+28
-0
GHousesFollowUp.php
application/model/GHousesFollowUp.php
+1
-1
No files found.
application/api_broker/controller/HomePageLog.php
View file @
473550dd
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
namespace
app\api_broker\controller
;
namespace
app\api_broker\controller
;
use
app\api_broker\extend\Basic
;
use
app\api_broker\extend\Basic
;
use
app\model\AAgents
;
use
app\model\GHouses
;
use
app\model\GHousesFollowUp
;
use
app\model\GHousesFollowUp
;
use
app\model\UPhoneFollowPp
;
use
app\model\UPhoneFollowPp
;
use
think\Request
;
use
think\Request
;
...
@@ -100,16 +102,16 @@ class HomePageLog extends Basic
...
@@ -100,16 +102,16 @@ class HomePageLog extends Basic
public
function
houseFollowUpList
()
public
function
houseFollowUpList
()
{
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
/* $params = array(
"start_time" => time(), //开始时间
/*$params = array(
"end_time" => time() . " 23:59:59", //结束时间
"start_time" => strtotime('2016-08-14 11:02:36'), //开始时间
"name_or_phone" => "li",//用户姓名或电话
"end_time" => strtotime('2018-08-14 11:07:10'), //结束时间
"search_content" => "111",// 搜索跟进内容
"name_or_phone" => "18112347151",//用户姓名或电话
"search_content" => "1",// 搜索跟进内容
"pageNo" => 1,
"pageNo" => 1,
"pageSize" => 15
"pageSize" => 15
);*/
);*/
if
(
empty
(
$params
[
'start_time'
])
||
empty
(
$params
[
'end_time'
]))
{
if
(
empty
(
$params
[
'start_time'
])
||
empty
(
$params
[
'end_time'
]))
{
return
$this
->
response
(
"101"
,
'请选择时间'
);
return
$this
->
response
(
"101"
,
'请选择时间'
);
}
}
...
@@ -119,37 +121,63 @@ class HomePageLog extends Basic
...
@@ -119,37 +121,63 @@ class HomePageLog extends Basic
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$field
=
"f.id,f.house_id,f.agent_id,f.follow_up_info,f.create_time,
a.name,a.img,b.store_name,c.internal_titl
e"
;
$field
=
"f.id,f.house_id,f.agent_id,f.follow_up_info,f.create_time,
f.agent_name as nam
e"
;
if
(
!
empty
(
$params
[
"search_content"
]))
{
if
(
!
empty
(
$params
[
"search_content"
]))
{
$where_
[
"f.follow_up_info"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'search_content'
])
.
"%"
);
$where_
[
"f.follow_up_info"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'search_content'
])
.
"%"
);
}
}
if
(
!
empty
(
$params
[
"start_time"
])
&&
!
empty
(
$params
[
"end_time"
]))
{
if
(
!
empty
(
$params
[
"start_time"
])
&&
!
empty
(
$params
[
"end_time"
]))
{
$start_time
=
date
(
"Y-m-d H:i:s"
,
$params
[
"start_time"
]);
$start_time
=
date
(
"Y-m-d H:i:s"
,
$params
[
"start_time"
]);
$end_time
=
date
(
"Y-m-d H:i:s"
,
$params
[
"end_time"
]);
$end_time
=
date
(
"Y-m-d H:i:s"
,
$params
[
"end_time"
]);
$where_
[
"f.create_time"
]
=
array
(
'between'
,
array
(
$start_time
,
$end_time
)
);
$where_
[
"f.create_time"
]
=
array
(
'between'
,
array
(
$start_time
,
$end_time
)
);
}
}
if
(
!
empty
(
$params
[
"name_or_phone"
]))
{
$where_
[
"a.phone|a.name"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
"name_or_phone"
])
.
"%"
);
}
if
(
empty
(
$params
[
'city'
]))
{
if
(
empty
(
$params
[
'city'
]))
{
$where_
[
"
c.city"
]
=
trim
(
$this
->
city
)
;
$where_
[
"
f.city"
]
=
trim
(
$this
->
city
)
?
trim
(
$this
->
city
)
:
'上海市'
;
}
else
{
}
else
{
$where_
[
"
c.city"
]
=
$params
[
'city'
]
;
$where_
[
"
f.city"
]
=
$params
[
'city'
]
?
$params
[
'city'
]
:
'上海市'
;
}
}
if
(
!
empty
(
$params
[
'disc'
]))
{
if
(
!
empty
(
$params
[
'disc'
]))
{
$where_
[
"
c
.disc"
]
=
$params
[
'disc'
];
$where_
[
"
f
.disc"
]
=
$params
[
'disc'
];
}
}
$join
=
[
if
(
!
empty
(
$params
[
"name_or_phone"
]))
{
[
'a_agents a'
,
'a.id=f.agent_id'
,
'left'
],
if
(
!
preg_match
(
"/^1\d
{
10
}
$/"
,
$params
[
'name_or_phone'
])
and
(
strlen
(
$params
[
'name_or_phone'
])
<
6
)){
[
'a_store b'
,
'b.id=a.store_id'
,
'left'
],
return
$this
->
response
(
"300"
,
'手机号有误或者姓名不满两位汉字'
);
[
'g_houses c'
,
'f.house_id=c.id'
,
'left'
]
}
];
//$agent_params["phone|name"] = array( "like", "%" . trim($params["name_or_phone"]) . "%" );
$agent_params
[
"phone|name"
]
=
$params
[
"name_or_phone"
];
$agent_field
=
"id"
;
$model
=
new
AAgents
();
$res_a
=
$model
->
getAgentsIdsArray
(
$agent_field
,
$agent_params
);
if
(
$res_a
){
$where_
[
"f.agent_id"
]
=
[
'in'
,
$res_a
];
}
}
$join
=
[];
$order
=
"f.id desc"
;
$order
=
"f.id desc"
;
$result
=
$this
->
gHouseFollowUpModel
->
getSearch
(
$pageNo
,
$pageSize
,
$order
,
$field
,
$join
,
$where_
,
""
);
$result
=
$this
->
gHouseFollowUpModel
->
getSearch
(
$pageNo
,
$pageSize
,
$order
,
$field
,
$join
,
$where_
,
""
);
foreach
(
$result
as
$key
=>
$value
)
{
$agent_params
=
[];
$agent_params
[
"a.id"
]
=
$value
[
'agent_id'
];
$agent_field
=
"a.name,a.img,b.store_name"
;
$model
=
new
AAgents
();
$res_a
=
$model
->
getAgentsInfo
(
$agent_field
,
$agent_params
);
$result
[
$key
][
'name'
]
=
$res_a
[
0
][
'name'
];
$result
[
$key
][
'img'
]
=
$res_a
[
0
][
'img'
];
$result
[
$key
][
'store_name'
]
=
$res_a
[
0
][
'store_name'
];
$house_params
=
[];
$house_params
[
"id"
]
=
$value
[
'house_id'
];
$house_field
=
"internal_title"
;
$model
=
new
GHouses
();
$res_a
=
$model
->
getHouseInfo
(
$house_field
,
$house_params
);
$result
[
$key
][
'internal_title'
]
=
$res_a
[
0
][
'internal_title'
];
}
$count
=
$this
->
gHouseFollowUpModel
->
getSearchCount
(
$join
,
$where_
);
$count
=
$this
->
gHouseFollowUpModel
->
getSearchCount
(
$join
,
$where_
);
if
(
count
(
$result
)
>
0
)
{
if
(
count
(
$result
)
>
0
)
{
$list
[
"result"
]
=
$result
;
$list
[
"result"
]
=
$result
;
...
...
application/model/AAgents.php
View file @
473550dd
...
@@ -985,4 +985,36 @@ class AAgents extends BaseModel
...
@@ -985,4 +985,36 @@ class AAgents extends BaseModel
//dump($this->getLastSql());
//dump($this->getLastSql());
return
$result
;
return
$result
;
}
}
public
function
getAgentsIdsArray
(
$field
,
$params
)
{
$params
[
"status"
]
=
0
;
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$params
)
->
select
();
if
(
$result
){
$agentIds
=
""
;
foreach
(
$result
as
$key1
=>
$value1
)
{
$agentIds
.=
$value1
[
"id"
]
.
','
;
}
$agentIds
=
rtrim
(
$agentIds
,
","
);
//经纪人ID集合
}
return
$agentIds
;
}
public
function
getAgentsInfo
(
$field
,
$params
)
{
$params
[
"a.status"
]
=
0
;
$result
=
Db
::
table
(
$this
->
table
)
->
alias
(
'a'
)
->
join
(
'a_store b'
,
'b.id=a.store_id'
,
'left'
)
->
field
(
$field
)
->
where
(
$params
)
->
select
();
return
$result
;
}
}
}
\ No newline at end of file
application/model/GHouses.php
View file @
473550dd
...
@@ -1339,4 +1339,32 @@ class GHouses extends BaseModel
...
@@ -1339,4 +1339,32 @@ class GHouses extends BaseModel
return
$result
;
return
$result
;
}
}
public
function
getHouseIdsArray
(
$field
,
$params
)
{
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$params
)
->
select
();
if
(
$result
){
$houseids
=
""
;
foreach
(
$result
as
$key1
=>
$value1
)
{
$houseids
.=
$value1
[
"id"
]
.
','
;
}
$houseids
=
rtrim
(
$houseids
,
","
);
//经纪人ID集合
}
return
$houseids
;
}
public
function
getHouseInfo
(
$field
,
$params
)
{
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$params
)
->
select
();
return
$result
;
}
}
}
application/model/GHousesFollowUp.php
View file @
473550dd
...
@@ -106,7 +106,7 @@ class GHousesFollowUp extends Model
...
@@ -106,7 +106,7 @@ class GHousesFollowUp extends Model
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
->
page
(
$p
)
->
page
(
$p
)
->
select
();
->
select
();
//
echo $this->getLastSql();
//
echo $this->getLastSql();
return
$data
;
return
$data
;
}
}
...
...
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