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
36259fb8
Commit
36259fb8
authored
May 08, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
个人中心升级看铺数
parent
1dbd7428
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
7 deletions
+38
-7
LookShop.php
application/api_broker/controller/LookShop.php
+9
-3
Shop.php
application/api_broker/controller/Shop.php
+9
-4
LookShopService.php
application/api_broker/service/LookShopService.php
+20
-0
No files found.
application/api_broker/controller/LookShop.php
View file @
36259fb8
...
...
@@ -70,15 +70,20 @@ class LookShop extends Basic{
if
(
count
(
$agentList
)
<=
0
){
return
$this
->
response
(
"101"
,
"request null"
);
}
$showArr
=
[];
$noShowArr
=
[];
foreach
(
$agentList
as
$key
=>
$item
){
$residue_num
=
$this
->
lookShopService_
->
isLookShop
(
$item
[
"id"
]);
if
(
$residue_num
<=
0
){
$agentList
[
$key
][
"is_show_button"
]
=
true
;
$item
[
"is_show_button"
]
=
true
;
array_push
(
$showArr
,
$item
);
}
else
{
$agentList
[
$key
][
"is_show_button"
]
=
false
;
$item
[
"is_show_button"
]
=
false
;
array_push
(
$noShowArr
,
$item
);
}
}
return
$this
->
response
(
"200"
,
"request success"
,
$agentList
);
array_push
(
$showArr
,
$noShowArr
);
return
$this
->
response
(
"200"
,
"request success"
,
$showArr
);
}
}
\ No newline at end of file
application/api_broker/controller/Shop.php
View file @
36259fb8
...
...
@@ -176,7 +176,7 @@ class Shop extends Basic
$param
[
"img_type"
]
=
1
;
//默认主图
$result
[
$key
][
"images"
]
=
$this
->
gHousesImgModel
->
getHouseImages
(
$param
,
1
);
if
(
$params
[
"site_area"
]
==
3
)
{
$isLook
=
$this
->
lookShopService_
->
isLooked
(
$this
->
agentId
,
$val
[
"id"
]);
$isLook
=
$this
->
lookShopService_
->
isLooked
(
$this
->
agentId
,
$val
[
"id"
]);
$result
[
$key
][
"is_look"
]
=
$isLook
;
}
}
...
...
@@ -282,10 +282,15 @@ class Shop extends Basic
if
(
$params
[
"site_area"
]
==
3
&&
$result
)
{
$lookShopArr
=
$this
->
lookShopService_
->
countLookShopNum
((
int
)
$this
->
agentId
,
(
int
)
$params
[
"id"
]);
//判断看铺数量是否上限
if
(
$lookShopArr
[
"residue_num"
]
==
0
&&
!
$lookShopArr
[
"isExist"
]
&&
!
$lookShopArr
[
"isPanParty"
])
{
return
$this
->
response
(
"102"
,
"您今天的看铺数量已达上限!"
);
if
(
$lookShopArr
)
{
if
(
$lookShopArr
[
"residue_num"
]
==
0
&&
!
$lookShopArr
[
"isExist"
]
&&
!
$lookShopArr
[
"isPanParty"
])
{
Log
::
record
(
'info ----countLookShopNum------121113-'
,
"info"
);
return
$this
->
response
(
"102"
,
"您今天的看铺数量已达上限!"
);
}
$result
[
"lookShopArr"
]
=
$lookShopArr
;
}
$result
[
"lookShopArr"
]
=
$lookShopArr
;
}
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
}
...
...
application/api_broker/service/LookShopService.php
View file @
36259fb8
...
...
@@ -3,6 +3,7 @@
namespace
app\api_broker\service
;
use
app\extra\RedisExt
;
use
app\model\AAgents
;
use
app\model\GHousesToAgents
;
use
think\Log
;
...
...
@@ -18,6 +19,7 @@ class LookShopService
private
$redis
;
private
$nowTime
;
private
$gHousesToAgentsModel
;
private
$agentsModel
;
const
LOOK_SHOP
=
"look_shop_"
;
//存入已看的楼盘id
const
LOOK_TOTAL
=
"look_total_"
;
//记录每个经纪人的看铺总数
...
...
@@ -27,13 +29,31 @@ class LookShopService
$this
->
redis
=
RedisExt
::
getRedis
();
$this
->
nowTime
=
date
(
"Y-m-d"
,
time
());
$this
->
gHousesToAgentsModel
=
new
GHousesToAgents
();
$this
->
agentsModel
=
new
AAgents
();
}
/**
* 验证数量
* @param int $agent_id
* @param int $house_id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
countLookShopNum
(
int
$agent_id
,
int
$house_id
)
:
array
{
//todo 1.取读控制里面的看铺数量,2.取出此经济人已看数量和商铺 3.判断时间,每天刷新看铺数量
// todo 4.判断是否到达上限,if 上限 return false else return true
//todo 过滤掉店长以上的经纪人
$agentInfo
=
$this
->
agentsModel
->
getAgentById
(
"id,level"
,[
"agent_id"
=>
$agent_id
]);
Log
::
record
(
'info ----countLookShopNum-------'
.
json_encode
(
$agentInfo
),
"info"
);
if
(
$agentInfo
&&
$agentInfo
[
0
][
"level"
]
>
10
){
Log
::
record
(
'info ----countLookShopNum------123-'
,
"info"
);
return
[];
}
//过滤掉盘方为自己的
$params
[
"houses_id"
]
=
$house_id
;
$params
[
"agents_id"
]
=
$agent_id
;
...
...
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