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
f36ee9e6
Commit
f36ee9e6
authored
Feb 26, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
咨询经纪人V2
parent
1512f5d3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
116 additions
and
0 deletions
+116
-0
Broker.php
application/api/controller/Broker.php
+78
-0
Basic.php
application/api/extend/Basic.php
+0
-0
AAgents.php
application/model/AAgents.php
+37
-0
route.php
application/route.php
+1
-0
No files found.
application/api/controller/Broker.php
View file @
f36ee9e6
...
...
@@ -111,6 +111,84 @@ class Broker extends Basic
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
/**
* 咨询经纪人
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
indexV2
()
{
header
(
'Access-Control-Allow-Origin:*'
);
if
(
empty
(
$this
->
params
[
'house_id'
]))
{
$this
->
response
(
101
,
'参数错误'
);
}
$data
[
'status'
]
=
101
;
$data
[
'data'
]
=
$list
=
[];
$data
[
'msg'
]
=
''
;
$agents
=
new
AAgents
();
$m_march
=
new
OMarchInModel
();
$m_evaluate
=
new
Evaluate
();
//查找30天带看最多的人
$report_fields
=
'a.reception_id'
;
$report_where
[
'b.house_id'
]
=
$this
->
params
[
'house_id'
];
$report_where
[
'a.create_time'
]
=
[
'between'
,
[
date
(
'Y-m-d'
,
strtotime
(
"-30 day"
))
.
' 00:00:00'
,
date
(
'Y-m-d'
)
.
' 23:59:59'
]];
$reception_id
=
$m_march
->
getMaxMarchInAgent
(
$report_fields
,
$report_where
);
$fields_agent
=
'id,name,img,phone'
;
if
(
!
empty
(
$reception_id
[
'reception_id'
]))
{
$march_agent
=
$agents
->
findByOne
(
$fields_agent
,
[
'id'
=>
$reception_id
[
'reception_id'
]]);
if
(
!
empty
(
$march_agent
)){
$list
[
0
]
=
$march_agent
;
$list
[
0
][
'show_content'
]
=
'我对本铺非常了解,最近带看本铺多次'
;
}
}
$fields
=
'a.id,a.name,a.img,a.phone'
;
//客方
if
(
!
empty
(
$this
->
userId
))
{
$client
=
$agents
->
getAgentUser
(
$fields
,
[
'a.id'
=>
$this
->
userId
,
'b.agent_id'
=>
[
'neq'
,
$list
[
0
][
'id'
]]]);
//客方
if
(
!
empty
(
$client
)){
$list
[
1
]
=
$client
;
$list
[
1
][
'show_content'
]
=
'帮助客户找更多,善于了解客户需求'
;
}
}
//独家方
$where
[
'b.houses_id'
]
=
$this
->
params
[
'house_id'
];
$where
[
'b.is_del'
]
=
$where
[
'a.status'
]
=
0
;
$where
[
'a.id'
]
=
[
'not in'
,
[
$list
[
0
][
'id'
],
$list
[
2
][
'id'
]]];
$where
[
'b.type'
]
=
3
;
$house_agent
=
$agents
->
getAgentHouseType
(
$fields
,
$where
);
if
(
!
empty
(
$house_agent
)){
$list
[
2
]
=
$house_agent
;
$list
[
2
][
'show_content'
]
=
'本铺由我登记,熟悉房源信息'
;
}
foreach
(
$list
as
$k
=>
$v
)
{
$list
[
$k
][
'head_portrait'
]
=
AGENTHEADERIMGURL
.
$v
[
'img'
];
$evaluate_data
=
$m_evaluate
->
getAgentEvaluateFraction
(
'count(id) as evaluate,sum(evaluate_grade) as evaluate_grade'
,
[
'agents_id'
=>
$v
[
'id'
]]);
if
(
$evaluate_data
[
0
][
'evaluate_grade'
])
{
$evaluate_grade
=
floor
((
$evaluate_data
[
0
][
'evaluate_grade'
]
/
2
)
/
$evaluate_data
[
0
][
'evaluate'
]);
}
else
{
$evaluate_grade
=
0
;
}
$list
[
$k
][
'evaluate_grade'
]
=
$evaluate_grade
;
$list
[
$k
][
'evaluate'
]
=
$evaluate_data
[
0
][
'evaluate'
];
unset
(
$list
[
$k
][
'img'
]);
}
$data
[
'data'
][
'list'
]
=
$list
;
$data
[
'status'
]
=
200
;
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
/**
* 评价经纪人
*
...
...
application/api/extend/Basic.php
View file @
f36ee9e6
This diff is collapsed.
Click to expand it.
application/model/AAgents.php
View file @
f36ee9e6
...
...
@@ -1576,6 +1576,9 @@ class AAgents extends BaseModel
}
public
function
findByOne
(
$field
,
$params
)
{
if
(
!
isset
(
$params
[
'status'
]))
{
$where
[
'status'
]
=
0
;
}
$result
=
$this
->
field
(
$field
)
->
where
(
$params
)
...
...
@@ -1590,4 +1593,37 @@ class AAgents extends BaseModel
return
$return
;
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentUser
(
$field
,
$where
)
{
$where
[
'a.status'
]
=
0
;
return
$this
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'u_users b'
,
'a.id = b.agent_id'
,
'left'
)
->
where
(
$where
)
->
find
();
}
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentHouseType
(
$field
,
$where
)
{
return
$this
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'g_houses_to_agents b'
,
'a.id=b.agents_id'
,
'left'
)
->
where
(
$where
)
->
find
();
}
}
\ No newline at end of file
application/route.php
View file @
f36ee9e6
...
...
@@ -430,6 +430,7 @@ Route::group('api', [
//get broker
'getBroker'
=>
[
'api/broker/index'
,
[
'method'
=>
'get'
]],
//获取当前商铺或街铺的经纪人评论信息列表
'getBrokerV2'
=>
[
'api/broker/indexV2'
,
[
'method'
=>
'get'
]],
//获取当前商铺或街铺的经纪人评论信息列表
'test'
=>
[
'api/broker/testtest'
,
[
'method'
=>
'get'
]],
//获取当前商铺或街铺的经纪人评论信息列表
'commentAndDeal'
=>
[
'api/broker/commentAndDeal'
,
[
'method'
=>
'get'
]],
//获取当前经纪人的评价和交易列表
'brokerDetail'
=>
[
'api/broker/brokerDetail'
,
[
'method'
=>
'get'
]],
//经纪人详情
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment