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
bc9d4462
Commit
bc9d4462
authored
Mar 23, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
我的成单bug
parent
75ff65cc
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
267 additions
and
189 deletions
+267
-189
OrderLog.php
application/api_broker/controller/OrderLog.php
+82
-76
Performance.php
application/api_broker/controller/Performance.php
+2
-2
Statement.php
application/api_broker/controller/Statement.php
+2
-2
Basic.php
application/api_broker/extend/Basic.php
+1
-1
AgentVerifyService.php
application/api_broker/service/AgentVerifyService.php
+53
-0
OrderLogService.php
application/api_broker/service/OrderLogService.php
+116
-103
OBargainModel.php
application/model/OBargainModel.php
+11
-5
No files found.
application/api_broker/controller/OrderLog.php
View file @
bc9d4462
...
...
@@ -46,15 +46,15 @@ class OrderLog extends Basic
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
/* $params = array(
"reception_id" => 1,//带看经纪人id
"report_id" => 1,//报备id
"order_id" =>1, //关联order表id
"order_no" =>"123123123123123", //订单no
"march_in_remark" =>"有意向购买", //进场备注
"march_in_img" =>"123123", //备注图片
"march_in_area" =>"上海市虹口区中山公园", //进场地址
);*/
/* $params = array(
"reception_id" => 1,//带看经纪人id
"report_id" => 1,//报备id
"order_id" =>1, //关联order表id
"order_no" =>"123123123123123", //订单no
"march_in_remark" =>"有意向购买", //进场备注
"march_in_img" =>"123123", //备注图片
"march_in_area" =>"上海市虹口区中山公园", //进场地址
);*/
// $params["reception_id"] = $this->agentName;
...
...
@@ -78,24 +78,24 @@ class OrderLog extends Basic
||
!
isset
(
$params
[
"collecting_bill"
])
||
!
isset
(
$params
[
"house_number"
])
||
!
isset
(
$params
[
"industry_type"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
/* $params = array(
"agent_id" => 1,//收款经纪人id
"report_id" => 111,//报备id
"order_id" => 2, //关联order表id
"order_no" => "123123123", //订单no
// `type` '付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他',
//`pay_type` '支付方式 10支付宝 20 微信 30pos机器 40转账 50现金',
// `money` '入账金额 存分',
"collecting_bill" => [ { "type" : 10, "pay_type" : 10, "money" : 1100 }, { "type" :10, "pay_type" : 10, "money": 1200 } ],
"house_number" => "3301号",
"industry_type" => "asdasdasd",
"remark" => "没什么备注",
"transfer_img" => "12312312312"
);*/
/* $params = array(
"agent_id" => 1,//收款经纪人id
"report_id" => 111,//报备id
"order_id" => 2, //关联order表id
"order_no" => "123123123", //订单no
// `type` '付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他',
//`pay_type` '支付方式 10支付宝 20 微信 30pos机器 40转账 50现金',
// `money` '入账金额 存分',
"collecting_bill" => [ { "type" : 10, "pay_type" : 10, "money" : 1100 }, { "type" :10, "pay_type" : 10, "money": 1200 } ],
"house_number" => "3301号",
"industry_type" => "asdasdasd",
"remark" => "没什么备注",
"transfer_img" => "12312312312"
);*/
$params
[
"collecting_bill"
]
=
json_decode
(
$params
[
"collecting_bill"
],
true
);
$params
[
"collecting_bill"
]
=
json_decode
(
$params
[
"collecting_bill"
],
true
);
$remark
=
isset
(
$params
[
"remark"
])
?
$params
[
"remark"
]
:
""
;
$transfer_img
=
isset
(
$params
[
"transfer_img"
])
?
$params
[
"transfer_img"
]
:
""
;
...
...
@@ -154,26 +154,26 @@ class OrderLog extends Basic
||
!
isset
(
$params
[
"commission_arr"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
/* $params = array(
"submit_agent_id" => 1,//申请经纪人id
"report_id" => 1,//报备id
"order_id" => 1, //关联order表id
"order_no" => "123123123", //订单no
"trade_type" => 10, //成交类型 10出租 20 增佣 30 代理 40 好处费
"price" => 112131, //成交价格 存分
"commission" => 111, //佣金 存分
//`role` '分佣方 1盘方 2客方 3 反签 4独家 5合作方',
//`agent_id`'分佣经纪人id',
//`scale`'分佣比例 如 5表示百分之5',
// `scale_fee` '应分佣金 存分 ',
"commission_arr" => [ [ "role" => 10, "agent_id" => 10, "scale" => 10, "scale_fee" => 1222 ],
[ "role" => 11, "agent_id" => 12, "scale" => 13, "scale_fee" => 1112 ] ],
);*/
/* $params = array(
"submit_agent_id" => 1,//申请经纪人id
"report_id" => 1,//报备id
"order_id" => 1, //关联order表id
"order_no" => "123123123", //订单no
"trade_type" => 10, //成交类型 10出租 20 增佣 30 代理 40 好处费
"price" => 112131, //成交价格 存分
"commission" => 111, //佣金 存分
//`role` '分佣方 1盘方 2客方 3 反签 4独家 5合作方',
//`agent_id`'分佣经纪人id',
//`scale`'分佣比例 如 5表示百分之5',
// `scale_fee` '应分佣金 存分 ',
$params
[
"commission_arr"
]
=
json_decode
(
$params
[
"commission_arr"
],
true
);
"commission_arr" => [ [ "role" => 10, "agent_id" => 10, "scale" => 10, "scale_fee" => 1222 ],
[ "role" => 11, "agent_id" => 12, "scale" => 13, "scale_fee" => 1112 ] ],
);*/
$params
[
"commission_arr"
]
=
json_decode
(
$params
[
"commission_arr"
],
true
);
$is_ok
=
$this
->
service_
->
addBargain
(
$params
[
"submit_agent_id"
],
$params
[
"report_id"
],
$params
[
"order_id"
],
$params
[
"order_no"
],
$params
[
"trade_type"
],
$params
[
"price"
],
$params
[
"commission"
],
$params
[
"commission_arr"
]);
...
...
@@ -269,11 +269,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" => "14444"
);*/
if
(
!
isset
(
$params
[
"type"
])
||
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"search_keyword"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
...
...
@@ -293,16 +293,17 @@ class OrderLog extends Basic
* 我的成交
* @return \think\Response
*/
public
function
bargainList
(){
public
function
bargainList
()
{
$params
=
$this
->
params
;
/*
$params = array(
/*
$params = array(
"submit_agent_id" => 1,
"status" => 10,
"page_no" => 1,
"page_size"
=>
15
"status"
=> 10,
"page_no"
=> 1,
"page_size"
=>
15
);*/
if
(
!
isset
(
$params
[
"submit_agent_id"
])
||
!
isset
(
$params
[
"status"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
if
(
!
isset
(
$params
[
"submit_agent_id"
])
||
!
isset
(
$params
[
"status"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
try
{
...
...
@@ -321,20 +322,21 @@ class OrderLog extends Basic
* 成交报告详情
* @return \think\Response
*/
public
function
bargainDetail
(){
public
function
bargainDetail
()
{
$params
=
$this
->
params
;
/* $params = array(
"bargain_id" => 6,
"house_id" => 1,
"house_title"=> "wwww",
"internal_address" =>"ewewerwer",
"user_id" => 1,
"user_name" =>"nihhkkk",
"user_phone"=>"123****3333"
);*/
if
(
!
isset
(
$params
[
"bargain_id"
])
||!
isset
(
$params
[
"house_id"
])
||!
isset
(
$params
[
"house_title"
])
||
!
isset
(
$params
[
"internal_address"
])
||!
isset
(
$params
[
"user_id"
])
||!
isset
(
$params
[
"user_name"
])
||!
isset
(
$params
[
"user_phone"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
/* $params = array(
"bargain_id" => 6,
"house_id" => 1,
"house_title"=> "wwww",
"internal_address" =>"ewewerwer",
"user_id" => 1,
"user_name" =>"nihhkkk",
"user_phone"=>"123****3333"
);*/
if
(
!
isset
(
$params
[
"bargain_id"
])
||
!
isset
(
$params
[
"house_id"
])
||
!
isset
(
$params
[
"house_title"
])
||
!
isset
(
$params
[
"internal_address"
])
||
!
isset
(
$params
[
"user_id"
])
||
!
isset
(
$params
[
"user_name"
])
||
!
isset
(
$params
[
"user_phone"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
try
{
...
...
@@ -353,18 +355,22 @@ class OrderLog extends Basic
/**
* @return \think\Response
*/
public
function
searchAgents
(){
public
function
searchAgents
()
{
$params
=
$this
->
params
;
/* $params = array(
"keyword" => "138"
/* $params = array(
"submit_agent_id" => 1,
"keyword" => "138",
"page_no" => 1,
"page_size" => 15
);*/
if
(
!
isset
(
$params
[
"keyword"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
if
(
!
isset
(
$params
[
"submit_agent_id"
])
||
!
isset
(
$params
[
"keyword"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
try
{
$result
=
$this
->
service_
->
searchAgents
(
$params
[
"keyword"
]
);
$result
=
$this
->
service_
->
getBargainList
(
$params
);
if
(
count
(
$result
)
>
0
)
{
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
else
{
...
...
application/api_broker/controller/Performance.php
View file @
bc9d4462
...
...
@@ -30,10 +30,10 @@ class Performance extends Basic{
*/
public
function
selectPerformanceByTime
(){
$params
=
$this
->
params
;
$params
=
array
(
/*
$params = array(
"agent_id" => 1,
"type" => 1, //1表示个人业绩排行 2门店 3区域
);
);
*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"type"
])){
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
...
...
application/api_broker/controller/Statement.php
View file @
bc9d4462
...
...
@@ -62,14 +62,14 @@ class Statement extends Basic
}
$img_title
=
""
;
$img
=
""
;
$img
=
""
;
//单图
$base64_image_content
=
$this
->
params
[
"img"
];
if
(
preg_match
(
'/^(data:\s*image\/(\w+);base64,)/'
,
$base64_image_content
,
$array
))
{
$img_title
=
$array
[
2
];
//jpeg
$img
=
base64_decode
(
str_replace
(
$array
[
1
],
''
,
$base64_image_content
));
//返回文件流
$img
=
base64_decode
(
str_replace
(
$array
[
1
],
''
,
$base64_image_content
));
//返回文件流
}
$tmp_file
=
time
();
...
...
application/api_broker/extend/Basic.php
View file @
bc9d4462
...
...
@@ -80,7 +80,7 @@ class Basic extends Controller
$requestPath
=
$this
->
request
->
routeInfo
()[
"rule"
][
0
]
.
"/"
.
$this
->
request
->
routeInfo
()[
"rule"
][
1
];
//过滤掉不需要验证token的接口
if
(
!
in_array
(
trim
(
$requestPath
),
$this
->
filterVerify
))
{
$this
->
tokenVerify
();
//
$this->tokenVerify();
}
unset
(
$this
->
params
[
"AuthToken"
]);
}
...
...
application/api_broker/service/AgentVerifyService.php
0 → 100644
View file @
bc9d4462
<?php
namespace
app\api_broker\service
;
use
app\model\AAgents
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/3/23
* Time : 14:11
* Intro:
*/
class
AgentVerifyService
{
private
$agentModel
;
public
function
__construct
()
{
$this
->
agentModel
=
new
AAgents
();
}
public
function
getAgentsByAgentId
(
$agent_id
)
{
$params
[
"id"
]
=
$agent_id
;
$result
=
$this
->
agentModel
->
searchAgentsByKeyword
(
"id,store_id,district_id,level"
,
$params
);
if
(
count
(
$result
)
>
0
)
{
$arr_list
=
[];
switch
(
$result
[
0
][
"level"
])
{
case
10
:
return
$result
[
0
][
"id"
];
case
20
:
$arr_list
=
$this
->
agentModel
->
searchAgentsByKeyword
(
"id"
,
[
"store_id"
=>
$result
[
0
][
"store_id"
]
]);
break
;
case
30
:
case
40
:
$arr_list
=
$this
->
agentModel
->
searchAgentsByKeyword
(
"id"
,
[
"district_id"
=>
$result
[
0
][
"district_id"
]
]);
break
;
}
$ids
=
""
;
if
(
count
(
$arr_list
)
>
0
){
foreach
(
$arr_list
as
$item
)
{
$ids
.=
$item
[
"id"
]
.
","
;
}
}
$ids
=
rtrim
(
$ids
,
","
);
return
$ids
;
}
return
null
;
}
}
\ No newline at end of file
application/api_broker/service/OrderLogService.php
View file @
bc9d4462
...
...
@@ -46,16 +46,16 @@ class OrderLogService
public
function
addCollectingBill
(
$agent_id
,
$report_id
,
$order_id
,
$order_no
,
$collecting_bill
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
)
{
$bill_arr
=
[];
$bill_arr
=
[];
$father_id
=
0
;
foreach
(
$collecting_bill
as
$collecting
)
{
if
(
isset
(
$collecting
[
"type"
])
&&
isset
(
$collecting
[
"pay_type"
])
&&
isset
(
$collecting
[
"money"
]))
{
if
(
$father_id
==
0
)
{
$params
=
$this
->
collectingBillBin
(
$father_id
,
$collecting
,
$agent_id
,
$report_id
,
$order_id
,
$order_no
,
if
(
$father_id
==
0
)
{
$params
=
$this
->
collectingBillBin
(
$father_id
,
$collecting
,
$agent_id
,
$report_id
,
$order_id
,
$order_no
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
);
$father_id
=
$this
->
payLogModel
->
insertPayLog
(
$params
);
}
else
{
array_push
(
$bill_arr
,
$this
->
collectingBillBin
(
$father_id
,
$collecting
,
$agent_id
,
$report_id
,
$order_id
,
$order_no
,
}
else
{
array_push
(
$bill_arr
,
$this
->
collectingBillBin
(
$father_id
,
$collecting
,
$agent_id
,
$report_id
,
$order_id
,
$order_no
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
));
}
}
...
...
@@ -67,7 +67,7 @@ class OrderLogService
return
$father_id
;
}
private
function
collectingBillBin
(
$father_id
,
$collecting_arr
,
$agent_id
,
$report_id
,
$order_id
,
$order_no
,
$house_number
,
private
function
collectingBillBin
(
$father_id
,
$collecting_arr
,
$agent_id
,
$report_id
,
$order_id
,
$order_no
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
)
{
...
...
@@ -104,16 +104,16 @@ class OrderLogService
public
function
addBargain
(
$submit_agent_id
,
$report_id
,
$order_id
,
$order_no
,
$trade_type
,
$price
,
$commission
,
$commission_arr
)
{
$bargain_arr
=
[];
$father_id
=
0
;
$father_id
=
0
;
foreach
(
$commission_arr
as
$commission_val
)
{
if
(
isset
(
$commission_val
[
"role"
])
&&
isset
(
$commission_val
[
"agent_id"
])
&&
isset
(
$commission_val
[
"scale"
])
&&
isset
(
$commission_val
[
"scale_fee"
]))
{
if
(
$father_id
==
0
)
{
$params
=
$this
->
bargainBin
(
$father_id
,
$commission_val
,
$submit_agent_id
,
$report_id
,
$order_id
,
if
(
$father_id
==
0
)
{
$params
=
$this
->
bargainBin
(
$father_id
,
$commission_val
,
$submit_agent_id
,
$report_id
,
$order_id
,
$order_no
,
$trade_type
,
$price
,
$commission
);
$father_id
=
$this
->
bargainModel
->
insertBargain
(
$params
);
}
else
{
array_push
(
$bargain_arr
,
$this
->
bargainBin
(
$father_id
,
$commission_val
,
$submit_agent_id
,
$report_id
,
}
else
{
array_push
(
$bargain_arr
,
$this
->
bargainBin
(
$father_id
,
$commission_val
,
$submit_agent_id
,
$report_id
,
$order_id
,
$order_no
,
$trade_type
,
$price
,
$commission
));
}
...
...
@@ -126,7 +126,7 @@ class OrderLogService
return
$father_id
;
}
private
function
bargainBin
(
$father_id
,
$commission_val
,
$submit_agent_id
,
$report_id
,
$order_id
,
$order_no
,
$trade_type
,
$price
,
$commission
)
private
function
bargainBin
(
$father_id
,
$commission_val
,
$submit_agent_id
,
$report_id
,
$order_id
,
$order_no
,
$trade_type
,
$price
,
$commission
)
{
$arr
[
"report_id"
]
=
$report_id
;
$arr
[
"father_id"
]
=
$father_id
;
...
...
@@ -150,12 +150,13 @@ class OrderLogService
* @param $where_
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
selectOrderDetail
(
$where_
){
public
function
selectOrderDetail
(
$where_
)
{
$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"
;
$result
=
$orderModel
->
selectOrderDetail
(
$field
,
$where_
);
foreach
(
$result
as
$k
=>
$v
)
{
$result
=
$orderModel
->
selectOrderDetail
(
$field
,
$where_
);
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_pic"
]
=
HEADERIMGURL
.
$v
[
"user_pic"
];
}
...
...
@@ -170,7 +171,7 @@ class OrderLogService
public
function
selectListByOrderNo
(
$order_id
)
{
$result
=
[];
$sort
=
0
;
$sort
=
0
;
//todo 1.验证订单是否存在
$orderModel
=
new
OrderModel
();
...
...
@@ -195,16 +196,16 @@ class OrderLogService
return
[
"101"
,
"报备记录未找到"
];
}
//报备
$reportData
[
0
][
"step_name"
]
=
"report"
;
$reportData
[
0
][
"step_name"
]
=
"report"
;
$reportData
[
0
][
"house_title"
]
=
$orderData
[
0
][
"house_title"
];
$result
[
$sort
++
]
=
$reportData
[
0
];
$result
[
$sort
++
]
=
$reportData
[
0
];
//进场 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"
;
$marchInData
=
$oMarchInModel
->
selectMarchInByOrderNo
(
$field_march_in
,
[
"order_id"
=>
$order_id
]);
if
(
count
(
$marchInData
)
>
0
)
{
foreach
(
$marchInData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"march_in"
;
foreach
(
$marchInData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"march_in"
;
$result
[
$sort
++
]
=
$v
;
}
}
...
...
@@ -213,10 +214,10 @@ class OrderLogService
district,business_area,explain,explain_img,create_time"
;
$followUpLogData
=
$followUpLogModel
->
selectFollowUpListByReportId
(
$field_follow_up
,
[
"report_id"
=>
$report_id
]);
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"
;
$result
[
$sort
++
]
=
$v
;
}
}
...
...
@@ -226,8 +227,8 @@ class OrderLogService
remark,transfer_img,create_time"
;
$payLogData
=
$oPayLogModel
->
selectPayLogByOrderNo
(
$field_pay_log
,
[
"order_id"
=>
$order_id
]);
if
(
count
(
$payLogData
)
>
0
)
{
foreach
(
$payLogData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"pay_log"
;
foreach
(
$payLogData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"pay_log"
;
$result
[
$sort
++
]
=
$v
;
}
}
...
...
@@ -237,8 +238,8 @@ class OrderLogService
remark,remark_img,create_time"
;
$refundData
=
$oRefundModel
->
selectRefundByOrderNo
(
$field_refund
,
[
"order_id"
=>
$order_id
]);
if
(
count
(
$refundData
)
>
0
)
{
foreach
(
$refundData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"refund"
;
foreach
(
$refundData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"refund"
;
$result
[
$sort
++
]
=
$v
;
}
}
...
...
@@ -248,8 +249,8 @@ class OrderLogService
scale_fee,create_time"
;
$bargainData
=
$oBargainModel
->
selectBargainByOrderNo
(
$field_bargain
,
[
"order_id"
=>
$order_id
]);
if
(
count
(
$bargainData
)
>
0
)
{
foreach
(
$bargainData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"bargain"
;
foreach
(
$bargainData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"bargain"
;
$result
[
$sort
++
]
=
$v
;
}
}
...
...
@@ -264,10 +265,10 @@ class OrderLogService
*/
private
function
sortByTime
(
$result
)
{
for
(
$i
=
0
;
$i
<
count
(
$result
);
$i
++
)
{
for
(
$j
=
$i
+
1
;
$j
<
count
(
$result
)
;
$j
++
)
{
if
(
strtotime
(
$result
[
$j
][
"create_time"
])
-
strtotime
(
$result
[
$i
][
"create_time"
])
>
0
)
{
$temp
=
$result
[
$j
];
for
(
$i
=
0
;
$i
<
count
(
$result
);
$i
++
)
{
for
(
$j
=
$i
+
1
;
$j
<
count
(
$result
);
$j
++
)
{
if
(
strtotime
(
$result
[
$j
][
"create_time"
])
-
strtotime
(
$result
[
$i
][
"create_time"
])
>
0
)
{
$temp
=
$result
[
$j
];
$result
[
$j
]
=
$result
[
$i
];
$result
[
$i
]
=
$temp
;
}
...
...
@@ -280,64 +281,65 @@ class OrderLogService
* @param $params 1.客户姓名 2.报备人电话 3.报备人姓名 4.商铺名称 5.商铺地址
* @return array|false|\PDOStatement|string|\think\Collection
*/
public
function
getSearchOrder
(
$params
){
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,
$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'
])
.
"%"
);
break
;
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
:
//todo 列表没有显示商铺地址 和产品沟通暂时搁置
//$condition["c.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
=
""
;
if
(
count
(
$result
)
<=
0
)
{
return
null
;
}
else
{
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
;
}
switch
((
int
)
$params
[
"type"
])
{
case
0
:
$condition
[
"b.user_phone"
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'search_keyword'
])
.
"%"
);
break
;
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
:
//todo 列表没有显示商铺地址 和产品沟通暂时搁置
//$condition["c.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
=
""
;
if
(
count
(
$result
)
<=
0
)
{
return
null
;
}
else
{
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
;
}
}
/**
...
...
@@ -345,17 +347,24 @@ class OrderLogService
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
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"
];
$agent_id
=
$params
[
"submit_agent_id"
];
$aService
=
new
AgentVerifyService
();
$ids
=
$aService
->
getAgentsByAgentId
(
$agent_id
);
$params
[
"ids"
]
=
$ids
;
$bargainModel
=
new
OBargainModel
();
$filed
=
"a.
id,a.create_time,b.user_phone,b.user_name,b.user_id,d.id as house_id,d.internal_title,d.internal_address"
;
$result
=
$bargainModel
->
selectBargainList
(
$filed
,
$params
,
$pageNo
,
$pageSize
);
foreach
(
$result
as
$k
=>
$v
)
{
$filed
=
"a.id,a.agent_
id,a.create_time,b.user_phone,b.user_name,b.user_id,d.id as house_id,d.internal_title,d.internal_address"
;
$result
=
$bargainModel
->
selectBargainList
(
$filed
,
$params
,
$pageNo
,
$pageSize
);
foreach
(
$result
as
$k
=>
$v
)
{
//$result[$k]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/','$1****$2',$v["user_phone"]);
$result
[
$k
][
"create_time"
]
=
date
(
"Y-m-d"
,
strtotime
(
$v
[
"create_time"
]));
$result
[
$k
][
"create_time"
]
=
date
(
"Y-m-d"
,
strtotime
(
$v
[
"create_time"
]));
}
return
$result
;
...
...
@@ -367,12 +376,13 @@ class OrderLogService
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getBargainDetail
(
$params
){
public
function
getBargainDetail
(
$params
)
{
$bargainModel
=
new
OBargainModel
();
$filed
=
"a.id,a.trade_type,a.price,a.submit_agent_id,a.commission,a.role,a.agent_id,a.scale,a.scale_fee,a.status,
$filed
=
"a.id,a.trade_type,a.price,a.submit_agent_id,a.commission,a.role,a.agent_id,a.scale,a.scale_fee,a.status,
b.name,b.phone"
;
return
$bargainModel
->
selectBargainDetail
(
$filed
,
$params
);
return
$bargainModel
->
selectBargainDetail
(
$filed
,
$params
);
}
...
...
@@ -381,15 +391,17 @@ class OrderLogService
* @param $keyWord
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
searchAgents
(
$keyWord
){
$params
[
"phone|name"
]
=
array
(
"like"
,
"%
$keyWord
%"
);
/* public function searchAgents($agent_id, $keyWord)
{
$params["a.phone|a.name|b."] = array( "like", "%$keyWord%" );
$field
=
"id,store_id,auth_group_id,district_id,level,name,phone"
;
//$field = "id,store_id,auth_group_id,district_id,level,name,phone";
$filed = "a.id,a.create_time,b.user_phone,b.user_name,b.user_id,d.id as house_id,d.internal_title,d.internal_address";
$agentModel = new AAgents();
return
$agentModel
->
searchAgentsByKeyword
(
$field
,
$params
);
return $agentModel->searchAgentsByKeyword($field,
$params);
}
}
*/
}
\ No newline at end of file
application/model/OBargainModel.php
View file @
bc9d4462
...
...
@@ -114,16 +114,20 @@ class OBargainModel extends Model
*/
public
function
selectBargainList
(
$filed
,
$params
,
$pageNo
,
$pageSize
){
$where_
=
[];
if
(
isset
(
$params
[
"submit_agent_id"
]))
{
$where_
[
"a.submit_agent_id"
]
=
$params
[
"submit_agent_id"
];
}
if
(
isset
(
$params
[
"status"
]))
{
$where_
[
"a.status"
]
=
$params
[
"status"
];
}
$where_
[
"a.father_id"
]
=
0
;
if
(
isset
(
$params
[
"ids"
]))
{
$where_
[
"a.agent_id"
]
=
array
(
"in"
,
$params
[
"ids"
]);
}
if
(
isset
(
$params
[
"keyword"
]))
{
$where_
[
"b.user_phone|b.user_name|d.internal_address"
]
=
array
(
"like"
,
"%"
.
$params
[
"keyword"
]
.
"%"
)
;
}
$where_
[
"b.status"
]
=
0
;
$where_
[
"c.is_del"
]
=
0
;
return
$this
->
db_
$result
=
$this
->
db_
->
field
(
$filed
)
->
alias
(
"a"
)
->
join
(
"o_report b"
,
"a.report_id = b.id"
,
"left"
)
...
...
@@ -134,6 +138,8 @@ class OBargainModel extends Model
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
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