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
8608a7c3
Commit
8608a7c3
authored
Jul 08, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indexByCity
parent
ec9a493d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
212 additions
and
0 deletions
+212
-0
Broker.php
application/api/controller/Broker.php
+92
-0
OfficeBroker.php
application/api/controller/OfficeBroker.php
+98
-0
AAgents.php
application/model/AAgents.php
+20
-0
route.php
application/route.php
+2
-0
No files found.
application/api/controller/Broker.php
View file @
8608a7c3
...
...
@@ -111,6 +111,98 @@ 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
indexByCity
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
$data
[
'status'
]
=
101
;
$data
[
'data'
]
=
[];
$data
[
'msg'
]
=
''
;
if
(
$params
[
'house_id'
])
{
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
PAGESIZE
:
$params
[
'pageSize'
];
$agents
=
new
AAgents
();
$fields
=
'a.id,name,phone,COUNT(b.id) evaluate,sum(evaluate_grade) as evaluate_grade,a.img'
;
$agent_client
=
0
;
if
(
!
empty
(
$this
->
userId
)
&&
(
$this
->
params
[
'source'
]
!=
'B-APP'
)
&&
$this
->
params
[
'site_id'
])
{
$client_where
[
'c.id'
]
=
$this
->
userId
;
$client_where
[
'c.id'
]
=
1
;
$client_where
[
'a.status'
]
=
0
;
$client_where
[
'd.site_id'
]
=
$this
->
params
[
'site_id'
];
$agent_client
=
$agents
->
getAgentClientCity
(
$fields
,
$client_where
);
}
//去除分享的商铺
if
(
empty
(
$this
->
params
[
'share'
]))
{
//查找30天带看最多的人
$m_march
=
new
OMarchInModel
();
$report_fields
=
'COUNT( a.reception_id ) AS num,a.reception_id '
;
$report_where
[
'b.house_id'
]
=
$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
);
}
if
(
!
empty
(
$reception_id
[
'reception_id'
]))
{
$report_agent
=
$agents
->
getUser
(
1
,
1
,
''
,
$fields
,
[
'a.id'
=>
$reception_id
[
'reception_id'
],
'a.status'
=>
0
,
'c.is_del'
=>
0
]);
}
$where
[
'c.houses_id'
]
=
$params
[
'house_id'
];
$where
[
'c.is_del'
]
=
0
;
$where
[
'a.status'
]
=
0
;
$list
=
$agents
->
getUser
(
$pageNo
,
$pageSize
,
'evaluate desc'
,
$fields
,
$where
);
$agent_id
=
[];
foreach
(
$list
as
$v
)
{
$agent_id
[]
=
$v
[
'id'
];
//下面去重
}
if
(
!
empty
(
$agent_client
[
'id'
])
&&
!
in_array
(
$agent_client
[
'id'
],
$agent_id
))
{
$agent_client
[
'show_content'
]
=
'帮助客户找更多,善于了解客户需求'
;
array_unshift
(
$list
,
$agent_client
);
}
if
(
!
empty
(
$report_agent
[
0
][
'id'
])
&&
!
in_array
(
$report_agent
[
0
][
'id'
],
$agent_id
))
{
$report_agent
[
0
][
'show_content'
]
=
'我对本铺非常了解,最近带看本铺多次'
;
array_unshift
(
$list
,
$report_agent
[
0
]);
}
if
(
!
empty
(
$list
))
{
foreach
(
$list
as
$k
=>
$v
)
{
$v
[
'head_portrait'
]
=
AGENTHEADERIMGURL
.
$v
[
'img'
];
if
(
$list
[
$k
][
'evaluate_grade'
])
{
$evaluate_grade
=
floor
((
$list
[
$k
][
'evaluate_grade'
]
/
2
)
/
$list
[
$k
][
'evaluate'
]);
}
else
{
$evaluate_grade
=
0
;
}
$list
[
$k
][
'evaluate_grade'
]
=
$evaluate_grade
;
$list
[
$k
][
'show_content'
]
=
'本铺由我登记,熟悉房源信息'
;
}
}
$data
[
'data'
][
'list'
]
=
$list
;
$data
[
'data'
][
'pageNo'
]
=
$pageNo
;
$data
[
'data'
][
'pageSize'
]
=
$pageSize
;
$data
[
'status'
]
=
200
;
}
else
{
$data
[
'msg'
]
=
'house_id 为空'
;
}
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
/**
* 咨询经纪人
*
...
...
application/api/controller/OfficeBroker.php
View file @
8608a7c3
...
...
@@ -116,6 +116,104 @@ class OfficeBroker 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
indexByCity
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
$data
[
'status'
]
=
101
;
$data
[
'data'
]
=
[];
$data
[
'msg'
]
=
''
;
if
(
$params
[
'house_id'
])
{
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
PAGESIZE
:
$params
[
'pageSize'
];
$agents
=
new
AAgents
();
$fields
=
'a.id,name,phone,COUNT(b.id) evaluate,sum(evaluate_grade) as evaluate_grade,a.img'
;
$agent_client
=
0
;
if
(
!
empty
(
$this
->
userId
)
&&
(
$this
->
params
[
'source'
]
!=
'B-APP'
)
&&
$this
->
params
[
'site_id'
])
{
$client_where
[
'c.id'
]
=
$this
->
userId
;
$client_where
[
'c.id'
]
=
1
;
$client_where
[
'a.status'
]
=
0
;
$client_where
[
'd.site_id'
]
=
$this
->
params
[
'site_id'
];
$agent_client
=
$agents
->
getAgentClientCity
(
$fields
,
$client_where
);
$where
[
'c.type'
]
=
2
;
//去除分享的商铺
if
(
empty
(
$this
->
params
[
'share'
]))
{
//查找30天带看最多的人
$m_march
=
new
OfficeOMarchInModel
();
$report_fields
=
'COUNT( a.reception_id ) AS num,a.reception_id '
;
$report_where
[
'b.house_id'
]
=
$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
);
}
if
(
!
empty
(
$reception_id
[
'reception_id'
]))
{
$report_agent
=
$agents
->
getUserOffice
(
1
,
1
,
''
,
$fields
,
[
'a.id'
=>
$reception_id
[
'reception_id'
],
'a.status'
=>
0
,
'c.is_del'
=>
0
]);
}
}
else
{
$where
[
'c.type'
]
=
1
;
}
$where
[
'c.house_id'
]
=
$params
[
'house_id'
];
$where
[
'c.is_del'
]
=
0
;
$where
[
'a.status'
]
=
0
;
$list
=
$agents
->
getUserOffice
(
$pageNo
,
$pageSize
,
'evaluate desc'
,
$fields
,
$where
);
$agent_id
=
[];
foreach
(
$list
as
$v
)
{
$agent_id
[]
=
$v
[
'id'
];
//下面去重
}
if
(
!
empty
(
$agent_client
[
'id'
])
&&
!
in_array
(
$agent_client
[
'id'
],
$agent_id
))
{
$agent_client
[
'show_content'
]
=
'帮助客户找更多,善于了解客户需求'
;
array_unshift
(
$list
,
$agent_client
);
}
if
(
!
empty
(
$report_agent
[
0
][
'id'
])
&&
!
in_array
(
$report_agent
[
0
][
'id'
],
$agent_id
))
{
$report_agent
[
0
][
'show_content'
]
=
'我对本铺非常了解,最近带看本铺多次'
;
array_unshift
(
$list
,
$report_agent
[
0
]);
}
if
(
!
empty
(
$list
))
{
foreach
(
$list
as
$k
=>
$v
)
{
$v
[
'head_portrait'
]
=
AGENTHEADERIMGURL
.
$v
[
'img'
];
if
(
$list
[
$k
][
'evaluate_grade'
])
{
$evaluate_grade
=
floor
((
$list
[
$k
][
'evaluate_grade'
]
/
2
)
/
$list
[
$k
][
'evaluate'
]);
}
else
{
$evaluate_grade
=
0
;
}
$list
[
$k
][
'evaluate_grade'
]
=
$evaluate_grade
;
if
(
empty
(
$v
[
'show_content'
]))
{
$list
[
$k
][
'show_content'
]
=
'本铺由我登记,熟悉房源信息'
;
}
}
}
$data
[
'data'
][
'list'
]
=
$list
;
$data
[
'data'
][
'pageNo'
]
=
$pageNo
;
$data
[
'data'
][
'pageSize'
]
=
$pageSize
;
$data
[
'status'
]
=
200
;
}
else
{
$data
[
'msg'
]
=
'house_id 为空'
;
}
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
/**
* 咨询经纪人
*
...
...
application/model/AAgents.php
View file @
8608a7c3
...
...
@@ -1183,6 +1183,26 @@ class AAgents extends BaseModel
->
find
();
}
/**
* 查找客方经纪人
*
* @param string $field
* @param array $params
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentClientCity
(
string
$field
,
array
$params
=
[])
{
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'u_evaluate b'
,
'a.id = b.agents_id'
,
'left'
)
->
join
(
'u_user_agent d'
,
'a.id=d.agent_id'
,
'left'
)
->
join
(
'u_users c'
,
'd.user_id = c.id'
,
'left'
)
->
where
(
$params
)
->
find
();
}
/**
* 经纪人与部门和门店数据
*
...
...
application/route.php
View file @
8608a7c3
...
...
@@ -520,6 +520,7 @@ Route::group('api', [
'getHomeCoupon'
=>
[
'api/Coupon/getHomeCoupon'
,
[
'method'
=>
'get'
]],
'couponList'
=>
[
'api/Coupon/couponList'
,
[
'method'
=>
'get'
]],
//返现红包列表
'getBroker'
=>
[
'api/broker/index'
,
[
'method'
=>
'get'
]],
//获取当前商铺或街铺的经纪人评论信息列表
'getBrokerCity'
=>
[
'api/broker/indexByCity'
,
[
'method'
=>
'get'
]],
//获取当前商铺或街铺的经纪人评论信息列表
'getBrokerV2'
=>
[
'api/broker/indexV2'
,
[
'method'
=>
'get'
]],
//获取当前商铺或街铺的经纪人评论信息列表
// 'test' => ['api/broker/testtest', ['method' => 'get']], //获取当前商铺或街铺的经纪人评论信息列表
'commentAndDeal'
=>
[
'api/broker/commentAndDeal'
,
[
'method'
=>
'get'
]],
//获取当前经纪人的评价和交易列表
...
...
@@ -1141,6 +1142,7 @@ Route::group('office_index', [
Route
::
group
(
'office_api'
,
[
'getBroker'
=>
[
'api/OfficeBroker/index'
,
[
'method'
=>
'get'
]],
//获取当前商铺或街铺的经纪人评论信息列表
'getBrokerCity'
=>
[
'api/OfficeBroker/indexByCity'
,
[
'method'
=>
'get'
]],
//获取当前商铺或街铺的经纪人评论信息列表
'getBrokerV2'
=>
[
'api/OfficeBroker/indexV2'
,
[
'method'
=>
'get'
]],
//获取当前商铺或街铺的经纪人评论信息列表
'getOfficeRoomInfo'
=>
[
'api/OfficeRoom/getOfficeRoomInfo'
,
[
'method'
=>
'GET|POST'
]],
//获取房源详情
...
...
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