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
2c66a3d8
Commit
2c66a3d8
authored
Jun 03, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收藏商铺
parent
b8570eb0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
282 additions
and
0 deletions
+282
-0
OfficeCollectHouse.php
application/api_broker/controller/OfficeCollectHouse.php
+170
-0
OfficeACollectHouse.php
application/model/OfficeACollectHouse.php
+110
-0
route.php
application/route.php
+2
-0
No files found.
application/api_broker/controller/OfficeCollectHouse.php
0 → 100644
View file @
2c66a3d8
<?php
namespace
app\api_broker\controller
;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2018/7/4
* Time: 下午3:25
*/
use
app\api_broker\extend\Basic
;
use
app\api_broker\service\LookShopService
;
use
app\api_broker\service\VipService
;
use
app\model\GHousesToAgents
;
use
app\model\OfficeACollectHouse
;
class
OfficeCollectHouse
extends
Basic
{
protected
$aCollectHouse
;
public
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
aCollectHouse
=
new
OfficeACollectHouse
();
}
/**
* 收藏或取消收藏商铺
* User: 朱伟
* Date: 2018-07-04
* Time: 15:35:40
*/
public
function
addCollectHouse
(){
$params
=
$this
->
params
;
/*$params = array(
"agents_id" => 1,
"house_id" => 4,
"status" => 2,
);*/
if
(
!
isset
(
$params
[
"agents_id"
])
or
!
isset
(
$params
[
"house_id"
])
or
!
isset
(
$params
[
"status"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
//先判断是否已经存在数据
$field
=
'id,status'
;
$get_params
[
'agents_id'
]
=
$params
[
"agents_id"
];
$get_params
[
'house_id'
]
=
$params
[
"house_id"
];
$res
=
$this
->
aCollectHouse
->
getCollectHouse
(
$field
,
$get_params
);
if
(
$res
)
{
if
(
count
(
$res
)
>
1
)
{
//数据大于1,全部重置为2
$this
->
aCollectHouse
->
updateStatus
(
$params
[
"agents_id"
],
$params
[
"house_id"
]);
}
if
(
$res
[
0
][
'status'
]
!=
$params
[
"status"
])
{
//状态不一致 更新状态
$insert
[
"id"
]
=
$res
[
0
][
'id'
];
$insert
[
"status"
]
=
$params
[
"status"
];
$res
=
$this
->
aCollectHouse
->
updateCollectHouse
(
$insert
);
//int(1)
}
else
{
//状态一致 不作处理
$res
=
true
;
}
}
else
{
$insert
[
"agents_id"
]
=
$params
[
'agents_id'
];
$insert
[
"house_id"
]
=
$params
[
'house_id'
];
$insert
[
"status"
]
=
1
;
$res
=
$this
->
aCollectHouse
->
saveCollectHouse
(
$insert
);
//int(1)
}
if
(
$res
)
{
return
$this
->
response
(
"200"
,
"成功"
);
}
else
{
return
$this
->
response
(
"101"
,
"失败"
);
}
}
/**
* 查询收藏数据
* User: 朱伟
* Date: 2018-07-04
* Time: 15:35:40
*/
public
function
getCollectHouseList
()
{
$params
=
$this
->
params
;
/*$params = array(
"agents_id" => 5740,
"from" => 1,
);*/
if
(
!
isset
(
$params
[
"agents_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$field
=
'CollectUser.id as collect_user_id,'
;
$field
.=
'Houses.id,'
;
$field
.=
'Houses.internal_title as title,'
;
$field
.=
'Houses.business_district_id,'
;
$field
.=
'Houses.status,'
;
$field
.=
'Houses.industry_type,'
;
$field
.=
'Houses.shop_area_start,'
;
$field
.=
'Houses.shop_area_end,'
;
$field
.=
'Houses.shop_type,'
;
$field
.=
'Houses.shop_sign,'
;
$field
.=
'Houses.residue_num,'
;
$field
.=
'Houses.rent_type,'
;
$field
.=
'Houses.rent_price,'
;
$field
.=
'Houses.is_lock,'
;
$field
.=
'Houses.is_vip,'
;
$field
.=
'Houses.is_exclusive_type,'
;
$field
.=
'Houses.disc'
;
$get_params
[
'agents_id'
]
=
$params
[
"agents_id"
];
$get_params
[
'CollectUser.status'
]
=
1
;
$res
=
$this
->
aCollectHouse
->
getCollectList
(
$pageNo
,
$pageSize
,
$field
,
$get_params
);
$res_total
=
$this
->
aCollectHouse
->
getCollectListTotal
(
$field
,
$get_params
);
$look_shop_service
=
new
LookShopService
();
foreach
(
$res
as
$key
=>
$val
)
{
$isLook
=
$look_shop_service
->
isLooked
(
$params
[
"agents_id"
],
$val
[
"id"
]);
$res
[
$key
][
"is_look"
]
=
$isLook
;
$res
[
$key
][
"rent_price"
]
=
$val
[
"rent_price"
]
*
0.01
;
$res
[
$key
][
"rent_price"
]
=
$val
[
"rent_price"
]
*
0.01
;
//锁盘后,盘方、独家方、有权限的可以查看
$res
[
$key
][
"look_lock"
]
=
0
;
if
(
isset
(
$val
[
'is_lock'
])
&&
$val
[
'is_lock'
]
==
1
)
{
$vip
=
new
VipService
();
if
(
!
$vip
->
vip
(
$this
->
agentId
,
'index/lockHouse'
))
{
$res
[
$key
][
"look_lock"
]
=
1
;
}
$m_agent
=
new
GHousesToAgents
();
$agent_where
[
'a.agents_id'
]
=
$this
->
agentId
;
$agent_where
[
'a.type'
]
=
[
'in'
,
'2,3'
];
$agent_where
[
'a.houses_id'
]
=
$val
[
'id'
];
$agent_where
[
'a.is_del'
]
=
0
;
$agent_data
=
$m_agent
->
getAgentsHouseField
(
'a.id'
,
$agent_where
);
foreach
(
$agent_data
as
$vvv
)
{
if
(
$vvv
>
0
)
{
$res
[
$key
][
"look_lock"
]
=
1
;
}
}
}
}
//这里为了将APP跟后台区分开来,pc后台需要total,app不需要
if
(
isset
(
$params
[
"from"
])
&&
(
$params
[
"from"
]
==
1
))
{
return
$this
->
response
(
"200"
,
"成功"
,[
'data'
=>
$res
,
'total'
=>
$res_total
]);
}
else
{
return
$this
->
response
(
"200"
,
"成功"
,
$res
);
}
}
}
\ No newline at end of file
application/model/OfficeACollectHouse.php
0 → 100644
View file @
2c66a3d8
<?php
namespace
app\model
;
use
think\Db
;
use
think\Model
;
class
OfficeACollectHouse
extends
Model
{
// 设置当前模型对应的完整数据表名称
protected
$table
=
'office_a_collect_house'
;
public
function
saveCollectHouse
(
$data
)
{
$time
=
date
(
"Y-m-d H:i:s"
,
time
());
$data
[
'create_time'
]
=
$time
;
$data
[
'update_time'
]
=
$time
;
return
$this
->
insert
(
$data
);
}
/**
* 查询数据
* 朱伟 2018-07-04
*/
public
function
getCollectHouse
(
$field
,
$params
)
{
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
//->alias('a')
->
where
(
$params
)
->
select
();
//dump($this->getLastSql());
return
$result
;
}
/**
* 更新数据
* 朱伟 2018-07-04
*/
public
function
updateCollectHouse
(
$params
)
{
$result
=
$this
->
update
(
$params
);
//dump($this->getLastSql());
return
$result
;
}
/**
* 查询收藏数据
* 朱伟 2018-07-04
*/
public
function
getCollectList
(
$pageNo
,
$pageSize
,
$field
,
$params
)
{
$order
=
"CollectUser.update_time desc"
;
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
'CollectUser'
)
->
join
(
'g_houses Houses'
,
'CollectUser.house_id = Houses.id'
,
'right'
)
->
where
(
$params
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
order
(
$order
)
->
select
();
//dump($this->getLastSql());
return
$result
;
}
/**
* 查询收藏数据统计
* 朱伟 2018-08-10
*/
public
function
getCollectListTotal
(
$field
,
$params
)
{
$order
=
"CollectUser.create_time desc"
;
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
'CollectUser'
)
->
join
(
'g_houses Houses'
,
'CollectUser.house_id = Houses.id'
,
'left'
)
->
where
(
$params
)
->
count
();
//dump($this->getLastSql());
return
$result
;
}
/**
* 更新数据
* 朱伟 2018-08-08
*/
public
function
delCollectHouse
(
$id
)
{
$result
=
Db
::
table
(
$this
->
table
)
->
where
(
'house_id'
,
$id
)
->
update
([
'status'
=>
3
]);
//dump($this->getLastSql());
return
$result
;
}
public
function
updateStatus
(
$agents_id
,
$house_id
)
{
$result
=
$this
->
where
([
'agents_id'
=>
$agents_id
,
'house_id'
=>
$house_id
])
->
update
([
'status'
=>
2
]);
//dump($this->getLastSql());
// big_log($this->getLastSql());
return
$result
;
}
}
application/route.php
View file @
2c66a3d8
...
@@ -973,6 +973,8 @@ Route::group('office', [
...
@@ -973,6 +973,8 @@ Route::group('office', [
'getOfficeBuildingInfo'
=>
[
'api_broker/OfficeBuilding/getOfficeBuildingInfo'
,
[
'method'
=>
'GET|POST'
]
],
//办公楼详情
'getOfficeBuildingInfo'
=>
[
'api_broker/OfficeBuilding/getOfficeBuildingInfo'
,
[
'method'
=>
'GET|POST'
]
],
//办公楼详情
'getOfficeRoomInfo'
=>
[
'api_broker/OfficeRoom/getOfficeRoomInfo'
,
[
'method'
=>
'GET|POST'
]
],
//获取房源详情
'getOfficeRoomInfo'
=>
[
'api_broker/OfficeRoom/getOfficeRoomInfo'
,
[
'method'
=>
'GET|POST'
]
],
//获取房源详情
'filtrateConditionRoom'
=>
[
'api/shop/filtrateConditionRoom'
,
[
'method'
=>
'get | post'
]],
'filtrateConditionRoom'
=>
[
'api/shop/filtrateConditionRoom'
,
[
'method'
=>
'get | post'
]],
'addCollectHouse'
=>
[
'api_broker/OfficeCollectHouse/addCollectHouse'
,
[
'method'
=>
'POST|GET'
]],
//收藏或取消收藏商铺
'getCollectHouseList'
=>
[
'api_broker/OfficeCollectHouse/getCollectHouseList'
,
[
'method'
=>
'POST|GET'
]],
//查询收藏数据
]);
]);
Route
::
group
(
'office_index'
,
[
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