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
9dfb6502
Commit
9dfb6502
authored
Mar 27, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
bc837e32
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
304 additions
and
152 deletions
+304
-152
OrderLog.php
application/api_broker/controller/OrderLog.php
+47
-46
Report.php
application/api_broker/controller/Report.php
+17
-18
OrderLogService.php
application/api_broker/service/OrderLogService.php
+33
-8
PerformanceService.php
application/api_broker/service/PerformanceService.php
+1
-1
ReportService.php
application/api_broker/service/ReportService.php
+18
-8
OReportModel.php
application/model/OReportModel.php
+156
-68
OrderModel.php
application/model/OrderModel.php
+32
-3
No files found.
application/api_broker/controller/OrderLog.php
View file @
9dfb6502
...
...
@@ -62,21 +62,21 @@ class OrderLog extends Basic
$is_ok
=
$this
->
o_march_in_model
->
addMarchIn
(
$params
);
$is_ok
=
1
;
$is_ok
=
1
;
if
(
$is_ok
>
0
)
{
$ge_tui
=
new
GeTuiUntils
();
$report
=
new
OReportModel
();
$field
=
'house_title,user_name'
;
$report_data
=
$report
->
getReportOrder
(
$field
,
[
'a.id'
=>
$params
[
"report_id"
]
]);
$agent
=
new
AAgents
();
$agent_data
=
$agent
->
getAgentInfo
(
'device_id,store_id'
,
$params
[
'reception_id'
]);
$content
=
"客户
{
$report_data
[
'user_name'
]
}
进场【
{
$report_data
[
'house_title'
]
}
】商铺"
;
$ge_tui
=
new
GeTuiUntils
();
$report
=
new
OReportModel
();
$field
=
'house_title,user_name'
;
$report_data
=
$report
->
getReportOrder
(
$field
,
[
'a.id'
=>
$params
[
"report_id"
]
]);
$agent
=
new
AAgents
();
$agent_data
=
$agent
->
getAgentInfo
(
'device_id,store_id'
,
$params
[
'reception_id'
]);
$content
=
"客户
{
$report_data
[
'user_name'
]
}
进场【
{
$report_data
[
'house_title'
]
}
】商铺"
;
$where
[
'store_id'
]
=
$agent_data
[
'store_id'
];
$where
[
'level'
]
=
20
;
$agent_store
=
$agent
->
getAgentInfo
(
'id,device_id'
,
''
,
$where
);
$ge_tui
->
public_push_message_for_one
(
$params
[
'reception_id'
],
$agent_data
[
'device_id'
],
'进场'
,
$content
);
$ge_tui
->
public_push_message_for_one
(
$agent_store
[
'reception_id'
],
$agent_store
[
'device_id'
],
'进场'
,
$content
);
$where
[
'level'
]
=
20
;
$agent_store
=
$agent
->
getAgentInfo
(
'id,device_id'
,
''
,
$where
);
$ge_tui
->
public_push_message_for_one
(
$params
[
'reception_id'
],
$agent_data
[
'device_id'
],
'进场'
,
$content
);
$ge_tui
->
public_push_message_for_one
(
$agent_store
[
'reception_id'
],
$agent_store
[
'device_id'
],
'进场'
,
$content
);
return
$this
->
response
(
"200"
,
"request success"
,
[]);
}
else
{
...
...
@@ -287,11 +287,11 @@ class OrderLog extends Basic
public
function
searchOrder
()
{
$params
=
$this
->
params
;
/* $params = array(
"type" => 0, //0.客户电话 1.客户姓名 2.报备人电话 3.报备人姓名 4.商铺名称 5.商铺地址
"agent_id"=>630,
"search_keyword" => "14444
"
);*/
/*
$params = array(
"type" => 0, //0.客户电话 1.客户姓名 2.报备人电话 3.报备人姓名 4.商铺名称 5.商铺地址
"agent_id"=>630,
"search_keyword" => "1
"
);*/
if
(
!
isset
(
$params
[
"type"
])
||
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"search_keyword"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
...
...
@@ -314,12 +314,12 @@ class OrderLog extends Basic
public
function
bargainList
()
{
$params
=
$this
->
params
;
/* $params = array(
"submit_agent_id" => 1,
"status" => 10,
"page_no" => 1,
"page_size" => 15
);*/
/* $params = array(
"submit_agent_id" => 1,
"status" => 10,
"page_no" => 1,
"page_size" => 15
);*/
if
(
!
isset
(
$params
[
"submit_agent_id"
])
||
!
isset
(
$params
[
"status"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
...
...
@@ -376,12 +376,12 @@ class OrderLog extends Basic
public
function
searchAgents
()
{
$params
=
$this
->
params
;
/* $params = array(
"submit_agent_id" => 1,
"keyword" => "157",
"page_no" => 1,
"page_size" => 15
);*/
/* $params = array(
"submit_agent_id" => 1,
"keyword" => "157",
"page_no" => 1,
"page_size" => 15
);*/
if
(
!
isset
(
$params
[
"submit_agent_id"
])
||
!
isset
(
$params
[
"keyword"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
...
...
@@ -406,7 +406,8 @@ class OrderLog extends Basic
* @return \think\Response
* @throws \think\exception\DbException
*/
public
function
addBargain
()
{
public
function
addBargain
()
{
$data
[
'code'
]
=
200
;
$data
[
'msg'
]
=
""
;
$data
[
'data'
]
=
[];
...
...
@@ -415,27 +416,27 @@ class OrderLog extends Basic
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'Id is null.'
;
}
else
{
$bargain
=
new
OBargainModel
();
$bargain
=
new
OBargainModel
();
$bargain_data
=
$bargain
->
get
(
$this
->
params
[
'id'
]);
if
(
empty
(
$bargain_data
))
{
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'Don\'t have info.'
;
}
else
{
$insert_data
[
'report_id'
]
=
$bargain_data
[
'report_id'
];
$insert_data
[
'agent_id'
]
=
$bargain_data
[
'agent_id'
];
$insert_data
[
'order_id'
]
=
$bargain_data
[
'order_id'
];
$insert_data
[
'order_no'
]
=
$bargain_data
[
'order_no'
];
$insert_data
[
'trade_type'
]
=
$bargain_data
[
'trade_type'
];
$insert_data
[
'report_id'
]
=
$bargain_data
[
'report_id'
];
$insert_data
[
'agent_id'
]
=
$bargain_data
[
'agent_id'
];
$insert_data
[
'order_id'
]
=
$bargain_data
[
'order_id'
];
$insert_data
[
'order_no'
]
=
$bargain_data
[
'order_no'
];
$insert_data
[
'trade_type'
]
=
$bargain_data
[
'trade_type'
];
$insert_data
[
'submit_agent_id'
]
=
$bargain_data
[
'submit_agent_id'
];
$insert_data
[
'price'
]
=
$bargain_data
[
'price'
];
$insert_data
[
'commission'
]
=
$bargain_data
[
'commission'
];
$insert_data
[
'status'
]
=
$bargain_data
[
'status'
];
$insert_data
[
'source'
]
=
1
;
$insert_data
[
'role'
]
=
empty
(
$this
->
params
[
'role'
])
?
0
:
$this
->
params
[
'role'
];
$insert_data
[
'scale_fee'
]
=
empty
(
$this
->
params
[
'scale_fee'
])
?
0
:
$this
->
params
[
'scale_fee'
];
$insert_data
[
'practical_fee'
]
=
empty
(
$this
->
params
[
'practical_fee'
])
?
0
:
$this
->
params
[
'practical_fee'
];
$insert_data
[
'father_id'
]
=
empty
(
$this
->
params
[
'id'
])
?
0
:
$this
->
params
[
'id'
];
$insert_data
[
'scale'
]
=
empty
(
$this
->
params
[
'scale'
])
?
0
:
$this
->
params
[
'scale'
];
$insert_data
[
'price'
]
=
$bargain_data
[
'price'
];
$insert_data
[
'commission'
]
=
$bargain_data
[
'commission'
];
$insert_data
[
'status'
]
=
$bargain_data
[
'status'
];
$insert_data
[
'source'
]
=
1
;
$insert_data
[
'role'
]
=
empty
(
$this
->
params
[
'role'
])
?
0
:
$this
->
params
[
'role'
];
$insert_data
[
'scale_fee'
]
=
empty
(
$this
->
params
[
'scale_fee'
])
?
0
:
$this
->
params
[
'scale_fee'
];
$insert_data
[
'practical_fee'
]
=
empty
(
$this
->
params
[
'practical_fee'
])
?
0
:
$this
->
params
[
'practical_fee'
];
$insert_data
[
'father_id'
]
=
empty
(
$this
->
params
[
'id'
])
?
0
:
$this
->
params
[
'id'
];
$insert_data
[
'scale'
]
=
empty
(
$this
->
params
[
'scale'
])
?
0
:
$this
->
params
[
'scale'
];
$data
[
'data'
][
'id'
]
=
$bargain
->
insertBargain
(
$insert_data
);
if
(
$data
[
'data'
]
==
0
)
{
...
...
application/api_broker/controller/Report.php
View file @
9dfb6502
...
...
@@ -21,7 +21,6 @@ class Report extends Basic
private
$fulModel
;
public
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
...
...
@@ -82,35 +81,35 @@ class Report extends Basic
* 获取报备列表
* @return \think\Response
*/
public
function
reportList
(){
/* $params = array(
"agent_id" =>1,
"type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告
"page_no"=>1,
"page_size"=>15
);*/
public
function
reportList
()
{
/* $params = array(
"agent_id" =>1,
"type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告
"page_no"=>1,
"page_size"=>15
);*/
$params
=
$this
->
params
;
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"type"
]))
{
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"type"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$pageNo
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$pageSize
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$field
=
"a.id,a.user_id,a.user_phone,a.user_name,a.predict_see_time,b.id as order_id,b.order_no,b.house_id,b.house_title"
;
$field
=
"a.id,a.user_id,a.user_phone,a.user_name,a.predict_see_time,b.id as order_id,b.order_no,b.house_id,b.house_title"
;
$params
[
"report_agent_id"
]
=
$params
[
"agent_id"
];
$result
=
$this
->
service_
->
orderList
(
$field
,
$params
,
$pageNo
,
$pageSize
);
$result
=
$this
->
service_
->
orderList
(
$field
,
$params
,
$pageNo
,
$pageSize
);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
/**
* 新增跟进
* @return \think\Response
...
...
@@ -155,10 +154,10 @@ class Report extends Basic
*/
public
function
getFollowUpList
()
{
/* $params = array(
"report_id" => 1,// 报备id
"agent_id" => 1,//非必填 经纪人id 没有就获取最新一条跟进记录
);*/
/* $params = array(
"report_id" => 1,// 报备id
"agent_id" => 1,//非必填 经纪人id 没有就获取最新一条跟进记录
);*/
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
if
(
!
isset
(
$params
[
"report_id"
]))
{
...
...
@@ -182,7 +181,7 @@ class Report extends Basic
return
$this
->
response
(
"300"
,
"not fund list"
,
[]);
}
}
catch
(
Exception
$e
)
{
return
$this
->
response
(
"101"
,
"request error:"
.
$e
);
return
$this
->
response
(
"101"
,
"request error:"
.
$e
);
}
...
...
application/api_broker/service/OrderLogService.php
View file @
9dfb6502
...
...
@@ -283,24 +283,29 @@ class OrderLogService
*/
public
function
getSearchOrder
(
$params
)
{
$condition
=
[]
;
$condition
=
$where_
=
"1=1 "
;
$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
0
:
$condition
[
"b.user_phone"
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'search_keyword'
])
.
"%"
);
// $condition["b.user_phone"] = array( 'like', "%" . trim($params['search_keyword']) . "%" );
$condition
.=
"and b.user_phone like '%"
.
trim
(
$params
[
'search_keyword'
])
.
"%' "
;
break
;
case
1
:
$condition
[
"b.user_name"
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'search_keyword'
])
.
"%"
);
// $condition["b.user_name"] = array( 'like', "%" . trim($params['search_keyword']) . "%" );
$condition
.=
"and b.user_name like '%"
.
trim
(
$params
[
'search_keyword'
])
.
"%' "
;
break
;
case
2
:
$condition
[
"b.report_agent_phone"
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'search_keyword'
])
.
"%"
);
//$condition["b.report_agent_phone"] = array( 'like', "%" . trim($params['search_keyword']) . "%" );
$condition
.=
"and b.report_agent_phone like '%"
.
trim
(
$params
[
'search_keyword'
])
.
"%' "
;
break
;
case
3
:
$condition
[
"b.report_agent_name"
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'search_keyword'
])
.
"%"
);
//$condition["b.report_agent_name"] = array( 'like', "%" . trim($params['search_keyword']) . "%" );
$condition
.=
"and b.report_agent_name like '%"
.
trim
(
$params
[
'search_keyword'
])
.
"%' "
;
break
;
case
4
:
$condition
[
"b.house_title"
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'search_keyword'
])
.
"%"
);
//$condition["b.house_title"] = array( 'like', "%" . trim($params['search_keyword']) . "%" );
$condition
.=
"and b.house_title like '%"
.
trim
(
$params
[
'search_keyword'
])
.
"%' "
;
break
;
case
5
:
//todo 列表没有显示商铺地址 和产品沟通暂时搁置
...
...
@@ -309,13 +314,33 @@ class OrderLogService
default
:
return
[
"code"
=>
"101"
,
"msg"
=>
"搜索类型错误"
];
}
if
(
isset
(
$params
[
"agent_id"
]))
{
/*
if (isset($params["agent_id"])) {
$condition["b.report_agent_id"] = array( "eq", $params["agent_id"] );
}*/
$vModel
=
new
VerifyService
();
$agentArr
=
$vModel
->
getAgentsByAgentId
(
$params
[
"report_agent_id"
]);
if
(
$agentArr
)
{
//$params["report_agent_id"] = $agentArr;
$condition
.=
"and b.report_agent_id in ("
.
trim
(
$agentArr
)
.
") "
;
}
$caseHouseId
=
$vModel
->
getCaseHouseIdByAgentId
(
$params
[
"report_agent_id"
]);
$ids
=
""
;
foreach
(
$caseHouseId
as
$item
)
{
$ids
.=
$item
[
"houses_id"
]
.
","
;
}
$ids
=
rtrim
(
$ids
,
","
);
$ids
=
$ids
?
$ids
:
0
;
//$params["house_ids"] = $ids;
$where_
.=
"and a.house_id in (
$ids
)"
;
$orderModel
=
new
OrderModel
();
$result
=
$orderModel
->
searchOrder
(
$field
,
$condition
);
$result
=
$orderModel
->
searchOrder
(
$field
,
$condition
,
$where_
);
$ids_str
=
""
;
if
(
count
(
$result
)
<=
0
)
{
...
...
application/api_broker/service/PerformanceService.php
View file @
9dfb6502
...
...
@@ -245,7 +245,7 @@ class PerformanceService
}
p
rivate
function
getOrderList
(
$params
,
$type
)
p
ublic
function
getOrderList
(
$params
,
$type
)
{
$result
=
[];
//1带看 2进场 3收款 4成交报告
...
...
application/api_broker/service/ReportService.php
View file @
9dfb6502
...
...
@@ -77,15 +77,15 @@ class ReportService
if
(
$id
>
0
)
{
$house_arr
=
explode
(
","
,
$house_ids
);
$order_arr
=
[];
$agent
=
new
GHousesToAgents
();
$ge_tui
=
new
GeTuiUntils
();
$agent
=
new
GHousesToAgents
();
$ge_tui
=
new
GeTuiUntils
();
foreach
(
$house_arr
as
$k
=>
$v
)
{
//todo 批量插入到数据库
$order_no
=
$this
->
createOrderNumber
();
array_push
(
$order_arr
,
$this
->
orderBin
(
$order_no
,
$id
,
$v
));
$device_id
=
$agent
->
getAgentList
(
$v
);
foreach
(
$device_id
as
$k
=>
$v
)
{
foreach
(
$device_id
as
$k
=>
$v
)
{
$content
=
"【
{
$v
[
'store_name'
]
}
】店【
{
$agent_name
}
】约带看【
{
$order_arr
[
'house_title'
]
}
】商铺"
;
$ge_tui
->
public_push_message_for_one
(
$v
[
'id'
],
$v
[
'device_id'
],
'报备'
,
$content
);
}
...
...
@@ -110,16 +110,25 @@ class ReportService
//todo 获取我报备的我的案场的,如果是店长则获取其下所有的经纪人
$vModel
=
new
VerifyService
();
$agentArr
=
$vModel
->
getAgentsByAgentId
(
$params
[
"report_agent_id"
]);
dump
(
$agentArr
);
if
(
$agentArr
)
{
$params
[
"report_agent_id"
]
=
array
(
"in"
,
$agentArr
)
;
$params
[
"report_agent_id"
]
=
$agentArr
;
}
$result
=
$this
->
oReportModel
->
selectReportList
(
$field
,
$params
,
$pageNo
,
$pageSize
);
$caseHouseId
=
$vModel
->
getCaseHouseIdByAgentId
(
$params
[
"report_agent_id"
]);
$ids
=
""
;
foreach
(
$caseHouseId
as
$item
)
{
$ids
.=
$item
[
"houses_id"
]
.
","
;
}
$ids
=
rtrim
(
$ids
,
","
);
$ids
=
$ids
?
$ids
:
0
;
$params
[
"house_ids"
]
=
$ids
;
$result
=
$this
->
oReportModel
->
selectReportList
(
$field
,
$params
,
$pageNo
,
$pageSize
);
$ids_str
=
""
;
if
(
count
(
$result
)
>
0
)
{
foreach
(
$result
as
$k
=>
$v
)
{
$result
[
$k
][
"user_phone"
]
=
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$v
[
"user_phone"
]);
//$result[$k]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $v["user_phone"]);
$ids_str
.=
$v
[
"order_id"
]
.
","
;
}
...
...
@@ -141,6 +150,7 @@ class ReportService
return
null
;
}
public
function
orderSign
(
$ids_str
)
{
...
...
application/model/OReportModel.php
View file @
9dfb6502
...
...
@@ -80,72 +80,156 @@ class OReportModel extends Model
* @param $pageSize
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
selectReportList
(
$filed
=
"id"
,
$params
,
$pageNo
,
$pageSize
){
$where_
=
[];
public
function
selectReportList
(
$filed
=
"id"
,
$params
,
$pageNo
,
$pageSize
)
{
$start_index
=
(
$pageNo
-
1
)
*
$pageSize
;
if
(
isset
(
$params
[
"report_agent_id"
]))
{
$where_
[
"a.report_agent_id"
]
=
$params
[
"report_agent_id"
];
$report_agent_id
=
$params
[
"report_agent_id"
];
}
if
(
isset
(
$params
[
"house_ids"
]))
{
$house_ids
=
$params
[
"house_ids"
];
}
$where_
[
"a.status"
]
=
0
;
$where_
[
"b.is_del"
]
=
0
;
switch
(
$params
[
"type"
]){
switch
(
$params
[
"type"
])
{
case
2
:
return
$this
->
db
->
field
(
$filed
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.id= b.f_id"
,
"left"
)
->
join
(
"o_march_in c"
,
"b.id= c.order_id"
,
"right"
)
->
where
(
$where_
)
->
group
(
"c.order_id "
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
$sql
=
"SELECT * FROM
(( SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_march_in` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`a`.`report_agent_id` IN (
$report_agent_id
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
`c`.`order_id`
)UNION(
SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_march_in` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`a`.`report_agent_id` IN (
$house_ids
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
`c`.`order_id`
) ) AS aaa LIMIT
$start_index
,
$pageSize
"
;
$result
=
$this
->
db
->
query
(
$sql
);
return
$result
;
case
3
:
return
$this
->
db
->
field
(
$filed
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.id= b.f_id"
,
"left"
)
->
join
(
"o_paylog c"
,
"b.id= c.order_id"
,
"right"
)
->
where
(
$where_
)
->
group
(
"c.order_id "
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
$sql
=
"SELECT * FROM
(
(
SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_paylog` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`a`.`report_agent_id` IN (
$report_agent_id
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
`c`.`order_id`
)
UNION
(
SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_paylog` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`a`.`report_agent_id` IN (
$house_ids
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
`c`.`order_id`
)
) AS aaa LIMIT
$start_index
,
$pageSize
"
;
$result
=
$this
->
db
->
query
(
$sql
);
return
$result
;
case
4
:
return
$this
->
db
->
field
(
$filed
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.id= b.f_id"
,
"left"
)
->
join
(
"o_bargain c"
,
"b.id= c.order_id"
,
"right"
)
->
where
(
$where_
)
->
group
(
"c.order_id "
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
$sql
=
"SELECT * FROM
((
SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_bargain` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`a`.`report_agent_id` IN (
$report_agent_id
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
`c`.`order_id`
)
UNION
(
SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_bargain` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`a`.`report_agent_id` IN (
$house_ids
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
`c`.`order_id`
)
) AS aaa limit
$start_index
,
$pageSize
"
;
$result
=
$this
->
db
->
query
(
$sql
);
return
$result
;
default
:
$result
=
$this
->
db
->
field
(
$filed
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.id= b.f_id"
,
"left"
)
->
where
(
$where_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
//echo $this->db->getLastSql();
$sql
=
"SELECT * FROM
((SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
WHERE
`a`.`report_agent_id` IN (
$report_agent_id
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0)
UNION
(SELECT
$filed
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
WHERE
`b`.`house_id` IN (
$house_ids
)
AND `a`.`status` = 0
AND `b`.`is_del` = 0
) ) as aaa limit
$start_index
,
$pageSize
"
;
$result
=
$this
->
db
->
query
(
$sql
);
return
$result
;
}
}
public
function
getAddReportNumGroupTime
(
$params
){
$field
=
"count(1) as num,DATE(create_time) as day"
;
public
function
getAddReportNumGroupTime
(
$params
)
{
$field
=
"count(1) as num,DATE(create_time) as day"
;
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"report_agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
}
$where_
[
"status"
]
=
0
;
...
...
@@ -156,45 +240,48 @@ class OReportModel extends Model
->
select
();
}
public
function
getAddReportNum
(
$params
){
$field
=
"count(1) as num"
;
public
function
getAddReportNum
(
$params
)
{
$field
=
"count(1) as num"
;
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"a.report_agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"a.create_time"
]
=
$params
[
"create_time"
];
}
if
(
isset
(
$params
[
"house_ids"
]))
{
$where_
[
"b.house_id"
]
=
array
(
"in"
,
$params
[
"house_ids"
]
);
if
(
isset
(
$params
[
"house_ids"
]))
{
$where_
[
"b.house_id"
]
=
array
(
"in"
,
$params
[
"house_ids"
]
);
}
$where_
[
"a.status"
]
=
0
;
$result
=
Db
::
table
(
$this
->
table
)
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.id = b.f_id"
,
"left"
)
->
join
(
"o_order b"
,
"a.id = b.f_id"
,
"left"
)
->
where
(
$where_
)
->
select
();
//echo Db::table($this->table)->getLastSql();
return
$result
;
}
public
function
getAddReportOrderList
(
$field
,
$params
){
public
function
getAddReportOrderList
(
$field
,
$params
)
{
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"a.report_agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"a.create_time"
]
=
$params
[
"create_time"
];
}
if
(
isset
(
$params
[
"house_ids"
]))
{
$where_
[
"b.house_id"
]
=
array
(
"in"
,
$params
[
"house_ids"
]
);
if
(
isset
(
$params
[
"house_ids"
]))
{
$where_
[
"b.house_id"
]
=
array
(
"in"
,
$params
[
"house_ids"
]
);
}
$where_
[
"a.status"
]
=
0
;
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.id = b.f_id"
,
"left"
)
->
join
(
'g_houses d'
,
'b.house_id = d.id'
,
'left'
)
->
join
(
"o_order b"
,
"a.id = b.f_id"
,
"left"
)
->
join
(
'g_houses d'
,
'b.house_id = d.id'
,
'left'
)
->
where
(
$where_
)
->
select
();
}
...
...
@@ -209,10 +296,11 @@ class OReportModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getReportOrder
(
$field
,
$where
)
{
public
function
getReportOrder
(
$field
,
$where
)
{
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'o_order b'
,
'b.f_id=a.id'
,
'left'
)
->
join
(
'o_order b'
,
'b.f_id=a.id'
,
'left'
)
->
where
(
$where
)
->
find
();
}
...
...
application/model/OrderModel.php
View file @
9dfb6502
...
...
@@ -98,13 +98,42 @@ class OrderModel extends Model
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
searchOrder
(
$field
,
$params
){
return
$this
->
db_
public
function
searchOrder
(
$field
,
$params
,
$where_
){
/* $result = $this->db_
->field($field)
->alias("a")
->join("o_report b","a.f_id = b.id","left")
->union('SELECT '.$field.' FROM o_order a left join o_report b on a.f_id = b.id where '.$params)
->where($params)
->
select
();
->select();*/
$sql
=
"SELECT * FROM
(
(
SELECT
$field
FROM
`o_order` `a`
LEFT JOIN `o_report` `b` ON `a`.`f_id` = `b`.`id`
WHERE
$params
)
UNION
(
SELECT
$field
FROM
`o_order` `a`
LEFT JOIN `o_report` `b` ON `a`.`f_id` = `b`.`id`
WHERE
$where_
)
) AS aaa"
;
$result
=
$this
->
db_
->
query
(
$sql
);
// echo $this->db_->getLastSql();
return
$result
;
}
...
...
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