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
73a190f0
Commit
73a190f0
authored
Jun 04, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
楼盘列表
parent
051093fa
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
618 additions
and
50 deletions
+618
-50
OfficeBroker.php
application/api/controller/OfficeBroker.php
+434
-0
OfficeBuilding.php
application/api_broker/controller/OfficeBuilding.php
+25
-2
OfficeRoom.php
application/api_broker/controller/OfficeRoom.php
+39
-33
OfficeService.php
application/index/service/OfficeService.php
+85
-14
OfficeGBuilding.php
application/model/OfficeGBuilding.php
+33
-0
OfficeOMarchInModel.php
application/model/OfficeOMarchInModel.php
+1
-1
route.php
application/route.php
+1
-0
No files found.
application/api/controller/OfficeBroker.php
0 → 100644
View file @
73a190f0
<?php
namespace
app\api\controller
;
use
app\api\extend\Basic
;
use
app\api_broker\service\VerifyRepetitionService
;
use
app\model\AAgents
;
use
app\model\Evaluate
;
use
app\model\EvaluateSign
;
use
app\model\OBargainModel
;
use
app\model\OfficeOMarchInModel
;
use
app\model\OMarchInModel
;
use
app\model\OPushMessageModel
;
/**
* Description of Agents
*
* @user :hu jun
* @date :2017-12-11
* @time :11:15:05
* Intro :
*/
class
Broker
extends
Basic
{
/**
* 咨询经纪人
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
index
()
{
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'
))
{
$agent_client
=
$agents
->
getAgentClient
(
$fields
,
[
'c.id'
=>
$this
->
userId
,
'a.status'
=>
0
]);
}
//去除分享的商铺
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
->
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'
]);
}
/**
* 咨询经纪人
*
* @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
,
'参数错误'
);
}
$list
=
[];
$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
)){
$march_agent
[
'show_content'
]
=
'我对本铺非常了解,最近带看本铺多次'
;
array_push
(
$list
,
$march_agent
);
}
}
$fields
=
'a.id,a.name,a.img,a.phone'
;
//客方
if
(
!
empty
(
$this
->
userId
))
{
if
(
!
empty
(
$list
[
0
][
'id'
]))
{
$client_where
[
'b.agent_id'
]
=
[
'neq'
,
$list
[
0
][
'id'
]];
}
$client_where
[
'b.id'
]
=
$this
->
userId
;
$client
=
$agents
->
getAgentUser
(
$fields
,
$client_where
);
//客方
if
(
!
empty
(
$client
)){
$client
[
'show_content'
]
=
'帮助客户找更多,善于了解客户需求'
;
array_push
(
$list
,
$client
);
}
}
//独家方
if
(
!
empty
(
$list
[
0
][
'id'
])
&&
!
empty
(
$list
[
1
][
'id'
]))
{
$where
[
'a.id'
]
=
[
'not in'
,
[
$list
[
0
][
'id'
],
$list
[
1
][
'id'
]]];
}
elseif
(
!
empty
(
$list
[
0
][
'id'
]))
{
$where
[
'a.id'
]
=
[
'neq'
,
$list
[
0
][
'id'
]];
}
elseif
(
!
empty
(
$list
[
1
][
'id'
]))
{
$where
[
'a.id'
]
=
[
'neq'
,
$list
[
1
][
'id'
]];
}
$where
[
'b.houses_id'
]
=
$this
->
params
[
'house_id'
];
$where
[
'b.is_del'
]
=
$where
[
'a.status'
]
=
0
;
$where
[
'b.type'
]
=
2
;
$house_agent
=
$agents
->
getAgentHouseType
(
$fields
,
$where
);
if
(
!
empty
(
$house_agent
)){
$house_agent
[
'show_content'
]
=
'本铺由我登记,熟悉房源信息'
;
array_push
(
$list
,
$house_agent
);
}
foreach
(
$list
as
$k
=>
$v
)
{
$list
[
$k
][
'head_portrait'
]
=
$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
[
'list'
]
=
$list
;
$data
[
'url'
]
=
AGENTHEADERIMGURL
;
return
$this
->
response
(
200
,
''
,
$data
);
}
/**
* 评价经纪人
*
* @return \think\Response
* @throws \Exception
*/
public
function
appraiser
()
{
$params
=
$this
->
params
;
$data
[
'status'
]
=
101
;
$data
[
'data'
]
=
[];
$data
[
'msg'
]
=
''
;
if
(
empty
(
$params
[
'agents_id'
]))
{
return
$this
->
response
(
$data
[
'status'
],
'agents_id is null'
);
}
if
(
empty
(
$params
[
'house_id'
]))
{
return
$this
->
response
(
$data
[
'status'
],
'house_id is null'
);
}
if
(
empty
(
$this
->
userId
))
{
return
$this
->
response
(
$data
[
'status'
],
'user_id is null'
);
}
if
(
empty
(
$params
[
'source'
]))
{
return
$this
->
response
(
$data
[
'status'
],
'source is null'
);
}
if
(
is_numeric
(
$params
[
'type'
]))
{
$params
[
'type'
]
=
$params
[
'type'
];
}
else
{
$params
[
'type'
]
=
0
;
}
$id_arr
=
[];
if
(
isset
(
$params
[
'sign_name'
]))
{
$evaluate_sign
=
new
EvaluateSign
();
foreach
(
$params
[
'sign_name'
]
as
$v
)
{
$sign_data
=
[
'sign_name'
=>
$v
,
'point_obj'
=>
0
,
'is_del'
=>
0
,
];
$id_arr
[]
=
$evaluate_sign
->
editEvaluationSignData
(
$sign_data
);
}
}
$evaluate
=
new
Evaluate
();
$params
[
'evaluate_sign'
]
=
$id_arr
;
$id
=
$evaluate
->
editEvaluationData
(
$params
,
$this
->
userId
);
if
(
$id
)
{
//去除未推送消息
$m_push
=
new
OPushMessageModel
();
$where
[
'user_id'
]
=
$this
->
userId
;
$where
[
'operation_id'
]
=
$params
[
'agents_id'
];
$where
[
'house_id'
]
=
$params
[
'house_id'
];
$m_push
->
updateData
([
'status'
=>
1
],
$where
);
$data
[
'data'
]
=
[
'id'
=>
$id
];
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
'评价成功'
;
}
else
{
$data
[
'msg'
]
=
'评价失败'
;
}
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
commentAndDeal
()
{
$params
=
$this
->
params
;
$data
[
'status'
]
=
200
;
$data
[
'data'
]
=
[];
$data
[
'msg'
]
=
''
;
if
(
$params
[
'agent_id'
])
{
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
PAGESIZE
:
$params
[
'pageSize'
];
$bargain
=
new
OBargainModel
();
$evaluate
=
new
Evaluate
();
$fields_evaluate
=
'house_id,user_id,user_nick,user_phone,user_pic,evaluate_grade,evaluate_content,'
;
$fields_evaluate
.=
'evaluate_sign,a.create_time,record_id,a.source,a.house_id,c.external_address,c.internal_address,c.disc'
;
$bargain_fields
=
'a.id,a.price,a.create_time as singntime,d.external_title as title,d.rent_type,d.shop_sign,shop_area_start as room_area,c.house_id'
;
switch
(
$params
[
'type'
])
{
case
0
:
//评价列表信息
$result
[
'evaluate'
]
=
$evaluate
->
getEvaluate
(
$pageNo
,
$pageSize
,
'a.id desc'
,
$fields_evaluate
,
''
,
$params
[
'agent_id'
]);
//成交记录
$result
[
'journalAccounts'
]
=
$bargain
->
getBargainOrderList
(
$pageNo
,
$pageSize
,
''
,
$bargain_fields
,
[
'a.agent_id'
=>
$this
->
params
[
'agent_id'
]
]);
$data
[
'data'
]
=
$result
;
break
;
case
1
:
//评价列表信息
$result
[
'evaluate'
]
=
$evaluate
->
getEvaluate
(
$pageNo
,
$pageSize
,
'a.id desc'
,
$fields_evaluate
,
''
,
$params
[
'agent_id'
]);
$data
[
'data'
]
=
$result
;
break
;
case
2
:
//成交记录
$result
[
'journalAccounts'
]
=
$bargain
->
getBargainOrderList
(
$pageNo
,
$pageSize
,
''
,
$bargain_fields
,
[
'a.agent_id'
=>
$this
->
params
[
'agent_id'
]
]);
$data
[
'data'
]
=
$result
;
break
;
default
:
$data
[
'stauts'
]
=
101
;
$data
[
'msg'
]
=
'type is null'
;
break
;
}
}
else
{
$data
[
'msg'
]
=
'agent_id is null'
;
}
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
brokerDetail
()
{
$data
[
'status'
]
=
200
;
$data
[
'data'
]
=
[];
$data
[
'msg'
]
=
''
;
if
(
$this
->
params
[
'agent_id'
])
{
$agents
=
new
AAgents
();
$data
[
'data'
]
=
$agents
->
agentsDetail
(
$this
->
params
[
'agent_id'
]);
}
else
{
$data
[
'status'
]
=
101
;
$data
[
'msg'
]
=
'agent_id is null'
;
}
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
recordCallNum
()
{
$data
[
'status'
]
=
200
;
$data
[
'data'
]
=
[];
$data
[
'msg'
]
=
''
;
if
(
$this
->
params
[
'agent_id'
]
>
0
)
{
$redis
=
new
VerifyRepetitionService
();
$is
=
$redis
->
verifyStart
(
2
,
$this
->
params
[
'agent_id'
],
$this
->
userId
);
if
(
$is
)
{
$m_agents
=
new
AAgents
();
if
(
empty
(
$this
->
params
[
'phone'
]))
{
$agents_data
=
$m_agents
->
getAgentInfo
(
'id,update_time,call_number'
,
$this
->
params
[
'agent_id'
]);
}
else
{
$agents_data
=
$m_agents
->
getAgentInfo
(
'id,update_time,call_number'
,
''
,
[
'phone'
=>
$this
->
params
[
'phone'
]]);
}
$insert_data
[
'update_time'
]
=
$agents_data
[
'update_time'
];
$insert_data
[
'call_number'
]
=
$agents_data
[
'call_number'
]
+
1
;
$data
[
'data'
]
=
$m_agents
->
editData
(
$insert_data
,
$agents_data
[
'id'
]);
}
}
else
{
$data
[
'status'
]
=
101
;
$data
[
'msg'
]
=
'agent_id is null'
;
}
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
recordCallNumShare
()
{
$data
[
'status'
]
=
200
;
$data
[
'data'
]
=
[];
$data
[
'msg'
]
=
''
;
if
(
isset
(
$this
->
params
[
'phone'
]))
{
$is
=
0
;
$m_agents
=
new
AAgents
();
if
(
empty
(
$this
->
params
[
'phone'
]))
{
$agents_data
=
$m_agents
->
getAgentInfo
(
'id,update_time,call_number'
,
$this
->
params
[
'agent_id'
]);
}
else
{
$agents_data
=
$m_agents
->
getAgentInfo
(
'id,update_time,call_number'
,
''
,
[
'phone'
=>
$this
->
params
[
'phone'
],
'status'
=>
0
]);
}
if
(
!
empty
(
$agents_data
))
{
$redis
=
new
VerifyRepetitionService
();
$is
=
$redis
->
verifyStart
(
2
,
$agents_data
[
'id'
],
0
);
}
if
(
$is
)
{
$insert_data
[
'update_time'
]
=
$agents_data
[
'update_time'
];
$insert_data
[
'call_number'
]
=
$agents_data
[
'call_number'
]
+
1
;
$data
[
'data'
]
=
$m_agents
->
editData
(
$insert_data
,
$agents_data
[
'id'
]);
}
}
else
{
$data
[
'status'
]
=
101
;
$data
[
'msg'
]
=
'phone is null'
;
}
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
}
application/api_broker/controller/OfficeBuilding.php
View file @
73a190f0
...
...
@@ -15,6 +15,9 @@ use app\index\service\OfficeService;
class
OfficeBuilding
extends
Basic
{
private
$service
;
private
$code
=
200
;
private
$msg
=
''
;
private
$data
=
[];
public
function
__construct
()
{
...
...
@@ -47,7 +50,8 @@ class OfficeBuilding extends Basic
* 办公楼详情
* @return \think\Response
*/
public
function
getOfficeBuildingInfo
(){
public
function
getOfficeBuildingInfo
()
{
$params
=
$this
->
params
;
$checkResult
=
$this
->
validate
(
$params
,
"OfficeRoomValidate.getOfficeRoomInfo"
);
if
(
true
!==
$checkResult
)
{
...
...
@@ -58,6 +62,24 @@ class OfficeBuilding extends Basic
$id
=
$params
[
'id'
];
$result
=
$s_office
->
getBuildingInfo
(
$id
);
return
$this
->
response
(
$result
[
'status'
],
$result
[
'msg'
],
$result
[
'data'
]);
return
$this
->
response
(
$result
[
'status'
],
$result
[
'msg'
],
$result
[
'data'
]);
}
/**
* 楼盘列表
*
* @return \think\Response
*/
public
function
getBuildingRoom
()
{
$result
=
$this
->
service
->
getBuildingList
(
$this
->
params
);
if
(
$result
[
'status'
]
==
'successful'
)
{
$this
->
data
=
$result
[
'data'
];
}
else
{
$this
->
code
=
101
;
$this
->
msg
=
$result
[
'msg'
];
}
return
$this
->
response
(
$this
->
code
,
$this
->
msg
,
$this
->
data
);
}
}
\ No newline at end of file
application/api_broker/controller/OfficeRoom.php
View file @
73a190f0
...
...
@@ -17,6 +17,9 @@ use app\model\OfficeGBuilding;
class
OfficeRoom
extends
Basic
{
private
$service
;
private
$code
=
200
;
private
$data
=
[];
private
$msg
=
''
;
public
function
__construct
()
{
...
...
@@ -34,14 +37,12 @@ class OfficeRoom extends Basic
*/
public
function
delHouseFile
()
{
$msg
=
''
;
$code
=
200
;
$result
=
$this
->
service
->
delHouseFile
(
$this
->
params
[
'id'
],
$this
->
params
[
'house_id'
],
$this
->
params
[
'save_path'
]);
if
(
$result
[
'status'
]
==
'fail'
)
{
$code
=
101
;
$msg
=
'删除失败'
;
$
this
->
code
=
101
;
$
this
->
msg
=
'删除失败'
;
}
return
$this
->
response
(
$
code
,
$
msg
);
return
$this
->
response
(
$
this
->
code
,
$this
->
msg
);
}
/**
...
...
@@ -51,36 +52,33 @@ class OfficeRoom extends Basic
*/
public
function
edit
()
{
$result
[
'code'
]
=
200
;
$result
[
'msg'
]
=
''
;
$result_data
=
[];
if
(
$this
->
request
->
isPost
())
{
$data
=
$this
->
service
->
edit
(
$this
->
params
,
$this
->
agentId
,
$this
->
siteId
);
if
(
$data
[
'status'
]
==
'successful'
)
{
$
result_
data
[
'house_id'
]
=
$data
[
'data'
][
'house_id'
];
$
result
[
'msg'
]
=
'新增或编辑成功'
;
$
this
->
data
[
'house_id'
]
=
$data
[
'data'
][
'house_id'
];
$
this
->
msg
=
'新增或编辑成功'
;
}
else
{
$
result
[
'code'
]
=
101
;
$
result
[
'msg'
]
=
$data
[
'msg'
];
$
this
->
code
=
101
;
$
this
->
msg
=
$data
[
'msg'
];
}
}
else
{
if
(
empty
(
$this
->
params
[
'id'
]))
{
$
result
[
'code'
]
=
101
;
$
result
[
'msg'
]
=
'Id is null'
;
$
this
->
code
=
101
;
$
this
->
msg
=
'Id is null'
;
}
else
{
//获取商铺详情
$data
=
$this
->
service
->
getOfficeRoomDetail
(
$this
->
params
[
'id'
],
1
);
if
(
$data
[
'status'
]
==
'successful'
)
{
$
result_
data
=
$data
[
'data'
];
$
this
->
data
=
$data
[
'data'
];
}
else
{
$
result
[
'msg'
]
=
$data
[
'msg'
];
$
result
[
'code'
]
=
101
;
$
this
->
msg
=
$data
[
'msg'
];
$
this
->
code
=
101
;
}
}
}
return
$this
->
response
(
$
result
[
'code'
],
$result
[
'msg'
],
$result_
data
);
return
$this
->
response
(
$
this
->
code
,
$this
->
msg
,
$this
->
data
);
}
...
...
@@ -114,22 +112,19 @@ class OfficeRoom extends Basic
*/
public
function
getBuildingSearch
()
{
$msg
=
''
;
$data
=
[];
$code
=
200
;
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$building_service
=
new
OfficeService
();
$result
=
$building_service
->
BuildingSearch
(
$pageNo
,
$pageSize
,
$this
->
params
);
if
(
$result
[
'status'
]
==
'fail'
)
{
$code
=
101
;
$msg
=
$result
[
'msg'
];
$
this
->
code
=
101
;
$
this
->
msg
=
$result
[
'msg'
];
}
else
{
$data
=
$result
[
'data'
];
$
this
->
data
=
$result
[
'data'
];
}
return
$this
->
response
(
$
code
,
$msg
,
$
data
);
return
$this
->
response
(
$
this
->
code
,
$this
->
msg
,
$this
->
data
);
}
/**
...
...
@@ -139,20 +134,30 @@ class OfficeRoom extends Basic
*/
public
function
getBuildingDetail
()
{
$msg
=
''
;
$data
=
[];
$code
=
200
;
$building_service
=
new
OfficeService
();
$result
=
$building_service
->
getOfficeDetail
(
$this
->
params
[
'id'
]);
if
(
$result
[
'status'
]
==
'fail'
)
{
$code
=
101
;
$msg
=
$result
[
'msg'
];
$
this
->
code
=
101
;
$
this
->
msg
=
$result
[
'msg'
];
}
else
{
$data
=
$result
[
'data'
];
$
this
->
data
=
$result
[
'data'
];
}
return
$this
->
response
(
$
code
,
$msg
,
$
data
);
return
$this
->
response
(
$
this
->
code
,
$this
->
msg
,
$this
->
data
);
}
/**
* 楼盘房源列表
*
* @return \think\Response
*/
public
function
getList
()
{
$result
=
$this
->
service
->
getRoomList
(
$this
->
params
);
if
(
$result
[
'status'
]
==
'successful'
)
{
$this
->
data
=
$result
[
'data'
];
}
return
$this
->
result
(
$this
->
code
,
$this
->
msg
,
$this
->
data
);
}
}
\ No newline at end of file
application/index/service/OfficeService.php
View file @
73a190f0
...
...
@@ -259,7 +259,7 @@ class OfficeService
}
$field
=
'id,title,address,type,floor_total,business_district_id,intro'
;
$data
=
$this
->
m_office
->
getList
(
$page_
size
,
$page_no
,
''
,
$field
,
$where
);
$data
=
$this
->
m_office
->
getList
(
$page_
no
,
$page_size
,
''
,
$field
,
$where
);
if
(
$is_total
)
{
$result
[
'total'
]
=
$this
->
m_office
->
getTotal
(
$where
);
}
...
...
@@ -456,34 +456,104 @@ class OfficeService
return
$res
;
}
public
function
getBuilding
(
$params
)
/**
* @param $params
* @return array
*/
public
function
getBuildingList
(
$params
)
{
if
(
isset
(
$params
[
'title'
]))
{
$where
[
'title'
]
=
[
'LIKE'
,
'%'
.
$params
[
'title'
]
.
'%'
];
$page_no
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$page_size
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$where
=
[];
if
(
isset
(
$params
[
'city'
]))
{
$where
[
'a.city'
]
=
$params
[
'city'
];
//市
}
if
(
isset
(
$params
[
'disc'
]))
{
$where
[
'disc'
]
=
$params
[
'disc'
];
$where
[
'a.disc'
]
=
$params
[
'disc'
];
//区
}
if
(
isset
(
$params
[
'title'
]))
{
$where
[
'a.title'
]
=
[
'LIKE'
,
'%'
.
$params
[
'title'
]
.
'%'
];
//楼盘名
}
if
(
isset
(
$params
[
'id'
]))
{
$where
[
'a.id'
]
=
$params
[
'id'
];
}
if
(
isset
(
$params
[
'`business_district_id`'
]))
{
$where
[
'business_district_id'
]
=
$params
[
'business_district_id'
];
$where
[
'a.business_district_id'
]
=
$params
[
'business_district_id'
];
//商圈id
}
if
(
isset
(
$params
[
'area_start'
]))
{
$where
[
'b.area'
]
=
[
'>'
,
$params
[
'area_start'
]];
//面积
}
if
(
isset
(
$params
[
'area_end'
]))
{
$where
[
'b.area'
]
=
[
'<'
,
$params
[
'area_end'
]];
//面积
}
if
(
isset
(
$params
[
'area_start'
])
&&
$params
[
'area_end'
])
{
$where
[
'b.area'
]
=
[
'between'
,
[
$params
[
'area_start'
],
$params
[
'area_end'
]]];
//面积
}
if
(
isset
(
$params
[
'type'
]))
{
$where
[
'
type'
]
=
$params
[
'type'
];
$where
[
'
a.type'
]
=
$params
[
'type'
];
//1.写字楼 2商住两用 3园区 4.洋房 5联合办公 6厂房
}
if
(
isset
(
$params
[
'
id
'
]))
{
$where
[
'
id'
]
=
$params
[
'id'
];
if
(
isset
(
$params
[
'
price_start
'
]))
{
$where
[
'
b.price'
]
=
$params
[
'price_start'
]
*
100
;
//租金单价
}
if
(
isset
(
$params
[
'
city
'
]))
{
$where
[
'
city'
]
=
$params
[
'city'
];
if
(
isset
(
$params
[
'
price_end
'
]))
{
$where
[
'
b.price'
]
=
$params
[
'price_end'
]
*
100
;
//租金单价
}
$field
=
'id,title,address,type,floor_total,business_district_id,intro'
;
$data
=
$this
->
m_office
->
getList
(
$page_size
,
$page_no
,
''
,
$field
,
$where
);
if
(
isset
(
$params
[
'price_start'
])
&&
isset
(
$params
[
'price_end'
]))
{
$where
[
'b.price'
]
=
[
'between'
,
[
$params
[
'price_start'
]
*
100
,
$params
[
'price_end'
]
*
100
]];
//租金单价
}
if
(
isset
(
$params
[
'is_exclusive_type'
]))
{
$where
[
'b.is_exclusive_type'
]
=
$params
[
'is_exclusive_type'
];
//是否独家0否1是
}
if
(
isset
(
$params
[
'agent_start_time'
])
&&
$params
[
'agent_end_time'
])
{
$where
[
'b.agent_start_time'
]
=
[
'>'
,
$params
[
'agent_start_time'
]];
//独家合同开始时间
$where
[
'b.agent_end_time'
]
=
[
'<'
,
$params
[
'agent_end_time'
]];
//独家合同结束时间
}
if
(
isset
(
$params
[
'is_rent'
]))
{
$where
[
'b.is_rent'
]
=
$params
[
'is_rent'
];
//是否已租 0未租 1已租
}
if
(
isset
(
$params
[
'status'
]))
{
$where
[
'a.status'
]
=
$params
[
'status'
];
//状态 1上架 2下架
}
if
(
isset
(
$params
[
'shop_sign'
]))
{
$where
[
'b.shop_sign'
]
=
[
'like'
,
'%'
.
$params
[
'shop_sign'
]
.
'%'
];
//商铺标签
}
$field
=
'a.id,a.disc,b.area,b.price,title,address,c.name as business_name,b.shop_sign,b.price_total'
;
try
{
$data
=
$this
->
m_office
->
getBuildingRoom
(
$page_no
,
$page_size
,
''
,
$field
,
$where
);
}
catch
(
\Exception
$e
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
$e
->
getMessage
();
return
$result
;
}
$result_data
=
[];
foreach
(
$data
as
$k
=>
$v
)
{
$tmp
[
'id'
]
=
$v
[
'id'
];
$tmp
[
'title'
]
=
$v
[
'disc'
]
.
' '
.
$v
[
'business_name'
]
.
' '
.
$v
[
'title'
]
.
' '
.
$v
[
'area'
]
.
'㎡'
;
$tmp
[
'price'
]
=
$v
[
'price'
]
/
100
;
$tmp
[
'price_total'
]
=
$v
[
'price_total'
]
/
100
;
$tmp
[
'shop_sign'
]
=
empty
(
$v
[
'shop_sign'
])
?
''
:
$v
[
'shop_sign'
];
$result_data
[]
=
$tmp
;
}
$result
[
'status'
]
=
'successful'
;
$result
[
'data'
]
=
$result_data
;
return
$result
;
}
}
\ No newline at end of file
application/model/OfficeGBuilding.php
View file @
73a190f0
...
...
@@ -119,6 +119,14 @@ class OfficeGBuilding extends BaseModel
->
find
();
}
/**
* @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
getBuildingInfo
(
$field
,
$where
)
{
$where
[
'a.is_del'
]
=
0
;
return
$this
->
db_
->
field
(
$field
)
...
...
@@ -127,4 +135,29 @@ class OfficeGBuilding extends BaseModel
->
where
(
$where
)
->
find
();
}
/**
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getBuildingRoom
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'a.id desc'
,
$field
=
''
,
$params
=
''
)
{
$params
[
'a.is_del'
]
=
0
;
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'office_g_room b'
,
'a.id = b.building_id'
,
'left'
)
->
join
(
'g_business_district c'
,
'a.business_district_id = c.id'
,
'left'
)
->
where
(
$params
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
group
(
'a.id'
)
->
select
();
}
}
application/model/OfficeOMarchInModel.php
View file @
73a190f0
...
...
@@ -408,7 +408,7 @@ class OfficeOMarchInModel extends Model
public
function
getMaxMarchInAgent
(
$field
,
$where
)
{
return
$this
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'o_order b'
,
'a.order_id = b.id'
,
'left'
)
->
join
(
'o
ffice_o
_order b'
,
'a.order_id = b.id'
,
'left'
)
->
where
(
$where
)
->
group
(
'a.reception_id '
)
->
find
();
...
...
application/route.php
View file @
73a190f0
...
...
@@ -975,6 +975,7 @@ Route::group('office', [
'filtrateConditionRoom'
=>
[
'api/shop/filtrateConditionRoom'
,
[
'method'
=>
'get | post'
]],
'addCollectHouse'
=>
[
'api_broker/OfficeCollectHouse/addCollectHouse'
,
[
'method'
=>
'POST|GET'
]],
//收藏或取消收藏商铺
'getCollectHouseList'
=>
[
'api_broker/OfficeCollectHouse/getCollectHouseList'
,
[
'method'
=>
'POST|GET'
]],
//查询收藏数据
'getBuildingRoom'
=>
[
'api_broker/OfficeBuilding/getBuildingRoom'
,
[
'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