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
ccff1ab9
Commit
ccff1ab9
authored
May 07, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
看铺数量控制
parent
548c4d55
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
3 deletions
+23
-3
Shop.php
application/api_broker/controller/Shop.php
+2
-1
LookShopService.php
application/api_broker/service/LookShopService.php
+12
-2
GHousesToAgents.php
application/model/GHousesToAgents.php
+9
-0
No files found.
application/api_broker/controller/Shop.php
View file @
ccff1ab9
...
...
@@ -275,11 +275,12 @@ class Shop extends Basic
$lookShopService_
=
new
LookShopService
();
//todo 计数开始
//todo 判断盘方是否是自己
if
(
$params
[
"site_area"
]
==
3
&&
$result
){
$lookShopArr
=
$lookShopService_
->
countLookShopNum
((
int
)
$this
->
agentId
,(
int
)
$params
[
"id"
]);
if
(
$lookShopArr
[
"residue_num"
]
==
0
&&
!
$lookShopArr
[
"isExist"
]){
//todo 判断看铺数量是否上限
return
$this
->
response
(
"10
1
"
,
"您今天的看铺数量已达上限!"
);
return
$this
->
response
(
"10
2
"
,
"您今天的看铺数量已达上限!"
);
}
$result
[
"lookShopArr"
]
=
$lookShopArr
;
}
...
...
application/api_broker/service/LookShopService.php
View file @
ccff1ab9
...
...
@@ -3,6 +3,7 @@
namespace
app\api_broker\service
;
use
app\extra\RedisExt
;
use
app\model\GHousesToAgents
;
use
think\Log
;
/**
...
...
@@ -16,6 +17,7 @@ class LookShopService
{
private
$redis
;
private
$nowTime
;
private
$gHousesToAgentsModel
;
const
LOOK_SHOP
=
"look_shop_"
;
//存入已看的楼盘id
const
LOOK_TOTAL
=
"look_total_"
;
//记录每个经纪人的看铺总数
...
...
@@ -24,6 +26,7 @@ class LookShopService
$this
->
redis
=
RedisExt
::
getRedis
();
$this
->
nowTime
=
date
(
"Y-m-d"
,
time
());
$this
->
gHousesToAgentsModel
=
new
GHousesToAgents
();
}
...
...
@@ -31,16 +34,23 @@ class LookShopService
{
//todo 1.取读控制里面的看铺数量,2.取出此经济人已看数量和商铺 3.判断时间,每天刷新看铺数量
// todo 4.判断是否到达上限,if 上限 return false else return true
//过滤掉盘方为自己的
$params
[
"houses_id"
]
=
$house_id
;
$params
[
"agents_id"
]
=
$agent_id
;
$params
[
"type"
]
=
2
;
$params
[
"is_del"
]
=
1
;
$housesToAgents
=
$this
->
gHousesToAgentsModel
->
getHouseToAgents
(
"id"
,
$params
);
$isPanParty
=
count
(
$housesToAgents
)
>
0
?
true
:
false
;
//判断楼盘是否看过,看过了则不判断数量
$isExist
=
$this
->
isLooked
(
$agent_id
,
$house_id
);
$lookShopNum
=
$this
->
isLookShop
(
$agent_id
);
if
(
$lookShopNum
>
0
&&
!
$isExist
)
{
if
(
$lookShopNum
>
0
&&
!
$isExist
&&
!
$isPanParty
)
{
$this
->
redis
->
sAdd
(
self
::
LOOK_SHOP
.
$this
->
nowTime
.
$agent_id
,
$house_id
);
//存入楼盘信息
$this
->
incrementLookNum
(
$agent_id
);
}
$totalNum
=
$this
->
redis
->
hGet
(
self
::
LOOK_TOTAL
.
$this
->
nowTime
,
$agent_id
);
return
[
"total_num"
=>
$totalNum
,
"residue_num"
=>
$lookShopNum
,
"isExist"
=>
$isExist
];
return
[
"total_num"
=>
$totalNum
,
"residue_num"
=>
$lookShopNum
,
"isExist"
=>
$isExist
,
"isPanParty"
=>
$isPanParty
];
}
...
...
application/model/GHousesToAgents.php
View file @
ccff1ab9
...
...
@@ -262,4 +262,13 @@ class GHousesToAgents extends BaseModel
public
function
updateUserAll
(
$data
)
{
return
$this
->
saveAll
(
$data
);
}
public
function
getHouseToAgents
(
$field
,
$params
){
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$params
)
->
limit
(
1
)
->
select
();
}
}
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