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
b5f2f855
Commit
b5f2f855
authored
Jun 10, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
007c4105
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1675 additions
and
21 deletions
+1675
-21
OfficePerformance.php
application/api_broker/controller/OfficePerformance.php
+688
-0
OfficePerformanceService.php
application/api_broker/service/OfficePerformanceService.php
+955
-0
OfficeGRoomToAgent.php
application/model/OfficeGRoomToAgent.php
+9
-0
route.php
application/route.php
+23
-21
No files found.
application/api_broker/controller/OfficePerformance.php
0 → 100644
View file @
b5f2f855
<?php
namespace
app\api_broker\controller
;
use
app\api_broker\extend\Basic
;
use
app\api_broker\service\OfficePerformanceService
;
use
app\api_broker\service\PerformanceService
;
use
Think\Exception
;
use
think\Log
;
use
think\Request
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/3/20
* Time : 下午2:06
* Intro: 业绩模块
*/
class
OfficePerformance
extends
Basic
{
private
$service_
;
function
__construct
(
Request
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
service_
=
new
OfficePerformanceService
();
}
/**
* 业绩汇总,
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
selectPerformanceByTime
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 80,
"type" => 3, //1表示个人业绩排行 2门店 3区域
"end_day" => "",
"start_day" =>""
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"type"
])
||
!
isset
(
$params
[
"site_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
//默认排序一周 2018-07-18改为本月
$end_day
=
!
empty
(
$params
[
"end_day"
])
?
$params
[
"end_day"
]
:
date
(
"Y-m-d"
,
time
());
$start_day
=
!
empty
(
$params
[
"start_day"
])
?
$params
[
"start_day"
]
:
date
(
"Y-m-01"
,
time
());
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"agent_id"
],
$params
[
"type"
],
$start_day
,
$end_day
,
$params
[
"site_id"
]);
if
(
count
(
$list
)
>
0
)
{
$result
[
"list"
]
=
$list
;
$result
[
"start_time"
]
=
$start_day
;
$result
[
"end_time"
]
=
$end_day
;
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
return
$this
->
response
(
"200"
,
"request null"
);
}
/**
* 个人业绩
* @return \think\Response
*/
public
function
agentPerformanceBySearch
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 9,
"start_time" => "2018-06-20",
"end_time" => "2018-06-20",
"is_case" => 1,//1经纪人 2案场
"house_id" => 0
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"start_time"
])
||
!
isset
(
$params
[
"end_time"
])
||
!
isset
(
$params
[
"is_case"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$house_id
=
0
;
if
(
isset
(
$params
[
"house_id"
]))
{
$house_id
=
$params
[
"house_id"
];
}
try
{
$result
=
$this
->
service_
->
personagePerformance
(
$params
[
"agent_id"
],
$params
[
"start_time"
],
$params
[
"end_time"
]
.
" 23:59:59"
,
$params
[
"is_case"
],
$house_id
);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
catch
(
Exception
$exception
)
{
return
$this
->
response
(
"101"
,
"request error,msg:"
.
$exception
);
}
}
/**
* 门店业绩
* @return \think\Response
*/
public
function
storePerformanceBySearch
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 5739,
"start_time" => "2018-06-25",
"end_time" => "2018-06-25",
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"site_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
try
{
$result
=
$this
->
service_
->
storePerformance
(
$params
[
"agent_id"
],
$params
[
"start_time"
],
$params
[
"end_time"
]
.
" 23:59:59"
,
$params
[
"site_id"
]);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
catch
(
Exception
$exception
)
{
return
$this
->
response
(
"101"
,
"request error,msg:"
.
$exception
);
}
}
/**
* 各个状态的订单列表暂不分页,
* @return \think\Response
*/
public
function
orderNoList
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 5740,
"start_time" => "2018-08-08",
"end_time" => "2018-08-08",
"is_case" => 2,//1经纪人 2案场
"house_id" => 7311,
"type" => 4 // 1带看 2进场 3收款 4成交报告
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"start_time"
])
||
!
isset
(
$params
[
"end_time"
])
||
!
isset
(
$params
[
"type"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$house_id
=
0
;
if
(
isset
(
$params
[
"house_id"
]))
{
$house_id
=
$params
[
"house_id"
];
}
try
{
$result
=
$this
->
service_
->
orderList
(
$params
[
"agent_id"
],
$params
[
"start_time"
],
$params
[
"end_time"
],
$params
[
"is_case"
],
$house_id
,
$params
[
"type"
]);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
catch
(
Exception
$exception
)
{
return
$this
->
response
(
"101"
,
"request error,msg:"
.
$exception
);
}
}
/**
* 门店或者经纪人业绩排行
* @return \think\Response
*/
public
function
storeOrAgentSort
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 6,
"is_store" => 1,//1经纪人排行 2门店
"start_time" => "2018-04-12",
"end_time" => "2018-04-12",
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"start_time"
])
||
!
isset
(
$params
[
"end_time"
])
||
!
isset
(
$params
[
"site_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
Log
::
write
(
$params
,
'storeOrAgentSort'
);
//记录日志
//城市选择
$site_id
=
$params
[
"site_id"
]
?
$params
[
"site_id"
]
:
''
;
try
{
$result
=
$this
->
service_
->
storeSortByDistrictId
(
$params
[
"agent_id"
],
$params
[
"is_store"
],
$params
[
"start_time"
],
$params
[
"end_time"
]
.
" 23:59:59"
,
$site_id
);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
catch
(
Exception
$exception
)
{
return
$this
->
response
(
"101"
,
"request error,msg:"
.
$exception
);
}
}
/**
* 获取时间段新增房源数据
* @return \think\Response
*/
public
function
housingResource
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"type" => 1, //1个人,2经纪人
"agent_id" => 80,
"start_time" => "2018-06-12",
"end_time" => "2018-06-19",
"page_no" => 1,
"page_size" => 15
);*/
$checkResult
=
$this
->
validate
(
$params
,
"PerformanceValidate.verify"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
getHousingResourceList
(
$params
[
"type"
],
$params
[
"agent_id"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 获取时间段新增客源数据
* @return \think\Response
*/
public
function
userResource
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"type" => 1, //1个人,2经纪人
"agent_id" => 80,
"start_time" => "2018-06-12",
"end_time" => "2018-06-19",
"page_no" => 1,
"page_size" => 15
);*/
$checkResult
=
$this
->
validate
(
$params
,
"PerformanceValidate.verify"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
getUserResourceList
(
$params
[
"type"
],
$params
[
"agent_id"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 获取时间段带看数据
* @return \think\Response
*/
public
function
followList
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
// "type" => 1, //1个人,2经纪人
"agent_id" => 80,
"start_time" => "2018-06-12",
"end_time" => "2018-06-19",
"page_no" => 1,
"page_size" => 15
);*/
$checkResult
=
$this
->
validate
(
$params
,
"PerformanceValidate.verifyOther"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
getFollowList
(
$params
[
"agent_id"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 获取时间段进场数据
* @return \think\Response
*/
public
function
marchInList
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 80,
"start_time" => "2018-06-12",
"end_time" => "2018-06-19",
"page_no" => 1,
"page_size" => 15
);*/
$checkResult
=
$this
->
validate
(
$params
,
"PerformanceValidate.verifyOther"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
marchInList
(
$params
[
"agent_id"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 获取时间段进场数据
* @return \think\Response
*/
public
function
paylogList
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 80,
"start_time" => "2018-06-12",
"end_time" => "2018-06-19",
"page_no" => 1,
"page_size" => 15
);*/
$checkResult
=
$this
->
validate
(
$params
,
"PerformanceValidate.verifyOther"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
paylogList
(
$params
[
"agent_id"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 获取时间段进场数据
* @return \think\Response
*/
public
function
performanceList
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"type" => 1, //1个人,2经纪人
"agent_id" => 80,
"start_time" => "2018-06-12",
"end_time" => "2018-06-19",
"page_no" => 1,
"page_size" => 15
);*/
$checkResult
=
$this
->
validate
(
$params
,
"PerformanceValidate.verify"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
performanceList
(
$params
[
"type"
],
$params
[
"agent_id"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 获取时间段监督执行数据
* @return \think\Response
*/
public
function
superviseList
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 78,
"start_time" => "2018-06-12",
"end_time" => "2018-06-20",
"page_no" => 1,
"page_size" => 15
);*/
$checkResult
=
$this
->
validate
(
$params
,
"PerformanceValidate.verifyOther"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
superviseList
(
$params
[
"agent_id"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 获取时间段实收数据
* @return \think\Response
*/
public
function
officialReceiptsList
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"type" => 1, //1个人,2经纪人
"agent_id" => 80,
"start_time" => "2018-06-12",
"end_time" => "2018-06-19",
"page_no" => 1,
"page_size" => 15
);*/
$checkResult
=
$this
->
validate
(
$params
,
"PerformanceValidate.verify"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
officialReceipts
(
$params
[
"type"
],
$params
[
"agent_id"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 获取时间段实收数据
* @return \think\Response
*/
public
function
paylogListPcInfo
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
paylogListPcInfo
(
$params
[
"id"
],
$params
[
"type"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 进场
* @return \think\Response]
*/
public
function
marchInListPcInfo
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
marchInListPcInfo
(
$params
[
"id"
],
$params
[
"type"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
// return $this->response("200", "success", $result["date"]);
return
$this
->
response
(
"200"
,
"success"
,
[
"date"
=>
$result
[
"date"
],
"total"
=>
$result
[
"total"
]]);
}
}
/**
* 报备列表
* @return \think\Response
*/
public
function
followListPcInfo
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"id" => 80,
"type" => 1, //1表示个人业绩排行 2门店79 3区域7
"start_time" => "2018-06-12",
"end_time" => "2018-06-19",
"page_no" => 1,
"page_size" => 15
);*/
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
getFollowListPcInfo
(
$params
[
"id"
],
$params
[
"type"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
//return $this->response("200", "success", $result["date"]);
return
$this
->
response
(
"200"
,
"success"
,
[
"date"
=>
$result
[
"date"
],
"total"
=>
$result
[
"total"
]]);
}
}
/**
* 新增商铺列表
* @return \think\Response\
*/
public
function
housingResourcePcInfo
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
//todo 最后跟进时间
$result
=
$this
->
service_
->
getHousingResourceListPcInfo
(
$params
[
"id"
],
$params
[
"type"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 新增客户列表
* @return \think\Response
*/
public
function
userResourcePcInfo
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$result
=
$this
->
service_
->
getUserResourceListPcInfo
(
$params
[
"id"
],
$params
[
"type"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
,
$this
->
siteId
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 团队人数
* @return \think\Response
*/
public
function
teamNumPcInfo
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
// dump($params);
$result
=
$this
->
service_
->
getTeamNumPcInfo
(
$params
[
"id"
],
$params
[
"type"
],
$page_no
,
$page_size
,
$this
->
siteId
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 成交单数 成交报告
* @return \think\Response
*/
public
function
bargainSumPcInfo
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
//默认排序一周
$end_day
=
!
empty
(
$params
[
"end_time"
])
?
$params
[
"end_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_day
=
!
empty
(
$params
[
"start_time"
])
?
$params
[
"start_time"
]
:
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
//request_source_type true int 请求来源默认0:App 1:PC后台
$request_source_type
=
!
empty
(
$params
[
"request_source_type"
])
?
$params
[
"request_source_type"
]
:
0
;
$result
=
$this
->
service_
->
getBargainSumPcInfo
(
$params
[
"id"
],
$params
[
"type"
],
$start_day
,
$end_day
,
$page_no
,
$page_size
,
$request_source_type
);
if
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"date"
]);
}
else
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"date"
]);
}
}
/**
* 收款信息
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=815
*/
public
function
collectionListByBargainId
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"bargain_id" => 121,
);*/
$checkResult
=
$this
->
validate
(
$params
,
"PerformanceValidate.verifyCollectionList"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$result
=
$this
->
service_
->
collectionList
(
$params
[
"bargain_id"
]);
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
}
application/api_broker/service/OfficePerformanceService.php
0 → 100644
View file @
b5f2f855
<?php
namespace
app\api_broker\service
;
use
app\model\AAgents
;
use
app\model\ASuperviseModel
;
use
app\model\GHouses
;
use
app\model\GHousesFollowUp
;
use
app\model\GHousesImgs
;
use
app\model\GHousesToAgents
;
use
app\model\OBargainModel
;
use
app\model\OfficeGRoomToAgent
;
use
app\model\OfficeOPayLogModel
;
use
app\model\OfficeORefundModel
;
use
app\model\OfficeOReportModel
;
use
app\model\OMarchInModel
;
use
app\model\OPayLogModel
;
use
app\model\ORefundModel
;
use
app\model\OReportModel
;
use
app\model\TAgentTotalModel
;
use
app\model\UPhoneFollowUp
;
use
app\model\Users
;
use
think\Log
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/3/22
* Time : 上午10:37
* Intro:
*/
class
OfficePerformanceService
{
private
$totalModel
;
private
$agentModel
;
private
$houseModel
;
private
$userModel
;
private
$bargainModel
;
private
$reportModel
;
private
$marchInModel
;
private
$payLogModel
;
private
$gHousesImgModel
;
private
$superviseModel
;
public
function
__construct
()
{
$this
->
totalModel
=
new
TAgentTotalModel
();
$this
->
agentModel
=
new
AAgents
();
$this
->
houseModel
=
new
GHouses
();
$this
->
userModel
=
new
Users
();
$this
->
bargainModel
=
new
OBargainModel
();
$this
->
reportModel
=
new
OReportModel
();
$this
->
marchInModel
=
new
OMarchInModel
();
$this
->
payLogModel
=
new
OPayLogModel
();
$this
->
gHousesImgModel
=
new
GHousesImgs
();
$this
->
superviseModel
=
new
ASuperviseModel
();
}
/**
* @param $agent_id
* @param $type
* @param $yesterday
* @param $end_day
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
totalAgent
(
$agent_id
,
$type
,
$yesterday
,
$end_day
,
$site_id
)
{
$params
[
"agent_id"
]
=
$agent_id
;
$agent_info
=
$this
->
agentModel
->
getAgentById
(
"id,store_id,district_id,level"
,
$params
);
if
(
count
(
$agent_info
)
>
0
)
{
$agent_info
=
$agent_info
[
0
];
}
$where_
=
[];
$where_
[
'd.site_id'
]
=
$site_id
;
$where_
[
'a.total_time'
]
=
array
(
'between'
,
array
(
$yesterday
,
$end_day
)
);
$field
=
"a.agent_id,a.store_id,a.district_id,sum(a.performance) as performance_total"
;
$order
=
"performance_total desc"
;
$result
=
$this
->
totalModel
->
getTotalByAgentIdSite
(
$field
,
$where_
,
$type
,
$order
);
//dump($result);
$arr
=
[];
$field
=
"a.name,a.img,b.store_name,c.district_name"
;
foreach
(
$result
as
$key
=>
$value
)
{
switch
(
$type
)
{
case
1
:
if
(
$value
[
"agent_id"
]
==
$agent_info
[
"id"
]
||
$key
<
5
)
{
$value
[
"index_"
]
=
$key
+
1
;
$value
[
"is_my"
]
=
$agent_info
[
"id"
];
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
$info
[
0
][
"name"
];
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$info
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
array_push
(
$arr
,
$value
);
}
break
;
case
2
:
if
(
$value
[
"store_id"
]
==
$agent_info
[
"store_id"
]
||
$key
<
5
)
{
$value
[
"index_"
]
=
$key
+
1
;
$value
[
"is_my"
]
=
$agent_info
[
"store_id"
];
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
],
""
]);
$store_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"store_id"
=>
$value
[
"store_id"
],
"level"
=>
[
"in"
,
"20"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$store_name
)
>
0
?
$store_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$store_name
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
array_push
(
$arr
,
$value
);
}
break
;
case
3
:
$value
[
"index_"
]
=
$key
+
1
;
$value
[
"is_my"
]
=
$agent_info
[
"district_id"
];
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
$district_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"district_id"
=>
$value
[
"district_id"
],
"level"
=>
[
"in"
,
"30,40"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$district_name
)
>
0
?
$district_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$district_name
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
array_push
(
$arr
,
$value
);
break
;
}
}
return
$arr
;
}
/**
* 个人业绩
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $is_case
* @param $house_id
* @return array|mixed|null
*/
public
function
personagePerformance
(
$agent_id
,
$start_time
,
$end_time
,
$is_case
,
$house_id
)
{
$result
=
[];
switch
(
$is_case
)
{
case
1
:
$field
=
"agent_id,sum(add_house_num) as add_house_num,sum(add_user_num) as add_user_num,
sum(performance) as performance,sum(official_receipts) as official_receipts,sum(look_at_num) as look_at_num,
sum(march_in_num) as march_in_num , sum(paylog) as paylog , sum(bargain_sum) as bargain_sum"
;
$where_
[
"agent_id"
]
=
$agent_id
;
$where_
[
'total_time'
]
=
array
(
'between'
,
array
(
$start_time
,
$end_time
)
);
$list
=
$this
->
totalModel
->
personagePerformance
(
$field
,
$where_
);
if
(
count
(
$list
)
>
0
)
{
$result
=
$list
[
0
];
}
break
;
case
2
:
//案场
$house_id_arr
=
[];
if
(
$house_id
>
0
)
{
// 如果有传楼盘id证明是筛选
$condition
[
"house_ids"
]
=
$house_id
;
}
else
{
$vService
=
new
VerifyService
();
$house_id_arr
=
$vService
->
getCaseHouseIdByAgentId
(
$agent_id
);
$ids
=
""
;
foreach
(
$house_id_arr
as
$item
)
{
$ids
.=
$item
[
"houses_id"
]
.
","
;
}
$ids
=
rtrim
(
$ids
,
","
);
if
(
!
$ids
)
{
//代表没有案场
return
null
;
}
$condition
[
"house_ids"
]
=
$ids
;
}
$condition
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$condition
[
"is_case"
]
=
$is_case
;
$result
=
$this
->
nowTimeSum
(
$condition
,
2
);
if
(
count
(
$result
)
>
0
&&
$house_id
==
0
)
{
$result
[
"house_arr"
]
=
$house_id_arr
;
}
break
;
}
if
(
count
(
$result
)
>
0
)
{
return
$result
;
}
else
{
return
null
;
}
}
/**
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $is_case
* @param $house_id
* @param $type
* @return null
*/
public
function
orderList
(
$agent_id
,
$start_time
,
$end_time
,
$is_case
,
$house_id
,
$type
)
{
$params
=
[];
switch
(
$is_case
)
{
case
1
:
$params
[
"agent_id"
]
=
$agent_id
;
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
break
;
case
2
:
//案场
if
(
$house_id
>
0
)
{
// 如果有传楼盘id证明是筛选
$params
[
"house_ids"
]
=
$house_id
;
}
else
{
$vService
=
new
VerifyService
();
$house_id_arr
=
$vService
->
getCaseHouseIdByAgentId
(
$agent_id
);
$ids
=
""
;
foreach
(
$house_id_arr
as
$item
)
{
$ids
.=
$item
[
"houses_id"
]
.
","
;
}
$ids
=
rtrim
(
$ids
,
","
);
if
(
!
$ids
)
{
//代表没有案场
return
null
;
}
$params
[
"house_ids"
]
=
$ids
;
}
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
break
;
}
$result
=
$this
->
getOrderList
(
$params
,
$type
,
$is_case
);
if
(
count
(
$result
)
>
0
)
{
return
$result
;
}
else
{
return
null
;
}
}
public
function
getOrderList
(
$params
,
$type
,
$is_case
)
{
$result
=
[];
//1带看 2进场 3收款 4成交报告
switch
(
$type
)
{
case
1
:
$field
=
"DATE(a.create_time) as create_time,a.user_phone,a.user_name,a.user_id,b.house_id,b.house_title"
;
$result
=
$this
->
reportModel
->
getAddReportOrderList
(
$field
,
$params
);
break
;
case
2
:
$field
=
"DATE(a.create_time) as create_time ,b.house_id,b.house_title,c.user_phone,c.user_name,c.user_id"
;
$result
=
$this
->
marchInModel
->
getAddMarchInOrderList
(
$field
,
$params
);
break
;
case
3
:
$field
=
"DATE(a.create_time) as create_time ,b.house_id,b.house_title,c.user_phone,c.user_name,c.user_id"
;
$result
=
$this
->
payLogModel
->
getAddPayLogOrderList
(
$field
,
$params
);
break
;
case
4
:
$field
=
"DATE(a.create_time) as create_time ,b.house_id,b.house_title,c.user_phone,c.user_name,c.user_id"
;
$result
=
$this
->
bargainModel
->
getAddBargainOrderList
(
$field
,
$params
,
$is_case
);
break
;
default
:
}
return
$result
;
}
/**
* 个人业绩当天业绩统计
* @param $params
* @return array
*/
private
function
nowTimeSum
(
$params
,
$type
)
{
$result
=
[];
if
(
$type
==
1
)
{
//房源
$addHouseNum
=
$this
->
houseModel
->
getAddHouseNum
(
$params
);
$result
[
"add_house_num"
]
=
!
empty
(
$addHouseNum
[
0
][
"num"
])
?
$addHouseNum
[
0
][
"num"
]
:
0
;
//客源
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$params
);
$result
[
"add_user_num"
]
=
!
empty
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
//业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$params
,
1
);
//1表示业绩 2表示实收
$result
[
"performance"
]
=
!
empty
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//实收
$receivedSum
=
$this
->
bargainModel
->
getReceived
(
$params
);
$result
[
"official_receipts"
]
=
!
empty
(
$receivedSum
[
0
][
"num"
])
?
$receivedSum
[
0
][
"num"
]
:
0
;
}
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$params
);
$result
[
"look_at_num"
]
=
!
empty
(
$reportNum
[
0
][
"num"
])
?
$reportNum
[
0
][
"num"
]
:
0
;
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$params
);
$result
[
"march_in_num"
]
=
!
empty
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
$payLogNum
=
$this
->
payLogModel
->
getAddPayLogNum
(
$params
);
$result
[
"paylog"
]
=
!
empty
(
$payLogNum
[
0
][
"num"
])
?
$payLogNum
[
0
][
"num"
]
:
0
;
$bargainSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$params
,
3
);
//表示统计
$result
[
"bargain_sum"
]
=
!
empty
(
$bargainSum
[
0
][
"num"
])
?
$bargainSum
[
0
][
"num"
]
:
0
;
return
$result
;
}
/**
* 门店业绩
* @param $agent_id
* @param $start_time
* @param $end_time
* @return array|false|mixed|null|\PDOStatement|string|\think\Collection
*/
public
function
storePerformance
(
$agent_id
,
$start_time
,
$end_time
,
$site_id
)
{
//获取经纪人信息
$result
=
$this
->
agentModel
->
searchAgentsByKeyword
(
"id,store_id,district_id,level"
,
[
"id"
=>
$agent_id
]);
if
(
count
(
$result
)
<=
0
)
{
return
null
;
}
$type
=
0
;
if
(
$result
[
0
][
"level"
]
==
20
)
{
$type
=
2
;
$params
[
"a.store_id"
]
=
$result
[
0
][
"store_id"
];
}
elseif
(
$result
[
0
][
"level"
]
==
30
||
$result
[
0
][
"level"
]
==
40
)
{
$type
=
3
;
$params
[
"a.district_id"
]
=
$result
[
0
][
"district_id"
];
}
//$params['d.site_id'] = $site_id;
$field
=
" sum(a.add_house_num) as add_house_num,
sum(a.add_user_num) as add_user_num,
sum(a.performance) as performance,
sum(a.official_receipts) as official_receipts,
sum(a.look_at_num) as look_at_num,
sum(a.march_in_num) as march_in_num,
sum(a.paylog) as paylog,
sum(a.supervision_num) as supervision_num"
;
$params
[
'a.total_time'
]
=
array
(
'between'
,
array
(
$start_time
,
$end_time
)
);
$list
=
$this
->
totalModel
->
getTotalByAgentIdSite
(
$field
,
$params
,
$type
,
""
);
// dump($list);
if
(
count
(
$list
)
>
0
)
{
$list
=
$list
[
0
];
}
if
(
count
(
$list
)
>
0
)
{
return
$list
;
}
else
{
return
null
;
}
}
/**
* @param $agent_id
* @param $is_store
* @param $start_time
* @param $end_time
* @return array|false|null|\PDOStatement|string|\think\Collection
*/
public
function
storeSortByDistrictId
(
$agent_id
,
$is_store
,
$start_time
,
$end_time
,
$site_id
)
{
$result
=
$this
->
agentModel
->
searchAgentsByKeyword
(
"id,store_id,district_id,level"
,
[
"id"
=>
$agent_id
]);
//dump($result);
if
(
count
(
$result
)
<=
0
)
{
return
null
;
}
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByWhere
(
$agent_id
);
$params
[
"a.agent_id"
]
=
array
(
"in"
,
$agent_ids
);
if
(
!
empty
(
$site_id
))
{
$where
[
'a.disc'
]
=
$site_id
;
}
$field
=
"
a.store_id,
a.agent_id,
sum(a.add_house_num) as add_house_num,
sum(a.add_user_num) as add_user_num,
sum(a.march_in_num) as march_in_num,
sum(a.performance) as performance,
sum(a.official_receipts) as official_receipts"
;
$params
[
'a.total_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$order
=
"performance desc"
;
$list
=
$this
->
totalModel
->
getTotalByAgentIdSite
(
$field
,
$params
,
$is_store
,
$order
);
if
(
count
(
$list
)
>
0
)
{
foreach
(
$list
as
$key
=>
$item
)
{
if
(
$is_store
==
2
)
{
$fields
=
"a.name,b.store_name"
;
$where_
[
"a.level"
]
=
array
(
'in'
,
"20,40"
);
$where_
[
"a.store_id"
]
=
$item
[
"store_id"
];
$where_
[
"c.id"
]
=
$item
[
"agent_id"
];
}
else
{
$fields
=
"a.name,b.store_name"
;
$where_
[
"a.id"
]
=
$item
[
"agent_id"
];
}
$info
=
$this
->
agentModel
->
getStoreOrAgentInfo
(
$fields
,
$where_
,
$is_store
);
if
(
count
(
$info
)
>
0
)
{
$list
[
$key
][
"store_name"
]
=
$info
[
0
][
"store_name"
];
$list
[
$key
][
"name"
]
=
$info
[
0
][
"name"
];
}
else
{
$list
[
$key
][
"store_name"
]
=
"--"
;
$list
[
$key
][
"name"
]
=
"--"
;
}
}
}
return
$list
;
}
/**组装请求参数
* @param $agent_id
* @param $type
* @param $start_time
* @param $end_time
* @return null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private
function
getAgentId
(
$agent_id
,
$type
,
$start_time
,
$end_time
)
{
switch
(
$type
)
{
case
1
:
$params
[
"agent_id"
]
=
$agent_id
;
break
;
case
2
:
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentIdAndStatus
(
$agent_id
);
$params
[
"agent_id"
]
=
array
(
"in"
,
$agent_ids
);
break
;
case
3
:
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentIdAndStatus
(
$agent_id
);
$params
[
"agent_id"
]
=
array
(
"in"
,
$agent_ids
);
break
;
default
:
return
null
;
}
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
return
$params
;
}
private
function
getAgentIdPcInfo
(
$id
,
$type
,
$start_time
,
$end_time
)
{
switch
(
$type
)
{
case
1
:
$params
[
"agent_id"
]
=
$id
;
break
;
case
2
:
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentIdPcInfo
(
$id
,
$type
);
$params
[
"agent_id"
]
=
array
(
"in"
,
$agent_ids
);
break
;
case
3
:
$verify
=
new
VerifyService
();
$agent_ids
=
$verify
->
getAgentsByAgentIdPcInfo
(
$id
,
$type
);
$params
[
"agent_id"
]
=
array
(
"in"
,
$agent_ids
);
break
;
default
:
return
null
;
}
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
return
$params
;
}
/**
* 获取房源数据
* @param $type
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array|false|\PDOStatement|string|\think\Collection
*/
public
function
getHousingResourceList
(
$type
,
$agent_id
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
$params
=
$this
->
getAgentId
(
$agent_id
,
$type
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"id,internal_title,shop_area_start,shop_area_end,rent_type,rent_price,shop_type,shop_sign"
;
$addHouseList
=
$this
->
houseModel
->
getAddHouseList
(
$params
,
$field
,
$page_no
,
$page_size
);
//获取图片信息
foreach
(
$addHouseList
as
$key
=>
$val
)
{
$addHouseList
[
$key
][
"rent_price"
]
=
$val
[
"rent_price"
]
*
0.01
;
$param
[
"house_id"
]
=
$val
[
"id"
];
$param
[
"img_type"
]
=
1
;
//默认主图
$imgArr
=
$this
->
gHousesImgModel
->
getHouseImages
(
$param
,
1
);
$addHouseList
[
$key
][
"images"
]
=
!
empty
(
$imgArr
[
0
][
"img_name"
])
?
CK_IMG_URL
.
'images/'
.
$imgArr
[
0
][
"img_name"
]
:
null
;
}
return
[
"code"
=>
200
,
"date"
=>
$addHouseList
];
}
/**
* 获取客源数据
* @param $type
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array|false|\PDOStatement|string|\think\Collection
*/
public
function
getUserResourceList
(
$type
,
$agent_id
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
$params
=
$this
->
getAgentId
(
$agent_id
,
$type
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"a.id,a.user_name,a.user_phone,a.user_nick,a.create_time,a.agent_id"
;
$addUserList
=
$this
->
userModel
->
getAddUserList
(
$params
,
$field
,
$page_no
,
$page_size
);
foreach
(
$addUserList
as
$key
=>
$val
)
{
if
(
$val
[
"agent_id"
]
==
$agent_id
)
{
$addUserList
[
$key
][
"is_my"
]
=
1
;
}
else
{
$addUserList
[
$key
][
"is_my"
]
=
0
;
}
$addUserList
[
$key
][
"user_phone"
]
=
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$val
[
"user_phone"
]);
}
return
[
"code"
=>
200
,
"date"
=>
$addUserList
];
}
/**
* 获取带看数据
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array|false|\PDOStatement|string|\think\Collection
*/
public
function
getFollowList
(
$agent_id
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
$params
=
$this
->
getAgentId
(
$agent_id
,
2
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"a.id,a.user_name,a.user_phone,a.predict_see_time,c.internal_title as house_title,c.shop_type"
;
$reportList
=
$this
->
reportModel
->
getAddReportList
(
$params
,
$field
,
$page_no
,
$page_size
);
foreach
(
$reportList
as
$key
=>
$val
)
{
$reportList
[
$key
][
"user_phone"
]
=
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$val
[
"user_phone"
]);
}
return
[
"code"
=>
200
,
"date"
=>
$reportList
];
}
/**
* 获取进场数据
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size PcInfo
* @return array|false|\PDOStatement|string|\think\Collection
*/
public
function
marchInList
(
$agent_id
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
$params
=
$this
->
getAgentId
(
$agent_id
,
2
,
$start_time
,
$end_time
);
//dump($params);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"a.id,c.user_name,c.user_phone,c.predict_see_time,b.house_title"
;
$addMarchInList
=
$this
->
marchInModel
->
getAddMarchInList
(
$params
,
$field
,
$page_no
,
$page_size
);
//获取图片信息
foreach
(
$addMarchInList
as
$key
=>
$val
)
{
$addMarchInList
[
$key
][
"user_phone"
]
=
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$val
[
"user_phone"
]);
}
return
[
"code"
=>
200
,
"date"
=>
$addMarchInList
];
}
/**
* 获取收款数据
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array|false|\PDOStatement|string|\think\Collection
*/
public
function
paylogList
(
$agent_id
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
$params
=
$this
->
getAgentId
(
$agent_id
,
2
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"a.id,c.user_name,c.user_phone,c.predict_see_time,b.house_title"
;
$payLogList
=
$this
->
payLogModel
->
getAddPayLogList
(
$params
,
$field
,
$page_no
,
$page_size
);
//获取图片信息
foreach
(
$payLogList
as
$key
=>
$val
)
{
$payLogList
[
$key
][
"user_phone"
]
=
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$val
[
"user_phone"
]);
}
return
[
"code"
=>
200
,
"date"
=>
$payLogList
];
}
/**
* 获取业绩数据
* @param $type
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array|false|\PDOStatement|string|\think\Collection
*/
public
function
performanceList
(
$type
,
$agent_id
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
$params
=
$this
->
getAgentId
(
$agent_id
,
$type
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"a.id,b.name,c.store_name,d.district_name,a.scale_fee,a.create_time"
;
$performanceList
=
$this
->
bargainModel
->
getAddBargainList
(
$params
,
$field
,
$page_no
,
$page_size
);
return
[
"code"
=>
200
,
"date"
=>
$performanceList
];
}
/**
* 获取监督执行记录
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array
*/
public
function
superviseList
(
$agent_id
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
$params
=
$this
->
getAgentId
(
$agent_id
,
2
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"a.id,a.agent_id,a.agent_name,a.remark,a.img,a.address,a.create_time"
;
$where_
[
"a.agent_id"
]
=
$params
[
"agent_id"
];
$where_
[
"a.create_time"
]
=
$params
[
"create_time"
];
$superviseList
=
$this
->
superviseModel
->
findSuperviseList
(
$page_no
,
$page_size
,
'id desc'
,
$field
,
$where_
);
foreach
(
$superviseList
as
$k
=>
$v
)
{
$superviseList
[
$k
][
'img'
]
=
CK_IMG_URL
.
'images/supervise/'
.
$v
[
'img'
];
}
return
[
"code"
=>
200
,
"date"
=>
$superviseList
];
}
/**
* 获取实收记录
* @param $type
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array
*/
public
function
officialReceipts
(
$type
,
$agent_id
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
$params
=
$this
->
getAgentId
(
$agent_id
,
$type
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"a.id,c.name,d.store_name,e.district_name,b.practical_fee,b.create_time"
;
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
$receivedList
=
$this
->
bargainModel
->
getReceivedList
(
$page_no
,
$page_size
,
$field
,
$where_
);
return
[
"code"
=>
200
,
"date"
=>
$receivedList
];
}
public
function
paylogListPcInfo
(
$id
,
$type
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
$params
=
$this
->
getAgentIdPcInfo
(
$id
,
$type
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"a.id,a.create_time,a.money,a.type,a.pay_type,c.user_name,c.user_phone,c.predict_see_time,b.id as order_id,b.house_title,h.internal_address"
;
$payLogList
=
$this
->
payLogModel
->
getAddPayLogListPcInfo
(
$params
,
$field
,
$page_no
,
$page_size
);
//获取图片信息
foreach
(
$payLogList
as
$key
=>
$val
)
{
$payLogList
[
$key
][
"user_phone"
]
=
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$val
[
"user_phone"
]);
$payLogList
[
$key
][
'internal_address'
]
=
$val
[
"internal_address"
]
?
mb_substr
(
$val
[
"internal_address"
],
0
,
3
,
'utf-8'
)
.
'****'
:
''
;
}
return
[
"code"
=>
200
,
"date"
=>
$payLogList
];
}
/**
* 进场
* @param $id
* @param $type
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array
*/
public
function
marchInListPcInfo
(
$id
,
$type
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
$params
=
$this
->
getAgentIdPcInfo
(
$id
,
$type
,
$start_time
,
$end_time
);
//dump($params);
Log
::
write
(
$params
,
'marchInListPcInfo'
);
//记录日志
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"a.id,c.user_name,c.user_phone,c.predict_see_time,c.report_agent_name,b.house_title,b.create_time,e.store_name,b.id as order_id"
;
$addMarchInList
=
$this
->
marchInModel
->
getAddMarchInListPcInfo
(
$params
,
$field
,
$page_no
,
$page_size
);
$addMarchInListTotal
=
$this
->
marchInModel
->
getAddMarchInListPcInfoTotal
(
$params
,
$field
);
//获取图片信息
foreach
(
$addMarchInList
as
$key
=>
$val
)
{
$addMarchInList
[
$key
][
"user_name"
]
=
$val
[
"user_name"
]
?
$val
[
"user_name"
]
:
''
;
$addMarchInList
[
$key
][
"user_phone"
]
=
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$val
[
"user_phone"
]);
}
return
[
"code"
=>
200
,
"date"
=>
$addMarchInList
,
"total"
=>
$addMarchInListTotal
];
}
/**
* 新增客户列表
* @param $id
* @param $type
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @param $site_id
* @return array
*/
public
function
getUserResourceListPcInfo
(
$id
,
$type
,
$start_time
,
$end_time
,
$page_no
,
$page_size
,
$site_id
)
{
$params
=
$this
->
getAgentIdPcInfo
(
$id
,
$type
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"a.id,a.user_name,a.user_phone,a.user_nick,a.create_time,a.agent_id,a.user_status,a.source,a.industry_type,a.area_demand,b.name"
;
$addUserList
=
$this
->
userModel
->
getAddUserList
(
$params
,
$field
,
$page_no
,
$page_size
);
foreach
(
$addUserList
as
$key
=>
$val
)
{
if
(
$val
[
"agent_id"
]
==
$id
)
{
$addUserList
[
$key
][
"is_my"
]
=
1
;
}
else
{
$addUserList
[
$key
][
"is_my"
]
=
0
;
}
$addUserList
[
$key
][
"user_phone"
]
=
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$val
[
"user_phone"
]);
$follow
=
new
UPhoneFollowUp
(
$site_id
);
$res
=
$follow
->
getLastPhoneFollowTime
(
$val
[
'id'
]);
$addUserList
[
$key
][
"last_phone_follow_time"
]
=
$res
[
0
][
'create_time'
]
?
$res
[
0
][
'create_time'
]
:
'暂无!'
;
}
return
[
"code"
=>
200
,
"date"
=>
$addUserList
];
}
/**
* 新增商铺列表
* @param $id
* @param $type
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array
*/
public
function
getHousingResourceListPcInfo
(
$id
,
$type
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
$params
=
$this
->
getAgentIdPcInfo
(
$id
,
$type
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"id,internal_title,shop_area_start,shop_area_end,rent_type,rent_price,shop_type,shop_sign,industry_type,status"
;
$addHouseList
=
$this
->
houseModel
->
getAddHouseList
(
$params
,
$field
,
$page_no
,
$page_size
);
//获取图片信息
foreach
(
$addHouseList
as
$key
=>
$val
)
{
$addHouseList
[
$key
][
"rent_price"
]
=
$val
[
"rent_price"
]
*
0.01
;
$param
[
"house_id"
]
=
$val
[
"id"
];
$param
[
"img_type"
]
=
1
;
//默认主图
$imgArr
=
$this
->
gHousesImgModel
->
getHouseImages
(
$param
,
1
);
$addHouseList
[
$key
][
"images"
]
=
!
empty
(
$imgArr
[
0
][
"img_name"
])
?
CK_IMG_URL
.
'images/'
.
$imgArr
[
0
][
"img_name"
]
:
null
;
//todo 最后跟进时间
$follow
=
new
GHousesFollowUp
();
$res
=
$follow
->
getLastFollowTime
(
$val
[
"id"
]);
$addHouseList
[
$key
][
"last_phone_follow_time"
]
=
$res
[
0
][
'create_time'
]
?
$res
[
0
][
'create_time'
]
:
'暂无!'
;
}
return
[
"code"
=>
200
,
"date"
=>
$addHouseList
];
}
/**
* 报备
* @param $id
* @param $type
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array
*/
public
function
getFollowListPcInfo
(
$id
,
$type
,
$start_time
,
$end_time
,
$page_no
,
$page_size
)
{
$params
=
$this
->
getAgentIdPcInfo
(
$id
,
$type
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"a.id,a.user_name,a.user_phone,a.predict_see_time,a.create_time,a.report_agent_name,c.internal_title as house_title,c.shop_type,e.store_name,b.id as order_id"
;
$reportList
=
$this
->
reportModel
->
getAddReportListPcInfo
(
$params
,
$field
,
$page_no
,
$page_size
);
$reportListTotal
=
$this
->
reportModel
->
getAddReportListPcInfoTotal
(
$params
,
$field
);
foreach
(
$reportList
as
$key
=>
$val
)
{
$reportList
[
$key
][
"user_name"
]
=
$val
[
"user_name"
]
?
$val
[
"user_name"
]
:
''
;
$reportList
[
$key
][
"user_phone"
]
=
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$val
[
"user_phone"
]);
}
//return [ "code" => 200, "date" => $reportList ];
return
[
"code"
=>
200
,
"date"
=>
$reportList
,
"total"
=>
$reportListTotal
];
}
/**
* 团队人数
* @param $id
* @param $type
* @param $page_no
* @param $page_size
* @param $site_id
* @return array
*/
public
function
getTeamNumPcInfo
(
$id
,
$type
,
$page_no
,
$page_size
,
$site_id
)
{
if
(
$type
==
2
)
{
$params
[
"a.store_id"
]
=
$id
;
}
else
{
$params
[
"a.district_id"
]
=
$id
;
}
//$params['a.create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
$field
=
"a.id,a.level,a.name,a.phone,a.create_time,b.store_name"
;
$list
=
$this
->
agentModel
->
searchAgentsByKeywordPcInfo
(
$field
,
$params
,
$page_size
,
$page_no
);
foreach
(
$list
as
$key
=>
$val
)
{
$follow
=
new
UPhoneFollowUp
(
$site_id
);
$res
=
$follow
->
getLastPhoneFollowTime
(
$val
[
'id'
]);
$list
[
$key
][
"user_name"
]
=
$val
[
"user_name"
]
?
$val
[
"user_name"
]
:
''
;
$list
[
$key
][
"last_phone_follow_time"
]
=
$res
[
0
][
'create_time'
]
?
$res
[
0
][
'create_time'
]
:
'暂无!'
;
}
return
[
"code"
=>
200
,
"date"
=>
$list
];
}
/**
* 成交单数 成交报告
* @param $id
* @param $type
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array
*/
public
function
getBargainSumPcInfo
(
$id
,
$type
,
$start_time
,
$end_time
,
$page_no
,
$page_size
,
$request_source_type
)
{
$params
=
$this
->
getAgentIdPcInfo
(
$id
,
$type
,
$start_time
,
$end_time
);
if
(
!
$params
)
return
[
"code"
=>
101
,
"date"
=>
"传入的参数错误"
];
$field
=
"a.id,a.father_id,a.create_time,a.trade_type,a.scale_fee,a.agent_id,c.internal_address,d.user_phone,d.user_name,b.id as order_id"
;
$m_bargain
=
new
OBargainModel
();
$list
=
$m_bargain
->
getBargainSumList
(
$field
,
$params
,
$page_size
,
$page_no
,
$request_source_type
);
foreach
(
$list
as
$key
=>
$val
)
{
$list
[
$key
][
'bargain_id'
]
=
$val
[
"father_id"
]
==
0
?
$val
[
"id"
]
:
$val
[
"father_id"
];
//成交报告ID
$list
[
$key
][
"internal_address"
]
=
$val
[
"internal_address"
]
?
$val
[
"internal_address"
]
:
''
;
$list
[
$key
][
"user_name"
]
=
$val
[
"user_name"
]
?
$val
[
"user_name"
]
:
''
;
$list
[
$key
][
"user_phone"
]
=
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$val
[
"user_phone"
]);
}
return
[
"code"
=>
200
,
"date"
=>
$list
];
}
/**
* @param $bargain_id
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
collectionList
(
$bargain_id
){
$paylogModel
=
new
OfficeOPayLogModel
();
$orderParams
[
"bargain_id"
]
=
$bargain_id
;
$field_pay_log
=
"a.id,a.report_id,a.create_time,a.bargain_id,a.money,a.type,a.income_time,a.source,c.id as agent_id,c.name,d.store_name,b.house_id"
;
$list
=
$paylogModel
->
getPayLogByOrderId
(
$field_pay_log
,
$orderParams
);
$reportModel
=
new
OfficeOReportModel
();
$gModel
=
new
OfficeGRoomToAgent
();
$refundModel
=
new
OfficeORefundModel
();
$field_report
=
"c.name"
;
foreach
(
$list
as
$key
=>
$item
){
//查询是否被退款
$refundParam
[
"pay_log_id"
]
=
$item
[
"id"
];
$refundResult
=
$refundModel
->
selectRefundByOrderNo
(
"id"
,
$refundParam
);
$list
[
$key
][
"is_refund"
]
=
0
;
if
(
count
(
$refundResult
)
>
0
){
$list
[
$key
][
"is_refund"
]
=
1
;
}
$list
[
$key
][
"salesman"
]
=
""
;
if
(
$item
[
"type"
]
==
91
){
$params
[
"id"
]
=
$item
[
"report_id"
];
$result
=
$reportModel
->
getReport
(
$field_report
,
$params
);
$list
[
$key
][
"salesman"
]
=
$result
[
0
][
"name"
];
}
if
(
$item
[
"type"
]
==
92
){
$param
[
"a.houses_id"
]
=
$item
[
"house_id"
];
$param
[
"a.type"
]
=
3
;
$param
[
"a.is_del"
]
=
0
;
$exclusive
=
$gModel
->
getAgentsByHouseId
(
"a.houses_id,b.name"
,
$param
);
if
(
empty
(
$exclusive
)){
$param
[
"type"
]
=
1
;
$param
[
"is_del"
]
=
0
;
$data
=
$gModel
->
getAgentsByHouseId
(
"a.houses_id,b.name"
,
$param
);
$list
[
$key
][
"salesman"
]
=
$data
[
0
][
"name"
];
}
else
{
$list
[
$key
][
"salesman"
]
=
$exclusive
[
0
][
"name"
];
}
}
}
return
$list
;
}
}
\ No newline at end of file
application/model/OfficeGRoomToAgent.php
View file @
b5f2f855
...
...
@@ -202,6 +202,14 @@ class OfficeGRoomToAgent extends BaseModel
return
$result
;
}
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentsByHouseId
(
$field
,
$params
)
{
$result
=
Db
::
name
(
$this
->
table
)
...
...
@@ -213,4 +221,5 @@ class OfficeGRoomToAgent extends BaseModel
//echo Db::name($this->table)->getLastSql();
return
$result
;
}
}
application/route.php
View file @
b5f2f855
...
...
@@ -704,26 +704,26 @@ Route::group('broker', [
'verifyAgentStatus'
=>
[
'api_broker/Broker/verifyAgentStatus'
,
[
'method'
=>
'post'
]],
//判断经纪人是否被解绑
'updateDevice'
=>
[
'api_broker/Broker/updateDevice'
,
[
'method'
=>
'post'
]],
//解绑或者绑定经纪人
'editAgent'
=>
[
'api_broker/Broker/editAgent'
,
[
'method'
=>
'post'
]],
//经纪人修改密码
'forgetPwd'
=>
[
'api_broker/Broker/forgetPwd'
,
[
'method'
=>
'post'
]],
//经纪人忘记密码
'uploadHeadImg'
=>
[
'api_broker/Broker/uploadHeadImg'
,
[
'method'
=>
'post'
]],
//经纪人上传头像
'editClient'
=>
[
'api_broker/Client/editClient'
,
[
'method'
=>
'get|post'
]],
//添加和编辑客户
'getBroker'
=>
[
'api_broker/broker/getBroker'
,
[
'method'
=>
'get'
]],
//获取经纪人列表
'getAgentGroupSite'
=>
[
'api_broker/broker/getAgentGroupSite'
,
[
'method'
=>
'get'
]],
//获得经纪人站点
'labelEdit'
=>
[
'api_broker/label/index'
,
[
'method'
=>
'get|post'
]],
//编辑标签
'getLabelsList'
=>
[
'api_broker/label/getLabelsList'
,
[
'method'
=>
'get'
]],
//标签列表
'add_phone_follow_up'
=>
[
'api_broker/broker/add_phone_follow_up'
,
[
'method'
=>
'get|post'
]],
//新增-客户电话跟进
'addUserPhoneFollowUp'
=>
[
'api_broker/broker/addUserPhoneFollowUp'
,
[
'method'
=>
'get|post'
]],
//新增-客户电话跟进
'editAgent'
=>
[
'api_broker/Broker/editAgent'
,
[
'method'
=>
'post'
]],
//经纪人修改密码
'forgetPwd'
=>
[
'api_broker/Broker/forgetPwd'
,
[
'method'
=>
'post'
]],
//经纪人忘记密码
'uploadHeadImg'
=>
[
'api_broker/Broker/uploadHeadImg'
,
[
'method'
=>
'post'
]],
//经纪人上传头像
'editClient'
=>
[
'api_broker/Client/editClient'
,
[
'method'
=>
'get|post'
]],
//添加和编辑客户
'getBroker'
=>
[
'api_broker/broker/getBroker'
,
[
'method'
=>
'get'
]],
//获取经纪人列表
'getAgentGroupSite'
=>
[
'api_broker/broker/getAgentGroupSite'
,
[
'method'
=>
'get'
]],
//获得经纪人站点
'labelEdit'
=>
[
'api_broker/label/index'
,
[
'method'
=>
'get|post'
]],
//编辑标签
'getLabelsList'
=>
[
'api_broker/label/getLabelsList'
,
[
'method'
=>
'get'
]],
//标签列表
'add_phone_follow_up'
=>
[
'api_broker/broker/add_phone_follow_up'
,
[
'method'
=>
'get|post'
]],
//新增-客户电话跟进
'addUserPhoneFollowUp'
=>
[
'api_broker/broker/addUserPhoneFollowUp'
,
[
'method'
=>
'get|post'
]],
//新增-客户电话跟进
'addUserPhoneFollowUpV2'
=>
[
'api_broker/broker/addUserPhoneFollowUpV2'
,
[
'method'
=>
'get|post'
]],
//新增-客户电话跟进
'useraction_search'
=>
[
'api_broker/broker/useraction_search'
,
[
'method'
=>
'get|post'
]],
//客户电话跟进
'vip'
=>
[
'api_broker/broker/vip'
,
[
'method'
=>
'get|post'
]],
'userStateSearch'
=>
[
'api_broker/broker/userStateSearch'
,
[
'method'
=>
'get|post'
]],
//新增-客户电话跟进
'user_search'
=>
[
'api_broker/broker/user_search'
,
[
'method'
=>
'get|post'
]],
//客户搜索
'checkAuth'
=>
[
'api_broker/broker/checkAuth'
,
[
'method'
=>
'get'
]],
//权限验证
'bindAXB'
=>
[
'api_broker/CellPhone/bindAXB'
,
[
'method'
=>
'post'
]],
//隐私号码
'agentsUnBind'
=>
[
'api_broker/CellPhone/agentsUnBind'
,
[
'method'
=>
'post'
]],
//解除绑定关系
'updateBindAXB'
=>
[
'api_broker/CellPhone/updateBindAXB'
,
[
'method'
=>
'post'
]],
//更新绑定关系隐私号码
'getCallLog'
=>
[
'api_broker/broker/getCallLog'
,
[
'method'
=>
'get|post'
]],
'useraction_search'
=>
[
'api_broker/broker/useraction_search'
,
[
'method'
=>
'get|post'
]],
//客户电话跟进
'vip'
=>
[
'api_broker/broker/vip'
,
[
'method'
=>
'get|post'
]],
'userStateSearch'
=>
[
'api_broker/broker/userStateSearch'
,
[
'method'
=>
'get|post'
]],
//新增-客户电话跟进
'user_search'
=>
[
'api_broker/broker/user_search'
,
[
'method'
=>
'get|post'
]],
//客户搜索
'checkAuth'
=>
[
'api_broker/broker/checkAuth'
,
[
'method'
=>
'get'
]],
//权限验证
'bindAXB'
=>
[
'api_broker/CellPhone/bindAXB'
,
[
'method'
=>
'post'
]],
//隐私号码
'agentsUnBind'
=>
[
'api_broker/CellPhone/agentsUnBind'
,
[
'method'
=>
'post'
]],
//解除绑定关系
'updateBindAXB'
=>
[
'api_broker/CellPhone/updateBindAXB'
,
[
'method'
=>
'post'
]],
//更新绑定关系隐私号码
'getCallLog'
=>
[
'api_broker/broker/getCallLog'
,
[
'method'
=>
'get|post'
]],
'agentUserTb'
=>
[
'api_broker/Client/agentUserTb'
,
[
'method'
=>
'get'
]],
//客户列表
...
...
@@ -1004,8 +1004,10 @@ Route::group('office', [
'bargainMain'
=>
[
'api_broker/OfficeBargain/bargainList'
,
[
'method'
=>
'POST|GET'
]],
'bargainMainV2'
=>
[
'api_broker/OfficeBargain/bargainListV2'
,
[
'method'
=>
'POST|GET'
]],
'userFollowUpList'
=>
[
'api_broker/OfficeHomePageLog/userFollowUpList'
,
[
'method'
=>
'POST|GET'
]],
'houseFollowUpList'
=>
[
'api_broker/OfficeHomePageLog/houseFollowUpList'
,
[
'method'
=>
'POST|GET'
]],
'userFollowUpList'
=>
[
'api_broker/OfficeHomePageLog/userFollowUpList'
,
[
'method'
=>
'POST|GET'
]],
'houseFollowUpList'
=>
[
'api_broker/OfficeHomePageLog/houseFollowUpList'
,
[
'method'
=>
'POST|GET'
]],
'collectionListByBargainId'
=>
[
'api_broker/OfficePerformance/collectionListByBargainId'
,
[
'method'
=>
'POST|GET'
]],
]);
Route
::
group
(
'office_index'
,
[
...
...
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