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
4dfc4e19
Commit
4dfc4e19
authored
Mar 06, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单搜索
parent
f57b8d50
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
1 deletion
+98
-1
OrderLog.php
application/api_broker/controller/OrderLog.php
+22
-0
OrderLogService.php
application/api_broker/service/OrderLogService.php
+57
-0
ReportService.php
application/api_broker/service/ReportService.php
+1
-1
OrderModel.php
application/model/OrderModel.php
+17
-0
route.php
application/route.php
+1
-0
No files found.
application/api_broker/controller/OrderLog.php
View file @
4dfc4e19
...
@@ -256,6 +256,28 @@ class OrderLog extends Basic
...
@@ -256,6 +256,28 @@ class OrderLog extends Basic
}
else
{
}
else
{
return
$this
->
response
(
"101"
,
"request error"
);
return
$this
->
response
(
"101"
,
"request error"
);
}
}
}
public
function
searchOrder
(){
$params
=
$this
->
params
;
/* $params = array(
"type" => 3, //1.客户姓名 2.报备人电话 3.报备人姓名 4.商铺名称 5.商铺地址
"agent_id"=>1,
"search_keyword" => "123"
);*/
if
(
!
isset
(
$params
[
"type"
])
||
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"search_keyword"
])){
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
try
{
$result
=
$this
->
service_
->
getSearchOrder
(
$params
);
if
(
count
(
$result
)
>
0
){
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
else
{
return
$this
->
response
(
"200"
,
"request null"
);
}
}
catch
(
Exception
$e
){
return
$this
->
response
(
"101"
,
"request error,msg:"
.
$e
);
}
}
}
...
...
application/api_broker/service/OrderLogService.php
View file @
4dfc4e19
...
@@ -256,5 +256,61 @@ class OrderLogService
...
@@ -256,5 +256,61 @@ class OrderLogService
return
$result
;
return
$result
;
}
}
/**
* @param $params 1.客户姓名 2.报备人电话 3.报备人姓名 4.商铺名称 5.商铺地址
* @return array|false|\PDOStatement|string|\think\Collection
*/
public
function
getSearchOrder
(
$params
){
$condition
=
[];
$field
=
"a.id,a.order_no,a.f_id,a.house_id,a.house_title,b.report_agent_id,b.report_agent_phone,b.report_agent_name,
b.user_id,b.user_phone,b.user_name,b.predict_see_time"
;
switch
((
int
)
$params
[
"type"
]){
case
1
:
$condition
[
"b.user_name"
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'search_keyword'
])
.
"%"
);
break
;
case
2
:
$condition
[
"b.report_agent_phone"
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'search_keyword'
])
.
"%"
);
break
;
case
3
:
$condition
[
"b.report_agent_name"
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'search_keyword'
])
.
"%"
);
break
;
case
4
:
$condition
[
"b.house_title"
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'search_keyword'
])
.
"%"
);
break
;
case
5
:
// $condition["b.house_title"] = array( 'like', "%" . trim($params['search_keyword']) . "%" );
break
;
default
:
return
[
"code"
=>
"101"
,
"msg"
=>
"搜索类型错误"
];
}
if
(
isset
(
$params
[
"agent_id"
])){
$condition
[
"b.report_agent_id"
]
=
array
(
"eq"
,
$params
[
"agent_id"
]);
}
$orderModel
=
new
OrderModel
();
$result
=
$orderModel
->
searchOrder
(
$field
,
$condition
);
$ids_str
=
""
;
foreach
(
$result
as
$k
=>
$v
){
$result
[
$k
][
"user_phone"
]
=
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$v
[
"user_phone"
]);
$ids_str
.=
$v
[
"id"
]
.
","
;
}
$ids_str
=
rtrim
(
$ids_str
,
","
);
$reportService
=
new
ReportService
();
$sign_arr
=
$reportService
->
orderSign
(
$ids_str
);
foreach
(
$result
as
$k
=>
$v
){
foreach
(
$sign_arr
as
$value
){
if
(
$v
[
"id"
]
==
$value
[
"order_id"
]){
$result
[
$k
][
"sign"
]
.=
$reportService
->
signTitle
(
$value
[
"type"
])
.
","
;
}
}
}
return
$result
;
}
}
}
\ No newline at end of file
application/api_broker/service/ReportService.php
View file @
4dfc4e19
...
@@ -117,7 +117,7 @@ class ReportService
...
@@ -117,7 +117,7 @@ class ReportService
return
$this
->
orderModel
->
selectSign
(
$ids_str
);
return
$this
->
orderModel
->
selectSign
(
$ids_str
);
}
}
p
rivate
function
signTitle
(
$type
){
p
ublic
function
signTitle
(
$type
){
switch
(
$type
){
switch
(
$type
){
case
2
:
case
2
:
return
"进场"
;
return
"进场"
;
...
...
application/model/OrderModel.php
View file @
4dfc4e19
...
@@ -91,4 +91,20 @@ class OrderModel extends Model
...
@@ -91,4 +91,20 @@ class OrderModel extends Model
->
select
();
->
select
();
}
}
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
searchOrder
(
$field
,
$params
){
return
$this
->
db_
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"o_report b"
,
"a.f_id = b.id"
,
"left"
)
->
where
(
$params
)
->
select
();
}
}
}
\ No newline at end of file
application/route.php
View file @
4dfc4e19
...
@@ -272,6 +272,7 @@ Route::group('broker', [
...
@@ -272,6 +272,7 @@ Route::group('broker', [
'reportList'
=>
[
'api_broker/Report/reportList'
,
[
'method'
=>
'get'
]
],
'reportList'
=>
[
'api_broker/Report/reportList'
,
[
'method'
=>
'get'
]
],
'orderDetail'
=>
[
'api_broker/OrderLog/orderDetail'
,
[
'method'
=>
'get|post'
]
],
'orderDetail'
=>
[
'api_broker/OrderLog/orderDetail'
,
[
'method'
=>
'get|post'
]
],
'selectReportAll'
=>
[
'api_broker/OrderLog/selectReportAll'
,
[
'method'
=>
'get|post'
]
],
'selectReportAll'
=>
[
'api_broker/OrderLog/selectReportAll'
,
[
'method'
=>
'get|post'
]
],
'searchOrder'
=>
[
'api_broker/OrderLog/searchOrder'
,
[
'method'
=>
'get|post'
]
],
'token'
=>
[
'api_broker/broker/token'
,
[
'method'
=>
'get'
]
],
'token'
=>
[
'api_broker/broker/token'
,
[
'method'
=>
'get'
]
],
...
...
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