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
d1a07866
Commit
d1a07866
authored
Oct 31, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
报备增加搜索条件
parent
83527f24
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
251 additions
and
241 deletions
+251
-241
OrderLog.php
application/api_broker/controller/OrderLog.php
+1
-1
OrderLogService.php
application/api_broker/service/OrderLogService.php
+245
-239
OrderModel.php
application/model/OrderModel.php
+5
-1
No files found.
application/api_broker/controller/OrderLog.php
View file @
d1a07866
...
@@ -453,7 +453,7 @@ class OrderLog extends Basic
...
@@ -453,7 +453,7 @@ class OrderLog extends Basic
{
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
/* $params = array(
/* $params = array(
"type" => 1, //0.客户电话 1.客户姓名
2.报备人电话 3.报备人姓名 4.商铺名称 5.商铺地址
"type" => 1, //0.客户电话 1.客户姓名
,去掉 2.报备人电话 3.报备人姓名 4.商铺名称 5.商铺地址 6客户编号 7商铺编号
"agent_id" => 4022,
"agent_id" => 4022,
"search_keyword" => "程"
"search_keyword" => "程"
);*/
);*/
...
...
application/api_broker/service/OrderLogService.php
View file @
d1a07866
...
@@ -38,7 +38,7 @@ class OrderLogService
...
@@ -38,7 +38,7 @@ class OrderLogService
function
__construct
()
function
__construct
()
{
{
$this
->
payLogModel
=
new
OPayLogModel
();
$this
->
payLogModel
=
new
OPayLogModel
();
$this
->
bargainModel
=
new
OBargainModel
();
$this
->
bargainModel
=
new
OBargainModel
();
}
}
...
@@ -61,19 +61,19 @@ class OrderLogService
...
@@ -61,19 +61,19 @@ class OrderLogService
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
addCollectingBillV2
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$collecting_bill
,
$house_number
,
public
function
addCollectingBillV2
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$collecting_bill
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
,
$source
,
$income_time
)
$industry_type
,
$remark
,
$transfer_img
,
$source
,
$income_time
)
{
{
$bill_arr
=
$params
=
[];
$bill_arr
=
$params
=
[];
$father_id
=
0
;
$father_id
=
0
;
foreach
(
$collecting_bill
as
$collecting
)
{
foreach
(
$collecting_bill
as
$collecting
)
{
if
(
isset
(
$collecting
[
"type"
])
&&
isset
(
$collecting
[
"pay_type"
])
&&
isset
(
$collecting
[
"money"
]))
{
if
(
isset
(
$collecting
[
"type"
])
&&
isset
(
$collecting
[
"pay_type"
])
&&
isset
(
$collecting
[
"money"
]))
{
if
(
$father_id
==
0
)
{
if
(
$father_id
==
0
)
{
$params
=
$this
->
collectingBillBin
(
$father_id
,
$collecting
,
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$params
=
$this
->
collectingBillBin
(
$father_id
,
$collecting
,
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
,
$source
,
$income_time
);
$house_number
,
$industry_type
,
$remark
,
$transfer_img
,
$source
,
$income_time
);
$father_id
=
$this
->
payLogModel
->
insertPayLog
(
$params
);
$father_id
=
$this
->
payLogModel
->
insertPayLog
(
$params
);
}
else
{
}
else
{
array_push
(
$bill_arr
,
$this
->
collectingBillBin
(
$father_id
,
$collecting
,
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
array_push
(
$bill_arr
,
$this
->
collectingBillBin
(
$father_id
,
$collecting
,
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
,
$source
,
$income_time
));
$house_number
,
$industry_type
,
$remark
,
$transfer_img
,
$source
,
$income_time
));
}
}
}
}
}
}
...
@@ -113,12 +113,12 @@ class OrderLogService
...
@@ -113,12 +113,12 @@ class OrderLogService
public
function
addCollectingBill
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$collecting_bill
,
$house_number
,
public
function
addCollectingBill
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$collecting_bill
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
,
$source
)
$industry_type
,
$remark
,
$transfer_img
,
$source
)
{
{
$bill_arr
=
$params
=
[];
$bill_arr
=
$params
=
[];
$father_id
=
0
;
$father_id
=
0
;
foreach
(
$collecting_bill
as
$collecting
)
{
foreach
(
$collecting_bill
as
$collecting
)
{
if
(
isset
(
$collecting
[
"type"
])
&&
isset
(
$collecting
[
"pay_type"
])
&&
isset
(
$collecting
[
"money"
]))
{
if
(
isset
(
$collecting
[
"type"
])
&&
isset
(
$collecting
[
"pay_type"
])
&&
isset
(
$collecting
[
"money"
]))
{
if
(
$father_id
==
0
)
{
if
(
$father_id
==
0
)
{
$params
=
$this
->
collectingBillBin
(
$father_id
,
$collecting
,
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$params
=
$this
->
collectingBillBin
(
$father_id
,
$collecting
,
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
,
$source
);
$house_number
,
$industry_type
,
$remark
,
$transfer_img
,
$source
);
$father_id
=
$this
->
payLogModel
->
insertPayLog
(
$params
);
$father_id
=
$this
->
payLogModel
->
insertPayLog
(
$params
);
}
else
{
}
else
{
...
@@ -139,27 +139,27 @@ class OrderLogService
...
@@ -139,27 +139,27 @@ class OrderLogService
}
}
private
function
collectingBillBin
(
$father_id
,
$collecting_arr
,
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$house_number
,
private
function
collectingBillBin
(
$father_id
,
$collecting_arr
,
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
,
$source
,
$income_time
)
$industry_type
,
$remark
,
$transfer_img
,
$source
,
$income_time
)
{
{
$arr
[
"report_id"
]
=
$report_id
;
$arr
[
"report_id"
]
=
$report_id
;
$arr
[
"father_id"
]
=
$father_id
;
$arr
[
"father_id"
]
=
$father_id
;
$arr
[
"order_no"
]
=
$order_no
;
$arr
[
"order_no"
]
=
$order_no
;
$arr
[
"order_id"
]
=
$order_id
;
$arr
[
"order_id"
]
=
$order_id
;
$arr
[
"source"
]
=
$source
;
$arr
[
"source"
]
=
$source
;
$arr
[
"agent_id"
]
=
$agent_id
;
$arr
[
"agent_id"
]
=
$agent_id
;
$arr
[
"agent_name"
]
=
$agent_name
;
$arr
[
"agent_name"
]
=
$agent_name
;
$arr
[
"type"
]
=
$collecting_arr
[
"type"
];
$arr
[
"type"
]
=
$collecting_arr
[
"type"
];
$arr
[
"pay_type"
]
=
$collecting_arr
[
"pay_type"
];
$arr
[
"pay_type"
]
=
$collecting_arr
[
"pay_type"
];
$arr
[
"money"
]
=
$collecting_arr
[
"money"
];
$arr
[
"money"
]
=
$collecting_arr
[
"money"
];
$arr
[
"house_number"
]
=
$house_number
;
$arr
[
"house_number"
]
=
$house_number
;
$arr
[
"industry_type"
]
=
$industry_type
;
$arr
[
"industry_type"
]
=
$industry_type
;
$arr
[
"remark"
]
=
$remark
;
$arr
[
"remark"
]
=
$remark
;
$arr
[
"transfer_img"
]
=
$transfer_img
;
$arr
[
"transfer_img"
]
=
$transfer_img
;
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
if
(
$income_time
)
{
if
(
$income_time
)
{
$arr
[
"income_time"
]
=
date
(
"Y-m-d H:i:s"
,
$income_time
);
$arr
[
"income_time"
]
=
date
(
"Y-m-d H:i:s"
,
$income_time
);
}
}
return
$arr
;
return
$arr
;
...
@@ -190,13 +190,13 @@ class OrderLogService
...
@@ -190,13 +190,13 @@ class OrderLogService
$commission
,
$commission_arr
,
$house_number
,
$is_open
,
$industry_type
,
$estimated_receipt_date
)
$commission
,
$commission_arr
,
$house_number
,
$is_open
,
$industry_type
,
$estimated_receipt_date
)
{
{
$bargain_arr
=
[];
$bargain_arr
=
[];
$father_id
=
0
;
$father_id
=
0
;
foreach
(
$commission_arr
as
$commission_val
)
{
foreach
(
$commission_arr
as
$commission_val
)
{
if
(
isset
(
$commission_val
[
"role"
])
&&
isset
(
$commission_val
[
"agent_id"
])
&&
isset
(
$commission_val
[
"scale"
])
if
(
isset
(
$commission_val
[
"role"
])
&&
isset
(
$commission_val
[
"agent_id"
])
&&
isset
(
$commission_val
[
"scale"
])
&&
isset
(
$commission_val
[
"scale_fee"
]))
{
&&
isset
(
$commission_val
[
"scale_fee"
]))
{
if
(
$father_id
==
0
)
{
if
(
$father_id
==
0
)
{
$params
=
$this
->
bargainBin
(
$father_id
,
$commission_val
,
$submit_agent_id
,
$submit_agent_name
,
$report_id
,
$order_id
,
$params
=
$this
->
bargainBin
(
$father_id
,
$commission_val
,
$submit_agent_id
,
$submit_agent_name
,
$report_id
,
$order_id
,
$order_no
,
$trade_type
,
$price
,
$commission
,
$house_number
,
$is_open
,
$industry_type
,
$estimated_receipt_date
);
$order_no
,
$trade_type
,
$price
,
$commission
,
$house_number
,
$is_open
,
$industry_type
,
$estimated_receipt_date
);
$father_id
=
$this
->
bargainModel
->
insertBargain
(
$params
);
$father_id
=
$this
->
bargainModel
->
insertBargain
(
$params
);
}
else
{
}
else
{
...
@@ -204,7 +204,7 @@ class OrderLogService
...
@@ -204,7 +204,7 @@ class OrderLogService
$order_id
,
$order_no
,
$trade_type
,
$price
,
$commission
,
$house_number
,
$is_open
,
$industry_type
,
$estimated_receipt_date
));
$order_id
,
$order_no
,
$trade_type
,
$price
,
$commission
,
$house_number
,
$is_open
,
$industry_type
,
$estimated_receipt_date
));
}
}
}
}
array_push
(
$agent_arr
,
[
$commission_val
[
"agent_id"
]
]);
array_push
(
$agent_arr
,
[
$commission_val
[
"agent_id"
]
]);
}
}
if
(
$father_id
>
0
)
{
//修改楼盘
if
(
$father_id
>
0
)
{
//修改楼盘
$houseNumUpdateService
=
new
HouseNumUpdateService
();
$houseNumUpdateService
=
new
HouseNumUpdateService
();
...
@@ -226,25 +226,25 @@ class OrderLogService
...
@@ -226,25 +226,25 @@ class OrderLogService
private
function
bargainBin
(
$father_id
,
$commission_val
,
$submit_agent_id
,
$submit_agent_name
,
$report_id
,
$order_id
,
private
function
bargainBin
(
$father_id
,
$commission_val
,
$submit_agent_id
,
$submit_agent_name
,
$report_id
,
$order_id
,
$order_no
,
$trade_type
,
$price
,
$commission
,
$house_number
,
$is_open
,
$industry_type
,
$estimated_receipt_date
)
$order_no
,
$trade_type
,
$price
,
$commission
,
$house_number
,
$is_open
,
$industry_type
,
$estimated_receipt_date
)
{
{
$arr
[
"report_id"
]
=
$report_id
;
$arr
[
"report_id"
]
=
$report_id
;
$arr
[
"father_id"
]
=
$father_id
;
$arr
[
"father_id"
]
=
$father_id
;
$arr
[
"order_no"
]
=
$order_no
;
$arr
[
"order_no"
]
=
$order_no
;
$arr
[
"order_id"
]
=
$order_id
;
$arr
[
"order_id"
]
=
$order_id
;
$arr
[
"submit_agent_id"
]
=
$submit_agent_id
;
$arr
[
"submit_agent_id"
]
=
$submit_agent_id
;
$arr
[
"submit_agent_name"
]
=
$submit_agent_name
;
$arr
[
"submit_agent_name"
]
=
$submit_agent_name
;
$arr
[
"trade_type"
]
=
$trade_type
;
$arr
[
"trade_type"
]
=
$trade_type
;
$arr
[
"price"
]
=
$price
;
$arr
[
"price"
]
=
$price
;
$arr
[
"commission"
]
=
$commission
;
$arr
[
"commission"
]
=
$commission
;
$arr
[
"role"
]
=
$commission_val
[
"role"
];
$arr
[
"role"
]
=
$commission_val
[
"role"
];
$arr
[
"agent_id"
]
=
$commission_val
[
"agent_id"
];
$arr
[
"agent_id"
]
=
$commission_val
[
"agent_id"
];
$arr
[
"scale"
]
=
$commission_val
[
"scale"
];
$arr
[
"scale"
]
=
$commission_val
[
"scale"
];
$arr
[
"scale_fee"
]
=
$commission_val
[
"scale_fee"
];
$arr
[
"scale_fee"
]
=
$commission_val
[
"scale_fee"
];
$arr
[
"house_number"
]
=
$house_number
;
$arr
[
"house_number"
]
=
$house_number
;
$arr
[
"is_open"
]
=
$is_open
;
$arr
[
"is_open"
]
=
$is_open
;
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"estimated_receipt_date"
]
=
date
(
"Y-m-d H:i:s"
,
$estimated_receipt_date
);
$arr
[
"estimated_receipt_date"
]
=
date
(
"Y-m-d H:i:s"
,
$estimated_receipt_date
);
$arr
[
"industry_type"
]
=
$industry_type
;
$arr
[
"industry_type"
]
=
$industry_type
;
return
$arr
;
return
$arr
;
}
}
...
@@ -256,9 +256,9 @@ class OrderLogService
...
@@ -256,9 +256,9 @@ class OrderLogService
public
function
selectOrderDetail
(
$where_
)
public
function
selectOrderDetail
(
$where_
)
{
{
$orderModel
=
new
OrderModel
();
$orderModel
=
new
OrderModel
();
$field
=
"a.id,a.order_no,a.house_id,a.house_title,b.id as report_id,b.user_id,c.user_name as user_nick,c.user_phone,
$field
=
"a.id,a.order_no,a.house_id,a.house_title,b.id as report_id,b.user_id,c.user_name as user_nick,c.user_phone,
c.user_pic,c.sex"
;
c.user_pic,c.sex"
;
$result
=
$orderModel
->
selectOrderDetail
(
$field
,
$where_
);
$result
=
$orderModel
->
selectOrderDetail
(
$field
,
$where_
);
foreach
(
$result
as
$k
=>
$v
)
{
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"]);
$result
[
$k
][
"user_pic"
]
=
HEADERIMGURL
.
$v
[
"user_pic"
];
$result
[
$k
][
"user_pic"
]
=
HEADERIMGURL
.
$v
[
"user_pic"
];
...
@@ -279,58 +279,58 @@ class OrderLogService
...
@@ -279,58 +279,58 @@ class OrderLogService
public
function
selectListByOrderNo
(
$order_id
)
public
function
selectListByOrderNo
(
$order_id
)
{
{
$result
=
[];
$result
=
[];
$sort
=
0
;
$sort
=
0
;
//todo 1.验证订单是否存在
//todo 1.验证订单是否存在
$orderModel
=
new
OrderModel
();
$orderModel
=
new
OrderModel
();
$oReportModel
=
new
OReportModel
();
$oReportModel
=
new
OReportModel
();
$oMarchInModel
=
new
OMarchInModel
();
$oMarchInModel
=
new
OMarchInModel
();
$followUpLogModel
=
new
FollowUpLogModel
();
$followUpLogModel
=
new
FollowUpLogModel
();
$oPayLogModel
=
new
OPayLogModel
();
$oPayLogModel
=
new
OPayLogModel
();
$oRefundModel
=
new
ORefundModel
();
$oRefundModel
=
new
ORefundModel
();
$oBargainModel
=
new
OBargainModel
();
$oBargainModel
=
new
OBargainModel
();
$orderData
=
$orderModel
->
selectOrderByOrderId
(
"a.f_id,a.house_title,b.internal_address"
,
[
"order_id"
=>
$order_id
]);
$orderData
=
$orderModel
->
selectOrderByOrderId
(
"a.f_id,a.house_title,b.internal_address"
,
[
"order_id"
=>
$order_id
]);
//dump($orderData);
//dump($orderData);
if
(
count
(
$orderData
)
<=
0
)
{
if
(
count
(
$orderData
)
<=
0
)
{
return
[
"101"
,
"找不到此订单编号"
];
return
[
"101"
,
"找不到此订单编号"
];
}
}
$report_id
=
$orderData
[
0
][
"f_id"
];
$report_id
=
$orderData
[
0
][
"f_id"
];
$field_report
=
"a.id,a.report_agent_id,a.report_agent_phone,a.report_agent_name,a.report_store_id,
$field_report
=
"a.id,a.report_agent_id,a.report_agent_phone,a.report_agent_name,a.report_store_id,
a.user_id,a.user_phone,a.user_name,a.vehicle,a.intro,a.predict_see_time,a.create_time,b.store_name,c.district_name"
;
a.user_id,a.user_phone,a.user_name,a.vehicle,a.intro,a.predict_see_time,a.create_time,b.store_name,c.district_name"
;
$reportData
=
$oReportModel
->
selectReportInfoById
(
$field_report
,
[
"id"
=>
$report_id
]);
$reportData
=
$oReportModel
->
selectReportInfoById
(
$field_report
,
[
"id"
=>
$report_id
]);
if
(
count
(
$reportData
)
==
0
)
{
if
(
count
(
$reportData
)
==
0
)
{
return
[
"101"
,
"报备记录未找到"
];
return
[
"101"
,
"报备记录未找到"
];
}
}
//报备
//报备
$reportData
[
0
][
"step_name"
]
=
"report"
;
$reportData
[
0
][
"step_name"
]
=
"report"
;
$reportData
[
0
][
"house_title"
]
=
$orderData
[
0
][
"house_title"
];
$reportData
[
0
][
"house_title"
]
=
$orderData
[
0
][
"house_title"
];
$reportData
[
0
][
"internal_address"
]
=
$orderData
[
0
][
"internal_address"
];
$reportData
[
0
][
"internal_address"
]
=
$orderData
[
0
][
"internal_address"
];
$result
[
$sort
++
]
=
$reportData
[
0
];
$result
[
$sort
++
]
=
$reportData
[
0
];
//进场 march in
//进场 march in
$field_march_in
=
"id,reception_id,reception_name,report_id,order_no,march_in_remark,march_in_img,march_in_area,create_time"
;
$field_march_in
=
"id,reception_id,reception_name,report_id,order_no,march_in_remark,march_in_img,march_in_area,create_time"
;
$marchInData
=
$oMarchInModel
->
selectMarchInByOrderNo
(
$field_march_in
,
[
"order_id"
=>
$order_id
]);
$marchInData
=
$oMarchInModel
->
selectMarchInByOrderNo
(
$field_march_in
,
[
"order_id"
=>
$order_id
]);
if
(
count
(
$marchInData
)
>
0
)
{
if
(
count
(
$marchInData
)
>
0
)
{
foreach
(
$marchInData
as
$k
=>
$v
)
{
foreach
(
$marchInData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"march_in"
;
$v
[
"step_name"
]
=
"march_in"
;
$v
[
"img_path"
]
=
CHAT_IMG_URL
;
$v
[
"img_path"
]
=
CHAT_IMG_URL
;
$result
[
$sort
++
]
=
$v
;
$result
[
$sort
++
]
=
$v
;
}
}
}
}
//跟进
//跟进
$field_follow_up
=
"id,agent_id,agent_name,user_type,decision_maker,industry_type,area_requirement,price_requirement,province,city,
$field_follow_up
=
"id,agent_id,agent_name,user_type,decision_maker,industry_type,area_requirement,price_requirement,province,city,
district,business_area,explain,explain_img,create_time"
;
district,business_area,explain,explain_img,create_time"
;
$followUpLogData
=
$followUpLogModel
->
selectFollowUpListByReportId
(
$field_follow_up
,
[
"report_id"
=>
$report_id
]);
$followUpLogData
=
$followUpLogModel
->
selectFollowUpListByReportId
(
$field_follow_up
,
[
"report_id"
=>
$report_id
]);
if
(
count
(
$followUpLogData
)
>
0
)
{
if
(
count
(
$followUpLogData
)
>
0
)
{
foreach
(
$followUpLogData
as
$k
=>
$v
)
{
foreach
(
$followUpLogData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"follow_up_log"
;
$v
[
"step_name"
]
=
"follow_up_log"
;
$v
=
$this
->
convertFollowUp
(
$v
);
$v
=
$this
->
convertFollowUp
(
$v
);
$v
[
"img_path"
]
=
CHAT_IMG_URL
;
$v
[
"img_path"
]
=
CHAT_IMG_URL
;
$result
[
$sort
++
]
=
$v
;
$result
[
$sort
++
]
=
$v
;
}
}
}
}
...
@@ -338,12 +338,12 @@ class OrderLogService
...
@@ -338,12 +338,12 @@ class OrderLogService
//收款
//收款
$field_pay_log
=
"id,order_no,father_id,order_id,agent_id,agent_name,type,pay_type,money,house_number,industry_type,
$field_pay_log
=
"id,order_no,father_id,order_id,agent_id,agent_name,type,pay_type,money,house_number,industry_type,
remark,transfer_img,real_money,source,create_time"
;
remark,transfer_img,real_money,source,create_time"
;
$payLogData
=
$oPayLogModel
->
selectPayLogByOrderNo
(
$field_pay_log
,
[
"order_id"
=>
$order_id
]);
$payLogData
=
$oPayLogModel
->
selectPayLogByOrderNo
(
$field_pay_log
,
[
"order_id"
=>
$order_id
]);
if
(
count
(
$payLogData
)
>
0
)
{
if
(
count
(
$payLogData
)
>
0
)
{
$sortPayLogData
=
$this
->
arr2tree
(
$payLogData
);
$sortPayLogData
=
$this
->
arr2tree
(
$payLogData
);
foreach
(
$sortPayLogData
as
$k
=>
$v
)
{
foreach
(
$sortPayLogData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"pay_log"
;
$v
[
"step_name"
]
=
"pay_log"
;
$v
[
"img_path"
]
=
CHAT_IMG_URL
;
$v
[
"img_path"
]
=
CHAT_IMG_URL
;
$result
[
$sort
++
]
=
$v
;
$result
[
$sort
++
]
=
$v
;
}
}
}
}
...
@@ -351,11 +351,11 @@ class OrderLogService
...
@@ -351,11 +351,11 @@ class OrderLogService
//退款
//退款
$field_refund
=
"id,report_id,agent_id,agent_name,order_no,order_id,refund_money,status,name,bank,card_no,
$field_refund
=
"id,report_id,agent_id,agent_name,order_no,order_id,refund_money,status,name,bank,card_no,
remark,remark_img,create_time"
;
remark,remark_img,create_time"
;
$refundData
=
$oRefundModel
->
selectRefundByOrderNo
(
$field_refund
,
[
"order_id"
=>
$order_id
]);
$refundData
=
$oRefundModel
->
selectRefundByOrderNo
(
$field_refund
,
[
"order_id"
=>
$order_id
]);
if
(
count
(
$refundData
)
>
0
)
{
if
(
count
(
$refundData
)
>
0
)
{
foreach
(
$refundData
as
$k
=>
$v
)
{
foreach
(
$refundData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"refund"
;
$v
[
"step_name"
]
=
"refund"
;
$v
[
"img_path"
]
=
CHAT_IMG_URL
;
$v
[
"img_path"
]
=
CHAT_IMG_URL
;
$result
[
$sort
++
]
=
$v
;
$result
[
$sort
++
]
=
$v
;
}
}
}
}
...
@@ -363,7 +363,7 @@ class OrderLogService
...
@@ -363,7 +363,7 @@ class OrderLogService
//成交报告
//成交报告
$field_bargain
=
"a.id,a.father_id,a.house_number,a.is_open,a.report_id,a.order_id,a.trade_type,a.submit_agent_id,a.industry_type,
$field_bargain
=
"a.id,a.father_id,a.house_number,a.is_open,a.report_id,a.order_id,a.trade_type,a.submit_agent_id,a.industry_type,
a.estimated_receipt_date,a.submit_agent_name, a.price,a.commission,a.role,a.agent_id,a.scale,a.scale_fee,a.create_time,b.name,b.phone,a.is_commission"
;
a.estimated_receipt_date,a.submit_agent_name, a.price,a.commission,a.role,a.agent_id,a.scale,a.scale_fee,a.create_time,b.name,b.phone,a.is_commission"
;
$bargainData
=
$oBargainModel
->
selectBargainListByOrderNo
(
$field_bargain
,
[
"order_id"
=>
$order_id
]);
$bargainData
=
$oBargainModel
->
selectBargainListByOrderNo
(
$field_bargain
,
[
"order_id"
=>
$order_id
]);
if
(
count
(
$bargainData
)
>
0
)
{
if
(
count
(
$bargainData
)
>
0
)
{
$bargain_data_arr
=
$this
->
arr2TreeBargain
(
$bargainData
);
$bargain_data_arr
=
$this
->
arr2TreeBargain
(
$bargainData
);
foreach
(
$bargain_data_arr
as
$k2
=>
$v2
)
{
foreach
(
$bargain_data_arr
as
$k2
=>
$v2
)
{
...
@@ -380,7 +380,7 @@ class OrderLogService
...
@@ -380,7 +380,7 @@ class OrderLogService
*/
*/
public
function
selectListByOrderNoV2
(
$order_id
)
public
function
selectListByOrderNoV2
(
$order_id
)
{
{
//todo 删除
//todo 删除
}
}
...
@@ -399,12 +399,12 @@ class OrderLogService
...
@@ -399,12 +399,12 @@ class OrderLogService
foreach
(
$tree
as
$i
=>
$v
)
{
foreach
(
$tree
as
$i
=>
$v
)
{
//查询图片
//查询图片
$oImgModel
=
new
OImg
();
$oImgModel
=
new
OImg
();
$params
[
"img_id"
]
=
$v
[
0
][
"father_id"
];
$params
[
"img_id"
]
=
$v
[
0
][
"father_id"
];
$params
[
"img_type"
]
=
2
;
$params
[
"img_type"
]
=
2
;
$img_arr
=
$oImgModel
->
getImgList
(
$params
);
$img_arr
=
$oImgModel
->
getImgList
(
$params
);
$trees
[
$i
][
"img"
]
=
$img_arr
;
$trees
[
$i
][
"img"
]
=
$img_arr
;
$trees
[
$i
][
"list"
]
=
$v
;
$trees
[
$i
][
"list"
]
=
$v
;
$trees
[
$i
][
"create_time"
]
=
$v
[
0
][
"create_time"
];
$trees
[
$i
][
"create_time"
]
=
$v
[
0
][
"create_time"
];
}
}
...
@@ -430,12 +430,12 @@ class OrderLogService
...
@@ -430,12 +430,12 @@ class OrderLogService
foreach
(
$list
as
$k
=>
$v
)
{
foreach
(
$list
as
$k
=>
$v
)
{
$tree
[
$v
[
"father_id"
]][
'create_time'
]
=
$v
[
'create_time'
];
$tree
[
$v
[
"father_id"
]][
'create_time'
]
=
$v
[
'create_time'
];
if
(
$v
[
'father_id'
]
==
$v
[
'id'
])
{
if
(
$v
[
'father_id'
]
==
$v
[
'id'
])
{
$tree
[
$v
[
"father_id"
]][
'trade_type'
]
=
$v
[
'trade_type'
];
$tree
[
$v
[
"father_id"
]][
'trade_type'
]
=
$v
[
'trade_type'
];
$tree
[
$v
[
"father_id"
]][
'house_number'
]
=
$v
[
'house_number'
];
$tree
[
$v
[
"father_id"
]][
'house_number'
]
=
$v
[
'house_number'
];
$tree
[
$v
[
"father_id"
]][
'industry_type'
]
=
$v
[
'industry_type'
];
$tree
[
$v
[
"father_id"
]][
'industry_type'
]
=
$v
[
'industry_type'
];
$tree
[
$v
[
"father_id"
]][
'price'
]
=
$v
[
'price'
];
$tree
[
$v
[
"father_id"
]][
'price'
]
=
$v
[
'price'
];
$tree
[
$v
[
"father_id"
]][
'commission'
]
=
$v
[
'commission'
];
$tree
[
$v
[
"father_id"
]][
'commission'
]
=
$v
[
'commission'
];
$tree
[
$v
[
"father_id"
]][
'is_open'
]
=
$v
[
'is_open'
];
$tree
[
$v
[
"father_id"
]][
'is_open'
]
=
$v
[
'is_open'
];
}
}
$tree
[
$v
[
"father_id"
]][
'list_array'
][]
=
$v
;
$tree
[
$v
[
"father_id"
]][
'list_array'
][]
=
$v
;
...
@@ -455,25 +455,25 @@ class OrderLogService
...
@@ -455,25 +455,25 @@ class OrderLogService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
selectListByUserId
(
$user_id
,
$search
=
""
,
$site_id
)
public
function
selectListByUserId
(
$user_id
,
$search
=
""
,
$site_id
)
{
{
$result
=
[];
$result
=
[];
$sort
=
0
;
$sort
=
0
;
//todo 1.验证订单是否存在
//todo 1.验证订单是否存在
$oReportModel
=
new
OReportModel
();
$oReportModel
=
new
OReportModel
();
$oMarchInModel
=
new
OMarchInModel
();
$oMarchInModel
=
new
OMarchInModel
();
$followUpLogModel
=
new
FollowUpLogModel
();
$followUpLogModel
=
new
FollowUpLogModel
();
$oPayLogModel
=
new
OPayLogModel
();
$oPayLogModel
=
new
OPayLogModel
();
$oRefundModel
=
new
ORefundModel
();
$oRefundModel
=
new
ORefundModel
();
$oBargainModel
=
new
OBargainModel
();
$oBargainModel
=
new
OBargainModel
();
$uPhoneFollowModel
=
new
UPhoneFollowPp
(
$site_id
);
$uPhoneFollowModel
=
new
UPhoneFollowPp
(
$site_id
);
//电话跟进
//电话跟进
$userParams
[
"user_id"
]
=
$user_id
;
$userParams
[
"user_id"
]
=
$user_id
;
$userParams
[
"type"
]
=
0
;
//电话跟进
$userParams
[
"type"
]
=
0
;
//电话跟进
$field_user_follow
=
"a.id,a.content,a.user_id,a.agent_id,a.type,a.create_time,a.user_status,b.name,b.phone,b.img,c.store_name"
;
$field_user_follow
=
"a.id,a.content,a.user_id,a.agent_id,a.type,a.create_time,a.user_status,b.name,b.phone,b.img,c.store_name"
;
$bargainData
=
$uPhoneFollowModel
->
getFollowUpListByUserId
(
$field_user_follow
,
$userParams
);
$bargainData
=
$uPhoneFollowModel
->
getFollowUpListByUserId
(
$field_user_follow
,
$userParams
);
if
(
count
(
$bargainData
)
>
0
)
{
if
(
count
(
$bargainData
)
>
0
)
{
foreach
(
$bargainData
as
$k
=>
$v
)
{
foreach
(
$bargainData
as
$k
=>
$v
)
{
$type
=
"无效"
;
$type
=
"无效"
;
...
@@ -483,14 +483,14 @@ class OrderLogService
...
@@ -483,14 +483,14 @@ class OrderLogService
$type
=
"已租"
;
$type
=
"已租"
;
}
}
$v
[
"step_name"
]
=
"phone_follow_up"
;
$v
[
"step_name"
]
=
"phone_follow_up"
;
$v
[
"step"
]
=
"电话跟进:"
.
$v
[
'content'
]
.
"【"
.
$type
.
"】"
;
$v
[
"step"
]
=
"电话跟进:"
.
$v
[
'content'
]
.
"【"
.
$type
.
"】"
;
$result
[
$sort
++
]
=
$v
;
$result
[
$sort
++
]
=
$v
;
}
}
}
}
//跟进
//跟进
$userParams
[
"type"
]
=
1
;
//普通跟进
$userParams
[
"type"
]
=
1
;
//普通跟进
$bargainData
=
$uPhoneFollowModel
->
getFollowUpListByUserId
(
$field_user_follow
,
$userParams
);
$bargainData
=
$uPhoneFollowModel
->
getFollowUpListByUserId
(
$field_user_follow
,
$userParams
);
if
(
count
(
$bargainData
)
>
0
)
{
if
(
count
(
$bargainData
)
>
0
)
{
foreach
(
$bargainData
as
$k
=>
$v
)
{
foreach
(
$bargainData
as
$k
=>
$v
)
{
$type
=
"无效"
;
$type
=
"无效"
;
...
@@ -500,15 +500,15 @@ class OrderLogService
...
@@ -500,15 +500,15 @@ class OrderLogService
$type
=
"已租"
;
$type
=
"已租"
;
}
}
$v
[
"step_name"
]
=
"follow_up"
;
$v
[
"step_name"
]
=
"follow_up"
;
$v
[
"step"
]
=
"跟进:"
.
$v
[
'content'
]
.
"【"
.
$type
.
"】"
;
$v
[
"step"
]
=
"跟进:"
.
$v
[
'content'
]
.
"【"
.
$type
.
"】"
;
$result
[
$sort
++
]
=
$v
;
$result
[
$sort
++
]
=
$v
;
}
}
}
}
$field_report
=
"a.id,a.create_time,a.predict_see_time,a.intro,b.id as order_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"
;
$field_report
=
"a.id,a.create_time,a.predict_see_time,a.intro,b.id as order_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"
;
$reportData
=
$oReportModel
->
selectReportByUserId
(
$field_report
,
[
"user_id"
=>
$user_id
]);
$reportData
=
$oReportModel
->
selectReportByUserId
(
$field_report
,
[
"user_id"
=>
$user_id
]);
if
(
count
(
$result
)
<=
0
&&
count
(
$reportData
)
<=
0
)
{
if
(
count
(
$result
)
<=
0
&&
count
(
$reportData
)
<=
0
)
{
return
[];
return
[];
}
}
...
@@ -516,8 +516,8 @@ class OrderLogService
...
@@ -516,8 +516,8 @@ class OrderLogService
$order_ids
=
$report_ids
=
""
;
$order_ids
=
$report_ids
=
""
;
//报备
//报备
foreach
(
$reportData
as
$k
=>
$v
)
{
foreach
(
$reportData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"report"
;
$v
[
"step_name"
]
=
"report"
;
$v
[
"step"
]
=
"报备【"
.
$v
[
'house_title'
]
.
"】"
;
$v
[
"step"
]
=
"报备【"
.
$v
[
'house_title'
]
.
"】"
;
$result
[
$sort
++
]
=
$v
;
$result
[
$sort
++
]
=
$v
;
$order_ids
.=
$v
[
"order_id"
]
.
","
;
$order_ids
.=
$v
[
"order_id"
]
.
","
;
...
@@ -525,20 +525,20 @@ class OrderLogService
...
@@ -525,20 +525,20 @@ class OrderLogService
$report_ids
.=
$v
[
"id"
]
.
","
;
$report_ids
.=
$v
[
"id"
]
.
","
;
}
}
$order_ids
=
rtrim
(
$order_ids
,
","
);
$order_ids
=
rtrim
(
$order_ids
,
","
);
$report_ids
=
rtrim
(
$report_ids
,
","
);
$report_ids
=
rtrim
(
$report_ids
,
","
);
$orderParams
[
"order_id"
]
=
array
(
"in"
,
$order_ids
);
$orderParams
[
"order_id"
]
=
array
(
"in"
,
$order_ids
);
$orderParams
[
"house_title"
]
=
array
(
"like"
,
"%"
.
trim
(
$search
)
.
"%"
);
$orderParams
[
"house_title"
]
=
array
(
"like"
,
"%"
.
trim
(
$search
)
.
"%"
);
$reportParams
[
"report_id"
]
=
array
(
"in"
,
$report_ids
);
$reportParams
[
"report_id"
]
=
array
(
"in"
,
$report_ids
);
//进场 march in
//进场 march in
$field_march_in
=
"a.id,a.reception_id,a.create_time,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"
;
$field_march_in
=
"a.id,a.reception_id,a.create_time,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"
;
$marchInData
=
$oMarchInModel
->
getMarchInListByOrderId
(
$field_march_in
,
$orderParams
);
$marchInData
=
$oMarchInModel
->
getMarchInListByOrderId
(
$field_march_in
,
$orderParams
);
if
(
count
(
$marchInData
)
>
0
)
{
if
(
count
(
$marchInData
)
>
0
)
{
foreach
(
$marchInData
as
$k
=>
$v
)
{
foreach
(
$marchInData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"march_in"
;
$v
[
"step_name"
]
=
"march_in"
;
$v
[
"step"
]
=
"进场【"
.
$v
[
'house_title'
]
.
"】"
;
$v
[
"step"
]
=
"进场【"
.
$v
[
'house_title'
]
.
"】"
;
$result
[
$sort
++
]
=
$v
;
$result
[
$sort
++
]
=
$v
;
}
}
}
}
...
@@ -550,22 +550,22 @@ class OrderLogService
...
@@ -550,22 +550,22 @@ class OrderLogService
if
(
count
(
$followUpLogData
)
>
0
)
{
if
(
count
(
$followUpLogData
)
>
0
)
{
foreach
(
$followUpLogData
as
$k
=>
$v
)
{
foreach
(
$followUpLogData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"follow_up_log"
;
$v
[
"step_name"
]
=
"follow_up_log"
;
$v
[
"step"
]
=
"跟进"
;
$v
[
"step"
]
=
"跟进"
;
$v
=
$this
->
convertFollowUp
(
$v
);
$v
=
$this
->
convertFollowUp
(
$v
);
$v
[
"img_path"
]
=
CHAT_IMG_URL
;
$v
[
"img_path"
]
=
CHAT_IMG_URL
;
$v
[
"explain_img"
]
=
$v
[
"explain_img"
];
$v
[
"explain_img"
]
=
$v
[
"explain_img"
];
$result
[
$sort
++
]
=
$v
;
$result
[
$sort
++
]
=
$v
;
}
}
}
}
//收款
//收款
$field_pay_log
=
"a.id,a.create_time,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"
;
$field_pay_log
=
"a.id,a.create_time,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"
;
$payLogData
=
$oPayLogModel
->
getPayLogByOrderId
(
$field_pay_log
,
$orderParams
);
$payLogData
=
$oPayLogModel
->
getPayLogByOrderId
(
$field_pay_log
,
$orderParams
);
if
(
count
(
$payLogData
)
>
0
)
{
if
(
count
(
$payLogData
)
>
0
)
{
foreach
(
$payLogData
as
$k
=>
$v
)
{
foreach
(
$payLogData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"pay_log"
;
$v
[
"step_name"
]
=
"pay_log"
;
$v
[
"step"
]
=
"收款【"
.
$v
[
'house_title'
]
.
"】"
;
$v
[
"step"
]
=
"收款【"
.
$v
[
'house_title'
]
.
"】"
;
$result
[
$sort
++
]
=
$v
;
$result
[
$sort
++
]
=
$v
;
}
}
}
}
...
@@ -577,19 +577,19 @@ class OrderLogService
...
@@ -577,19 +577,19 @@ class OrderLogService
$refundData
=
$oRefundModel
->
getRefundByOrderId
(
$field_refund
,
$orderParams
);
$refundData
=
$oRefundModel
->
getRefundByOrderId
(
$field_refund
,
$orderParams
);
if
(
count
(
$refundData
)
>
0
)
{
if
(
count
(
$refundData
)
>
0
)
{
foreach
(
$refundData
as
$k
=>
$v
)
{
foreach
(
$refundData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"refund"
;
$v
[
"step_name"
]
=
"refund"
;
$v
[
"step"
]
=
"退款【"
.
$v
[
'house_title'
]
.
"】"
;
$v
[
"step"
]
=
"退款【"
.
$v
[
'house_title'
]
.
"】"
;
$result
[
$sort
++
]
=
$v
;
$result
[
$sort
++
]
=
$v
;
}
}
}
}
//成交报告
//成交报告
$field_bargain
=
"a.id,a.create_time,a.house_number,a.is_open,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"
;
$field_bargain
=
"a.id,a.create_time,a.house_number,a.is_open,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"
;
$bargainData
=
$oBargainModel
->
getBargainByOrderId
(
$field_bargain
,
$orderParams
);
$bargainData
=
$oBargainModel
->
getBargainByOrderId
(
$field_bargain
,
$orderParams
);
if
(
count
(
$bargainData
)
>
0
)
{
if
(
count
(
$bargainData
)
>
0
)
{
foreach
(
$bargainData
as
$k
=>
$v
)
{
foreach
(
$bargainData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"bargain"
;
$v
[
"step_name"
]
=
"bargain"
;
$v
[
"step"
]
=
"成交报告【"
.
$v
[
'house_title'
]
.
"】"
;
$v
[
"step"
]
=
"成交报告【"
.
$v
[
'house_title'
]
.
"】"
;
$result
[
$sort
++
]
=
$v
;
$result
[
$sort
++
]
=
$v
;
}
}
}
}
...
@@ -610,7 +610,7 @@ class OrderLogService
...
@@ -610,7 +610,7 @@ class OrderLogService
public
function
selectListByHouseId
(
$house_id
)
public
function
selectListByHouseId
(
$house_id
)
{
{
$result
=
[];
$result
=
[];
$sort
=
0
;
$sort
=
0
;
//todo 1.验证订单是否存在
//todo 1.验证订单是否存在
/* $oReportModel = new OReportModel();
/* $oReportModel = new OReportModel();
...
@@ -717,11 +717,11 @@ class OrderLogService
...
@@ -717,11 +717,11 @@ class OrderLogService
//楼盘跟进
//楼盘跟进
$field_shop_follow_up
=
"a.id,a.follow_up_info,a.agent_id,a.create_time,b.name as agent_name,b.img,c.store_name"
;
$field_shop_follow_up
=
"a.id,a.follow_up_info,a.agent_id,a.create_time,b.name as agent_name,b.img,c.store_name"
;
$houseFollowUpData
=
$gHousesFollowModel
->
getShopFollowUpList
(
$field_shop_follow_up
,
[
"house_id"
=>
$house_id
]);
$houseFollowUpData
=
$gHousesFollowModel
->
getShopFollowUpList
(
$field_shop_follow_up
,
[
"house_id"
=>
$house_id
]);
if
(
count
(
$houseFollowUpData
)
>
0
)
{
if
(
count
(
$houseFollowUpData
)
>
0
)
{
foreach
(
$houseFollowUpData
as
$k
=>
$v
)
{
foreach
(
$houseFollowUpData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"shop_follow_up"
;
$v
[
"step_name"
]
=
"shop_follow_up"
;
$v
[
"step"
]
=
"跟进:"
.
$v
[
"follow_up_info"
];
$v
[
"step"
]
=
"跟进:"
.
$v
[
"follow_up_info"
];
$result
[
$sort
++
]
=
$v
;
$result
[
$sort
++
]
=
$v
;
}
}
}
}
...
@@ -802,8 +802,8 @@ class OrderLogService
...
@@ -802,8 +802,8 @@ class OrderLogService
$item
[
"price_requirement"
]
=
"其他"
;
$item
[
"price_requirement"
]
=
"其他"
;
}
}
$regions
=
new
Regions
();
$regions
=
new
Regions
();
$cityInfo
=
$regions
->
getAddressByDiscCode
(
$item
[
"district"
]);
$cityInfo
=
$regions
->
getAddressByDiscCode
(
$item
[
"district"
]);
$item
[
"area_detail"
]
=
$cityInfo
;
$item
[
"area_detail"
]
=
$cityInfo
;
return
$item
;
return
$item
;
}
}
...
@@ -819,7 +819,7 @@ class OrderLogService
...
@@ -819,7 +819,7 @@ class OrderLogService
for
(
$i
=
0
;
$i
<
count
(
$result
);
$i
++
)
{
for
(
$i
=
0
;
$i
<
count
(
$result
);
$i
++
)
{
for
(
$j
=
$i
+
1
;
$j
<
count
(
$result
);
$j
++
)
{
for
(
$j
=
$i
+
1
;
$j
<
count
(
$result
);
$j
++
)
{
if
(
strtotime
(
$result
[
$j
][
"create_time"
])
-
strtotime
(
$result
[
$i
][
"create_time"
])
>
0
)
{
if
(
strtotime
(
$result
[
$j
][
"create_time"
])
-
strtotime
(
$result
[
$i
][
"create_time"
])
>
0
)
{
$temp
=
$result
[
$j
];
$temp
=
$result
[
$j
];
$result
[
$j
]
=
$result
[
$i
];
$result
[
$j
]
=
$result
[
$i
];
$result
[
$i
]
=
$temp
;
$result
[
$i
]
=
$temp
;
}
}
...
@@ -835,7 +835,7 @@ class OrderLogService
...
@@ -835,7 +835,7 @@ class OrderLogService
public
function
getSearchOrder
(
$params
)
public
function
getSearchOrder
(
$params
)
{
{
$condition
=
$where_
=
"1=1 "
;
$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,
$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"
;
b.user_id,b.user_phone,b.user_name,b.predict_see_time"
;
switch
((
int
)
$params
[
"type"
])
{
switch
((
int
)
$params
[
"type"
])
{
case
0
:
case
0
:
...
@@ -857,27 +857,33 @@ class OrderLogService
...
@@ -857,27 +857,33 @@ class OrderLogService
//todo 列表没有显示商铺地址 和产品沟通暂时搁置
//todo 列表没有显示商铺地址 和产品沟通暂时搁置
//$condition["c.house_title"] = array( 'like', "%" . trim($params['search_keyword']) . "%" );
//$condition["c.house_title"] = array( 'like', "%" . trim($params['search_keyword']) . "%" );
break
;
break
;
case
6
://
客户编号
$condition
[
"a.user_id"
]
=
trim
(
$params
[
'search_keyword'
]);
break
;
case
7
://
商铺编号
$condition
[
"b.house_id"
]
=
trim
(
$params
[
'search_keyword'
]);
break
;
default
:
default
:
return
[
"code"
=>
"101"
,
"msg"
=>
"搜索类型错误"
];
return
[
"code"
=>
"101"
,
"msg"
=>
"搜索类型错误"
];
}
}
$vModel
=
new
VerifyService
();
$vModel
=
new
VerifyService
();
$agentArr
=
$vModel
->
getAgentsByAgentId
(
$params
[
"agent_id"
]);
$agentArr
=
$vModel
->
getAgentsByAgentId
(
$params
[
"agent_id"
]);
$where_
=
$condition
;
$where_
=
$condition
;
if
(
$agentArr
)
{
if
(
$agentArr
)
{
$params
[
"report_agent_id"
]
=
$agentArr
;
$params
[
"report_agent_id"
]
=
$agentArr
;
$params
[
"agent_id_s"
]
=
array
(
"in"
,
$agentArr
);
$params
[
"agent_id_s"
]
=
array
(
"in"
,
$agentArr
);
$condition
.=
"and b.report_agent_id in ("
.
trim
(
$agentArr
)
.
") "
;
$condition
.=
"and b.report_agent_id in ("
.
trim
(
$agentArr
)
.
") "
;
}
}
$caseHouseId
=
$vModel
->
getCaseHouseIdByAgentId
(
$params
[
"agent_id_s"
]);
$caseHouseId
=
$vModel
->
getCaseHouseIdByAgentId
(
$params
[
"agent_id_s"
]);
$ids
=
""
;
$ids
=
""
;
foreach
(
$caseHouseId
as
$item
)
{
foreach
(
$caseHouseId
as
$item
)
{
$ids
.=
$item
[
"houses_id"
]
.
","
;
$ids
.=
$item
[
"houses_id"
]
.
","
;
}
}
$ids
=
rtrim
(
$ids
,
","
);
$ids
=
rtrim
(
$ids
,
","
);
$ids
=
$ids
?
$ids
:
0
;
$ids
=
$ids
?
$ids
:
0
;
$where_
.=
"and a.house_id in (
$ids
)"
;
$where_
.=
"and a.house_id in (
$ids
)"
;
...
@@ -920,27 +926,27 @@ class OrderLogService
...
@@ -920,27 +926,27 @@ class OrderLogService
public
function
getBargainList
(
$params
)
public
function
getBargainList
(
$params
)
{
{
$pageNo
=
empty
(
$params
[
"page_no"
])
?
1
:
$params
[
"page_no"
];
$pageNo
=
empty
(
$params
[
"page_no"
])
?
1
:
$params
[
"page_no"
];
$pageSize
=
empty
(
$params
[
"page_size"
])
?
15
:
$params
[
"page_size"
];
$pageSize
=
empty
(
$params
[
"page_size"
])
?
15
:
$params
[
"page_size"
];
$agent_id
=
$params
[
"submit_agent_id"
];
$agent_id
=
$params
[
"submit_agent_id"
];
$aService
=
new
VerifyService
();
$aService
=
new
VerifyService
();
$ids
=
$aService
->
getAgentsByAgentId
(
$agent_id
);
$ids
=
$aService
->
getAgentsByAgentId
(
$agent_id
);
$params
[
"ids"
]
=
$ids
;
$params
[
"ids"
]
=
$ids
;
$bargainModel
=
new
OBargainModel
();
$bargainModel
=
new
OBargainModel
();
$filed
=
"a.id,a.father_id,a.house_number,a.commission,a.agent_id,a.create_time,b.user_phone,b.user_name,b.user_id,c.id as order_id,
$filed
=
"a.id,a.father_id,a.house_number,a.commission,a.agent_id,a.create_time,b.user_phone,b.user_name,b.user_id,c.id as order_id,
d.id as house_id,d.internal_title,d.internal_address"
;
d.id as house_id,d.internal_title,d.internal_address"
;
$result
=
$bargainModel
->
selectBargainList
(
$filed
,
$params
,
$pageNo
,
$pageSize
);
$result
=
$bargainModel
->
selectBargainList
(
$filed
,
$params
,
$pageNo
,
$pageSize
);
$list
=
[];
$list
=
[];
foreach
(
$result
as
$k
=>
$v
)
{
foreach
(
$result
as
$k
=>
$v
)
{
$father_id
=
$v
[
"father_id"
];
$father_id
=
$v
[
"father_id"
];
if
(
$father_id
>
0
&&
in_array
(
$father_id
,
$list
))
{
if
(
$father_id
>
0
&&
in_array
(
$father_id
,
$list
))
{
unset
(
$result
[
$k
]);
unset
(
$result
[
$k
]);
}
else
{
}
else
{
$result
[
$k
][
"create_time"
]
=
date
(
"Y-m-d"
,
strtotime
(
$v
[
"create_time"
]));
$result
[
$k
][
"create_time"
]
=
date
(
"Y-m-d"
,
strtotime
(
$v
[
"create_time"
]));
$result
[
$k
][
"id"
]
=
$v
[
"father_id"
]
==
0
?
$v
[
"id"
]
:
$v
[
"father_id"
];
$result
[
$k
][
"id"
]
=
$v
[
"father_id"
]
==
0
?
$v
[
"id"
]
:
$v
[
"father_id"
];
array_push
(
$list
,
$father_id
);
array_push
(
$list
,
$father_id
);
}
}
}
}
...
@@ -961,26 +967,26 @@ class OrderLogService
...
@@ -961,26 +967,26 @@ class OrderLogService
$item
=
$params
[
0
];
$item
=
$params
[
0
];
$role
=
!
empty
(
$params
[
0
][
"role"
])
?
$params
[
0
][
"role"
]
:
$params
[
0
][
"roles"
];
$role
=
!
empty
(
$params
[
0
][
"role"
])
?
$params
[
0
][
"role"
]
:
$params
[
0
][
"roles"
];
$cent_commission
[
"id"
]
=
$item
[
"id"
];
$cent_commission
[
"id"
]
=
$item
[
"id"
];
$cent_commission
[
"agent_id"
]
=
$item
[
"agent_id"
];
$cent_commission
[
"agent_id"
]
=
$item
[
"agent_id"
];
$cent_commission
[
"role"
]
=
!
empty
(
$item
[
"role"
])
?
$item
[
"role"
]
:
$item
[
"roles"
];
$cent_commission
[
"role"
]
=
!
empty
(
$item
[
"role"
])
?
$item
[
"role"
]
:
$item
[
"roles"
];
$cent_commission
[
"scale"
]
=
!
empty
(
$item
[
"scale"
])
?
$item
[
"scale"
]
:
$item
[
"scales"
];
$cent_commission
[
"scale"
]
=
!
empty
(
$item
[
"scale"
])
?
$item
[
"scale"
]
:
$item
[
"scales"
];
$cent_commission
[
"name"
]
=
$item
[
"name"
];
$cent_commission
[
"name"
]
=
$item
[
"name"
];
$cent_commission
[
"phone"
]
=
$item
[
"phone"
];
$cent_commission
[
"phone"
]
=
$item
[
"phone"
];
$cent_commission
[
"should_commission"
]
=
$item
[
"should_commission"
];
$cent_commission
[
"should_commission"
]
=
$item
[
"should_commission"
];
$cent_commission
[
"scale_fee"
]
=
$item
[
"scale_fee"
];
$cent_commission
[
"scale_fee"
]
=
$item
[
"scale_fee"
];
$key
=
0
;
$key
=
0
;
$length
=
count
(
$params
);
$length
=
count
(
$params
);
for
(
$j
=
0
;
$j
<
$length
;
$j
++
)
{
for
(
$j
=
0
;
$j
<
$length
;
$j
++
)
{
$value
=
$params
[
$j
];
$value
=
$params
[
$j
];
if
(
$value
[
"role"
]
==
$role
||
$value
[
"roles"
]
==
$role
)
{
if
(
$value
[
"role"
]
==
$role
||
$value
[
"roles"
]
==
$role
)
{
$arr
[
"real_fee"
]
=
$value
[
"real_fee"
];
$arr
[
"real_fee"
]
=
$value
[
"real_fee"
];
$arr
[
"create_time"
]
=
$value
[
"create_time"
];
$arr
[
"create_time"
]
=
$value
[
"create_time"
];
$arr
[
"confirm_date"
]
=
$value
[
"confirm_date"
];
$arr
[
"confirm_date"
]
=
$value
[
"confirm_date"
];
$arr
[
"charity_fund"
]
=
$value
[
"charity_fund"
];
$arr
[
"charity_fund"
]
=
$value
[
"charity_fund"
];
$arr
[
"cash"
]
=
$value
[
"cash"
];
$arr
[
"cash"
]
=
$value
[
"cash"
];
$arr
[
"practical_fee"
]
=
$value
[
"practical_fee"
];
$arr
[
"practical_fee"
]
=
$value
[
"practical_fee"
];
$arr
[
"service_charge"
]
=
$value
[
"service_charge"
];
$arr
[
"service_charge"
]
=
$value
[
"service_charge"
];
if
(
!
empty
(
$value
[
"real_fee"
])
&&
!
empty
(
$value
[
"create_time"
]))
{
//过滤掉空的
if
(
!
empty
(
$value
[
"real_fee"
])
&&
!
empty
(
$value
[
"create_time"
]))
{
//过滤掉空的
$cent_commission
[
"info"
][
$key
]
=
$arr
;
$cent_commission
[
"info"
][
$key
]
=
$arr
;
...
@@ -1010,12 +1016,12 @@ class OrderLogService
...
@@ -1010,12 +1016,12 @@ class OrderLogService
public
function
getBargainDetail
(
$params
)
:
array
public
function
getBargainDetail
(
$params
)
:
array
{
{
$bargainModel
=
new
OBargainModel
();
$bargainModel
=
new
OBargainModel
();
$bargain_info_filed
=
"a.id,a.house_number,a.account_time,a.account_statement,a.father_id,a.is_open,a.trade_type,
$bargain_info_filed
=
"a.id,a.house_number,a.account_time,a.account_statement,a.father_id,a.is_open,a.trade_type,
a.price,a.industry_type,a.estimated_receipt_date,a.commission,c.id as house_id,c.internal_title,c.internal_address,
a.price,a.industry_type,a.estimated_receipt_date,a.commission,c.id as house_id,c.internal_title,c.internal_address,
d.user_id,d.user_phone,d.user_name"
;
d.user_id,d.user_phone,d.user_name"
;
$result
=
[];
$result
=
[];
$bargainInfo
=
$bargainModel
->
selectBargainDetail
(
$bargain_info_filed
,
$params
);
$bargainInfo
=
$bargainModel
->
selectBargainDetail
(
$bargain_info_filed
,
$params
);
if
(
count
(
$bargainInfo
)
<=
0
)
{
if
(
count
(
$bargainInfo
)
<=
0
)
{
...
@@ -1023,11 +1029,11 @@ class OrderLogService
...
@@ -1023,11 +1029,11 @@ class OrderLogService
}
}
//o_real_income
//o_real_income
$realIncomeModel
=
new
ORealIncome
();
$realIncomeModel
=
new
ORealIncome
();
$realIncomeArr
=
$realIncomeModel
->
getBargainTaxes
(
$params
[
"bargain_id"
]);
$realIncomeArr
=
$realIncomeModel
->
getBargainTaxes
(
$params
[
"bargain_id"
]);
$bargainInfo
[
0
][
"realIncome"
]
=
$realIncomeArr
;
$bargainInfo
[
0
][
"realIncome"
]
=
$realIncomeArr
;
$bargainInfo
[
0
][
"user_phone"
]
=
substr_replace
(
$bargainInfo
[
0
][
"user_phone"
],
'****'
,
3
,
4
);
$bargainInfo
[
0
][
"user_phone"
]
=
substr_replace
(
$bargainInfo
[
0
][
"user_phone"
],
'****'
,
3
,
4
);
$result
[
"bargainInfo"
]
=
$bargainInfo
[
0
];
$result
[
"bargainInfo"
]
=
$bargainInfo
[
0
];
$bargain_id
=
$bargainInfo
[
0
][
"father_id"
]
==
0
?
$bargainInfo
[
0
][
"id"
]
:
$bargainInfo
[
0
][
"father_id"
];
$bargain_id
=
$bargainInfo
[
0
][
"father_id"
]
==
0
?
$bargainInfo
[
0
][
"id"
]
:
$bargainInfo
[
0
][
"father_id"
];
...
@@ -1036,7 +1042,7 @@ class OrderLogService
...
@@ -1036,7 +1042,7 @@ class OrderLogService
$field_commission
=
"a.id,a.agent_id,a.role as roles,a.scale as scales,a.scale_fee,b.role,c.name,c.phone,b.scale,
$field_commission
=
"a.id,a.agent_id,a.role as roles,a.scale as scales,a.scale_fee,b.role,c.name,c.phone,b.scale,
b.should_commission,b.confirm_date,b.create_time,b.real_fee,b.charity_fund,b.cash,b.practical_fee,b.service_charge"
;
b.should_commission,b.confirm_date,b.create_time,b.real_fee,b.charity_fund,b.cash,b.practical_fee,b.service_charge"
;
$cent_commission_arr
=
$bargainModel
->
selectBargainCommission
(
$field_commission
,
[
"bargain_id"
=>
$bargain_id
]);
$cent_commission_arr
=
$bargainModel
->
selectBargainCommission
(
$field_commission
,
[
"bargain_id"
=>
$bargain_id
]);
//dump($cent_commission_arr);
//dump($cent_commission_arr);
$cent_commissions
=
[];
$cent_commissions
=
[];
...
@@ -1046,7 +1052,7 @@ class OrderLogService
...
@@ -1046,7 +1052,7 @@ class OrderLogService
//税费
//税费
$taxesModel
=
new
OTaxes
();
$taxesModel
=
new
OTaxes
();
$fieldTaxes
=
"id,bargain_id,fee,total_fee,father_id,operation_date,agent_id,agent_name,scale,create_time,role"
;
$fieldTaxes
=
"id,bargain_id,fee,total_fee,father_id,operation_date,agent_id,agent_name,scale,create_time,role"
;
$taxesArr
=
$taxesModel
->
getBargainTaxes
(
$bargain_id
,
$fieldTaxes
);
$taxesArr
=
$taxesModel
->
getBargainTaxes
(
$bargain_id
,
$fieldTaxes
);
$taxes_
=
$taxes
=
array
();
$taxes_
=
$taxes
=
array
();
foreach
(
$taxesArr
as
$items
)
{
foreach
(
$taxesArr
as
$items
)
{
...
@@ -1056,14 +1062,14 @@ class OrderLogService
...
@@ -1056,14 +1062,14 @@ class OrderLogService
$z
=
0
;
$z
=
0
;
foreach
(
$taxes_
as
$item
)
{
foreach
(
$taxes_
as
$item
)
{
$taxes
[
$z
][
"operation_date"
]
=
$item
[
0
][
"operation_date"
];
$taxes
[
$z
][
"operation_date"
]
=
$item
[
0
][
"operation_date"
];
$taxes
[
$z
][
"total_fee"
]
=
$item
[
0
][
"total_fee"
];
$taxes
[
$z
][
"total_fee"
]
=
$item
[
0
][
"total_fee"
];
$key
=
0
;
$key
=
0
;
foreach
(
$item
as
$i
=>
$j
)
{
foreach
(
$item
as
$i
=>
$j
)
{
$taxes
[
$z
][
"info"
][
$key
][
"role"
]
=
$j
[
"role"
];
$taxes
[
$z
][
"info"
][
$key
][
"role"
]
=
$j
[
"role"
];
$taxes
[
$z
][
"info"
][
$key
][
"agent_name"
]
=
$j
[
"agent_name"
];
$taxes
[
$z
][
"info"
][
$key
][
"agent_name"
]
=
$j
[
"agent_name"
];
$taxes
[
$z
][
"info"
][
$key
][
"scale"
]
=
$j
[
"scale"
];
$taxes
[
$z
][
"info"
][
$key
][
"scale"
]
=
$j
[
"scale"
];
$taxes
[
$z
][
"info"
][
$key
][
"fee"
]
=
$j
[
"fee"
];
$taxes
[
$z
][
"info"
][
$key
][
"fee"
]
=
$j
[
"fee"
];
$key
++
;
$key
++
;
}
}
$z
++
;
$z
++
;
...
@@ -1084,13 +1090,13 @@ class OrderLogService
...
@@ -1084,13 +1090,13 @@ class OrderLogService
*/
*/
public
function
userUpdateInfo
(
$report_id
)
public
function
userUpdateInfo
(
$report_id
)
{
{
$reportModel
=
new
OReportModel
();
$reportModel
=
new
OReportModel
();
$filed
=
"id,user_id"
;
$filed
=
"id,user_id"
;
$params
[
"id"
]
=
$report_id
;
$params
[
"id"
]
=
$report_id
;
$result
=
$reportModel
->
selectReportById
(
$filed
,
$params
);
$result
=
$reportModel
->
selectReportById
(
$filed
,
$params
);
if
(
count
(
$result
)
>
0
)
{
if
(
count
(
$result
)
>
0
)
{
$Users
=
new
Users
();
$Users
=
new
Users
();
$Users
->
update_user_status
([
'id'
=>
$result
[
0
][
"user_id"
],
'user_status'
=>
1
]);
$Users
->
update_user_status
([
'id'
=>
$result
[
0
][
"user_id"
],
'user_status'
=>
1
]);
}
}
}
}
...
@@ -1102,43 +1108,43 @@ class OrderLogService
...
@@ -1102,43 +1108,43 @@ class OrderLogService
*/
*/
public
function
searchBargainAgents
(
$type
,
$order_id
)
public
function
searchBargainAgents
(
$type
,
$order_id
)
{
{
$orderModel
=
new
OrderModel
();
$orderModel
=
new
OrderModel
();
$field
=
"a.id,a.order_no,a.house_id,a.house_title,b.id as report_id,b.user_id,c.user_nick,c.user_phone,
$field
=
"a.id,a.order_no,a.house_id,a.house_title,b.id as report_id,b.user_id,c.user_nick,c.user_phone,
c.user_pic,c.sex"
;
c.user_pic,c.sex"
;
$where_
[
"order_id"
]
=
$order_id
;
$where_
[
"order_id"
]
=
$order_id
;
$result
=
$orderModel
->
selectOrderDetail
(
$field
,
$where_
);
$result
=
$orderModel
->
selectOrderDetail
(
$field
,
$where_
);
if
(
count
(
$result
)
<=
0
||
$result
[
0
][
"house_id"
]
<=
0
||
$result
[
0
][
"user_id"
]
<=
0
)
{
if
(
count
(
$result
)
<=
0
||
$result
[
0
][
"house_id"
]
<=
0
||
$result
[
0
][
"user_id"
]
<=
0
)
{
return
null
;
return
null
;
}
}
$houseAgents
=
new
GHousesToAgents
();
$houseAgents
=
new
GHousesToAgents
();
$field
=
"b.id,b.phone,b.name"
;
$field
=
"b.id,b.phone,b.name"
;
switch
(
$type
)
{
//1盘方,2客方,3反签,4独家,5合作方
switch
(
$type
)
{
//1盘方,2客方,3反签,4独家,5合作方
case
1
:
case
1
:
$params
[
"a.houses_id"
]
=
$result
[
0
][
"house_id"
];
$params
[
"a.houses_id"
]
=
$result
[
0
][
"house_id"
];
$params
[
"a.type"
]
=
2
;
$params
[
"a.type"
]
=
2
;
$params
[
"a.is_del"
]
=
0
;
$params
[
"a.is_del"
]
=
0
;
$params
[
"b.status"
]
=
0
;
$params
[
"b.status"
]
=
0
;
$list
=
$houseAgents
->
getAgentsByHouseId
(
$field
,
$params
);
$list
=
$houseAgents
->
getAgentsByHouseId
(
$field
,
$params
);
break
;
break
;
case
2
:
case
2
:
$userModel
=
new
Users
();
$userModel
=
new
Users
();
$params
[
"a.id"
]
=
$result
[
0
][
"user_id"
];
$params
[
"a.id"
]
=
$result
[
0
][
"user_id"
];
$params
[
"b.status"
]
=
0
;
$params
[
"b.status"
]
=
0
;
$list
=
$userModel
->
getAgentByUserId
(
$field
,
$params
);
$list
=
$userModel
->
getAgentByUserId
(
$field
,
$params
);
break
;
break
;
case
3
:
//反签 == 报备人
case
3
:
//反签 == 报备人
$reportModel
=
new
OReportModel
();
$reportModel
=
new
OReportModel
();
$params
[
"a.id"
]
=
$result
[
0
][
"report_id"
];
$params
[
"a.id"
]
=
$result
[
0
][
"report_id"
];
$params
[
"b.status"
]
=
0
;
$params
[
"b.status"
]
=
0
;
$list
=
$reportModel
->
getAgentByOrderId
(
$field
,
$params
);
$list
=
$reportModel
->
getAgentByOrderId
(
$field
,
$params
);
break
;
break
;
case
4
:
case
4
:
$params
[
"a.houses_id"
]
=
$result
[
0
][
"house_id"
];
$params
[
"a.houses_id"
]
=
$result
[
0
][
"house_id"
];
$params
[
"a.type"
]
=
3
;
$params
[
"a.type"
]
=
3
;
$params
[
"a.is_del"
]
=
0
;
$params
[
"a.is_del"
]
=
0
;
$params
[
"b.status"
]
=
0
;
$params
[
"b.status"
]
=
0
;
$list
=
$houseAgents
->
getAgentsByHouseId
(
$field
,
$params
);
$list
=
$houseAgents
->
getAgentsByHouseId
(
$field
,
$params
);
break
;
break
;
case
5
:
case
5
:
return
null
;
return
null
;
...
@@ -1147,12 +1153,12 @@ class OrderLogService
...
@@ -1147,12 +1153,12 @@ class OrderLogService
return
null
;
return
null
;
break
;
break
;
case
7
:
case
7
:
$userModel
=
new
Users
();
$userModel
=
new
Users
();
$params
[
"a.id"
]
=
$result
[
0
][
"user_id"
];
$params
[
"a.id"
]
=
$result
[
0
][
"user_id"
];
$params
[
"a.referrer_source"
]
=
20
;
$params
[
"a.referrer_source"
]
=
20
;
$params
[
"a.status"
]
=
0
;
$params
[
"a.status"
]
=
0
;
$params
[
"b.status"
]
=
0
;
$params
[
"b.status"
]
=
0
;
$list
=
$userModel
->
getAgentByReferrer
(
$field
,
$params
);
$list
=
$userModel
->
getAgentByReferrer
(
$field
,
$params
);
break
;
break
;
default
:
default
:
return
null
;
return
null
;
...
@@ -1172,85 +1178,85 @@ class OrderLogService
...
@@ -1172,85 +1178,85 @@ class OrderLogService
*/
*/
public
function
searchBargainAllAgents
(
$order_id
)
public
function
searchBargainAllAgents
(
$order_id
)
{
{
$orderModel
=
new
OrderModel
();
$orderModel
=
new
OrderModel
();
$field
=
"a.id,a.order_no,a.house_id,a.house_title,b.id as report_id,b.user_id,c.user_nick,c.user_phone,
$field
=
"a.id,a.order_no,a.house_id,a.house_title,b.id as report_id,b.user_id,c.user_nick,c.user_phone,
c.user_pic,c.sex"
;
c.user_pic,c.sex"
;
$where_
[
"order_id"
]
=
$order_id
;
$where_
[
"order_id"
]
=
$order_id
;
$result
=
$orderModel
->
selectOrderDetail
(
$field
,
$where_
);
$result
=
$orderModel
->
selectOrderDetail
(
$field
,
$where_
);
if
(
count
(
$result
)
<=
0
||
$result
[
0
][
"house_id"
]
<=
0
||
$result
[
0
][
"user_id"
]
<=
0
)
{
if
(
count
(
$result
)
<=
0
||
$result
[
0
][
"house_id"
]
<=
0
||
$result
[
0
][
"user_id"
]
<=
0
)
{
return
null
;
return
null
;
}
}
$houseAgents
=
new
GHousesToAgents
();
$houseAgents
=
new
GHousesToAgents
();
$field
=
"b.id,b.phone,b.name"
;
$field
=
"b.id,b.phone,b.name"
;
$where_house
[
"a.houses_id"
]
=
$result
[
0
][
"house_id"
];
$where_house
[
"a.houses_id"
]
=
$result
[
0
][
"house_id"
];
$where_house
[
"a.type"
]
=
[
'in'
,
'2,3'
];
$where_house
[
"a.type"
]
=
[
'in'
,
'2,3'
];
$where_house
[
"a.is_del"
]
=
0
;
$where_house
[
"a.is_del"
]
=
0
;
$where_house
[
"b.status"
]
=
0
;
$where_house
[
"b.status"
]
=
0
;
$agent_house
=
$houseAgents
->
getAgentsByHouseId
(
$field
.
',a.type'
,
$where_house
);
$agent_house
=
$houseAgents
->
getAgentsByHouseId
(
$field
.
',a.type'
,
$where_house
);
$list
=
[];
$list
=
[];
$key
=
0
;
$key
=
0
;
//盘方和独家
//盘方和独家
foreach
(
$agent_house
as
$v
)
{
foreach
(
$agent_house
as
$v
)
{
$list
[
$key
][
'id'
]
=
$v
[
'id'
];
$list
[
$key
][
'id'
]
=
$v
[
'id'
];
$list
[
$key
][
'phone'
]
=
$v
[
'phone'
];
$list
[
$key
][
'phone'
]
=
$v
[
'phone'
];
$list
[
$key
][
'name'
]
=
$v
[
'name'
];
$list
[
$key
][
'name'
]
=
$v
[
'name'
];
if
(
$v
[
'type'
]
==
2
)
{
if
(
$v
[
'type'
]
==
2
)
{
$list
[
$key
][
'role'
]
=
1
;
$list
[
$key
][
'role'
]
=
1
;
$list
[
$key
][
'role_name'
]
=
'盘方'
;
$list
[
$key
][
'role_name'
]
=
'盘方'
;
}
else
{
}
else
{
$list
[
$key
][
'role'
]
=
4
;
$list
[
$key
][
'role'
]
=
4
;
$list
[
$key
][
'role_name'
]
=
'独家'
;
$list
[
$key
][
'role_name'
]
=
'独家'
;
}
}
$key
++
;
$key
++
;
}
}
$userModel
=
new
Users
();
$userModel
=
new
Users
();
$where_user
[
"a.id"
]
=
$result
[
0
][
"user_id"
];
$where_user
[
"a.id"
]
=
$result
[
0
][
"user_id"
];
$where_user
[
"b.status"
]
=
0
;
$where_user
[
"b.status"
]
=
0
;
$user_data
=
$userModel
->
getAgentByUserId
(
$field
,
$where_user
);
$user_data
=
$userModel
->
getAgentByUserId
(
$field
,
$where_user
);
//客方
//客方
if
(
isset
(
$user_data
[
0
][
'id'
]))
{
if
(
isset
(
$user_data
[
0
][
'id'
]))
{
$list
[
$key
][
'id'
]
=
$user_data
[
0
][
'id'
];
$list
[
$key
][
'id'
]
=
$user_data
[
0
][
'id'
];
$list
[
$key
][
'phone'
]
=
$user_data
[
0
][
'phone'
];
$list
[
$key
][
'phone'
]
=
$user_data
[
0
][
'phone'
];
$list
[
$key
][
'name'
]
=
$user_data
[
0
][
'name'
];
$list
[
$key
][
'name'
]
=
$user_data
[
0
][
'name'
];
$list
[
$key
][
'role'
]
=
2
;
$list
[
$key
][
'role'
]
=
2
;
$list
[
$key
][
'role_name'
]
=
'客方'
;
$list
[
$key
][
'role_name'
]
=
'客方'
;
$key
++
;
$key
++
;
}
}
$reportModel
=
new
OReportModel
();
$reportModel
=
new
OReportModel
();
$params
[
"a.id"
]
=
$result
[
0
][
"report_id"
];
$params
[
"a.id"
]
=
$result
[
0
][
"report_id"
];
$params
[
"b.status"
]
=
0
;
$params
[
"b.status"
]
=
0
;
$report_data
=
$reportModel
->
getAgentByOrderId
(
$field
,
$params
);
$report_data
=
$reportModel
->
getAgentByOrderId
(
$field
,
$params
);
//反签
//反签
if
(
isset
(
$report_data
[
0
][
'id'
]))
{
if
(
isset
(
$report_data
[
0
][
'id'
]))
{
$list
[
$key
][
'id'
]
=
$report_data
[
0
][
'id'
];
$list
[
$key
][
'id'
]
=
$report_data
[
0
][
'id'
];
$list
[
$key
][
'phone'
]
=
$report_data
[
0
][
'phone'
];
$list
[
$key
][
'phone'
]
=
$report_data
[
0
][
'phone'
];
$list
[
$key
][
'name'
]
=
$report_data
[
0
][
'name'
];
$list
[
$key
][
'name'
]
=
$report_data
[
0
][
'name'
];
$list
[
$key
][
'role'
]
=
3
;
$list
[
$key
][
'role'
]
=
3
;
$list
[
$key
][
'role_name'
]
=
'反签'
;
$list
[
$key
][
'role_name'
]
=
'反签'
;
$key
++
;
$key
++
;
}
}
$params
[
"a.id"
]
=
$result
[
0
][
"user_id"
];
$params
[
"a.id"
]
=
$result
[
0
][
"user_id"
];
$params
[
"a.referrer_source"
]
=
20
;
$params
[
"a.referrer_source"
]
=
20
;
$params
[
"a.status"
]
=
0
;
$params
[
"a.status"
]
=
0
;
$params
[
"b.status"
]
=
0
;
$params
[
"b.status"
]
=
0
;
$referrer
=
$userModel
->
getAgentByReferrer
(
$field
,
$params
);
$referrer
=
$userModel
->
getAgentByReferrer
(
$field
,
$params
);
if
(
$referrer
[
0
][
'id'
])
{
if
(
$referrer
[
0
][
'id'
])
{
$list
[
$key
][
'id'
]
=
$referrer
[
0
][
'id'
];
$list
[
$key
][
'id'
]
=
$referrer
[
0
][
'id'
];
$list
[
$key
][
'phone'
]
=
$referrer
[
0
][
'phone'
];
$list
[
$key
][
'phone'
]
=
$referrer
[
0
][
'phone'
];
$list
[
$key
][
'name'
]
=
$referrer
[
0
][
'name'
];
$list
[
$key
][
'name'
]
=
$referrer
[
0
][
'name'
];
$list
[
$key
][
'role'
]
=
7
;
$list
[
$key
][
'role'
]
=
7
;
$list
[
$key
][
'role_name'
]
=
'APP客下载方'
;
$list
[
$key
][
'role_name'
]
=
'APP客下载方'
;
}
}
...
@@ -1264,7 +1270,7 @@ class OrderLogService
...
@@ -1264,7 +1270,7 @@ class OrderLogService
public
function
getBillInfo
(
$order_id
)
public
function
getBillInfo
(
$order_id
)
{
{
$filed
=
"house_number,industry_type"
;
$filed
=
"house_number,industry_type"
;
return
$this
->
payLogModel
->
getBeforeBillInfo
(
$filed
,
[
"order_id"
=>
$order_id
]);
return
$this
->
payLogModel
->
getBeforeBillInfo
(
$filed
,
[
"order_id"
=>
$order_id
]);
}
}
...
@@ -1278,9 +1284,9 @@ class OrderLogService
...
@@ -1278,9 +1284,9 @@ class OrderLogService
*/
*/
public
function
updateBillInfo
(
$id
,
$trade_no
,
$pay_time
,
$real_money
)
public
function
updateBillInfo
(
$id
,
$trade_no
,
$pay_time
,
$real_money
)
{
{
$params
[
"id"
]
=
$id
;
$params
[
"id"
]
=
$id
;
$params
[
"trade_no"
]
=
$trade_no
;
$params
[
"trade_no"
]
=
$trade_no
;
$params
[
"pay_time"
]
=
date
(
"Y-m-d H:i:s"
,
$pay_time
);
$params
[
"pay_time"
]
=
date
(
"Y-m-d H:i:s"
,
$pay_time
);
$params
[
"real_money"
]
=
$real_money
;
$params
[
"real_money"
]
=
$real_money
;
return
$this
->
payLogModel
->
updatePayLog
(
$params
);
return
$this
->
payLogModel
->
updatePayLog
(
$params
);
...
...
application/model/OrderModel.php
View file @
d1a07866
...
@@ -106,10 +106,14 @@ class OrderModel extends Model
...
@@ -106,10 +106,14 @@ class OrderModel extends Model
}
}
/**
/**
* @param $field
* @param $field
* @param $params
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @param $where_
* @return mixed
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
*/
public
function
searchOrder
(
$field
,
$params
,
$where_
)
public
function
searchOrder
(
$field
,
$params
,
$where_
)
{
{
...
...
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