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
e1d42b42
Commit
e1d42b42
authored
Apr 29, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
494e29e7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
167 additions
and
14 deletions
+167
-14
Shop.php
application/api/controller/Shop.php
+12
-0
LookShopService.php
application/api_broker/service/LookShopService.php
+39
-10
LookShop.php
application/index/controller/LookShop.php
+55
-4
TLookShopUser.php
application/model/TLookShopUser.php
+59
-0
route.php
application/route.php
+2
-0
No files found.
application/api/controller/Shop.php
View file @
e1d42b42
...
...
@@ -418,6 +418,18 @@ class Shop extends Basic
$result
[
'shop_videos'
]
=
$s_house
->
getHouseVideoList
(
$params
[
"id"
]);
$result
[
'shop_videos_length'
]
=
$s_house
->
getHouseVideoLength
();
$lookShopArr
=
$this
->
lookShopService_
->
addUserLookShop
((
int
)
$params
[
"user_id"
],
(
int
)
$params
[
"id"
]);
//判断看铺数量是否上限
if
(
$lookShopArr
)
{
if
(
$lookShopArr
[
"residue_num"
]
==
0
&&
!
$lookShopArr
[
"isExist"
]
&&
!
$lookShopArr
[
"isPanParty"
])
{
Log
::
record
(
'info ----countLookShopNum------121113-'
,
"info"
);
return
$this
->
response
(
"102"
,
"您今天的看铺数量已达上限!"
);
}
$result
[
"lookShopArr"
]
=
$lookShopArr
;
}
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
}
...
...
application/api_broker/service/LookShopService.php
View file @
e1d42b42
...
...
@@ -6,6 +6,7 @@ use app\extra\RedisExt;
use
app\model\AAgents
;
use
app\model\GHousesToAgents
;
use
app\model\SystemConfig
;
use
app\model\TLookShopUser
;
use
RedisException
;
use
think\Exception
;
use
think\Log
;
...
...
@@ -25,6 +26,7 @@ class LookShopService
private
$agentsModel
;
private
$systemConfigModel
;
const
LOOK_SHOP
=
"look_shop_"
;
//存入已看的楼盘id
const
LOOK_SHOP_USER
=
"look_shop_user_"
;
//会员user
const
LOOK_TOTAL
=
"look_total_"
;
//记录每个经纪人的看铺总数
const
LOOK_UP_NUM
=
"look_up_num_"
;
//记录每个经纪人的看铺升级次数
...
...
@@ -57,12 +59,12 @@ class LookShopService
return
[];
}
//todo 过滤掉店长以上的经纪人 0824所有的都看铺限制
/* $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 [];
}*/
/* $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
;
...
...
@@ -80,7 +82,7 @@ class LookShopService
$this
->
incrementLookNum
(
$agent_id
);
}
$totalNum
=
$this
->
redis
->
hGet
(
self
::
LOOK_UP_NUM
.
$this
->
nowTime
,
$agent_id
)
*
$this
->
redis
->
get
(
"lookNum"
);
return
[
"total_num"
=>
$totalNum
,
"residue_num"
=>
$lookShopNum
,
"isExist"
=>
$isExist
,
"isPanParty"
=>
$isPanParty
];
return
[
"total_num"
=>
$totalNum
,
"residue_num"
=>
$lookShopNum
,
"isExist"
=>
$isExist
,
"isPanParty"
=>
$isPanParty
];
}
...
...
@@ -135,7 +137,7 @@ class LookShopService
$lookNum
=
50
;
//默认50看铺数量
if
(
!
$this
->
redis
->
get
(
"lookNum"
))
{
//数据库查询
$data
=
$this
->
systemConfigModel
->
getSetting
([
"config_type"
=>
40
],
"rule"
);
$data
=
$this
->
systemConfigModel
->
getSetting
([
"config_type"
=>
40
],
"rule"
);
if
(
$data
&&
$data
[
"agent_shop_num"
]
>
0
)
{
$lookNum
=
$data
[
"agent_shop_num"
];
}
...
...
@@ -183,10 +185,10 @@ class LookShopService
return
false
;
}
$agentUpNum
=
$this
->
redis
->
hGet
(
self
::
LOOK_UP_NUM
.
$this
->
nowTime
,
$agent_id
);
if
(
$agentUpNum
>=
2
)
{
if
(
$agentUpNum
>=
2
)
{
return
false
;
}
$upLookNum
=
(
int
)
$agentUpNum
+
1
;
$upLookNum
=
(
int
)
$agentUpNum
+
1
;
$this
->
redis
->
hSet
(
self
::
LOOK_UP_NUM
.
$this
->
nowTime
,
$agent_id
,
$upLookNum
);
return
true
;
}
...
...
@@ -202,6 +204,32 @@ class LookShopService
return
$agentUpNum
;
}
/**
* @param int $user_id
* @param int $house_id
* @return bool
*/
public
function
addUserLookShop
(
int
$user_id
,
int
$house_id
)
:
bool
{
$day
=
date
(
"Y-m-d"
,
time
());
$tModel
=
new
TLookShopUser
();
$params
[
"user_id"
]
=
$user_id
;
$params
[
"house_id"
]
=
$house_id
;
$params
[
"look_day"
]
=
$day
;
$result
=
$tModel
->
getList
(
$params
,
"id"
,
1
,
1
);
if
(
count
(
$result
)
>
0
){
return
false
;
}
$arr
=
array
(
"user_id"
=>
$user_id
,
"house_id"
=>
$house_id
,
"look_day"
=>
$day
,
"create_time"
=>
date
(
"Y-m-d H:i:s"
,
time
()),
"update_time"
=>
date
(
"Y-m-d H:i:s"
,
time
()),
);
$tModel
->
addLookShop
(
$arr
);
return
true
;
}
}
\ No newline at end of file
application/index/controller/LookShop.php
View file @
e1d42b42
...
...
@@ -9,8 +9,10 @@ namespace app\index\controller;
* Time : 14:37
* Intro:
*/
use
app\index\extend\Basic
;
use
app\model\TLookShopModel
;
use
app\model\TLookShopUser
;
class
LookShop
extends
Basic
{
...
...
@@ -43,19 +45,19 @@ class LookShop extends Basic
$condition
=
[];
if
(
!
empty
(
$params
[
"start_time"
])
&&
!
empty
(
$params
[
"end_time"
]))
{
$condition
[
"a.look_time"
]
=
array
(
"between"
,
array
(
$params
[
"start_time"
],
$params
[
"end_time"
]
.
" 23:59:59"
)
);
$condition
[
"a.look_time"
]
=
array
(
"between"
,
array
(
$params
[
"start_time"
],
$params
[
"end_time"
]
.
" 23:59:59"
)
);
}
if
(
!
empty
(
$params
[
"house_id"
]))
{
$condition
[
"a.house_id"
]
=
$params
[
"house_id"
];
}
if
(
!
empty
(
$params
[
"house_name"
]))
{
$condition
[
"b.internal_title"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
"house_name"
])
.
"%"
);
$condition
[
"b.internal_title"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
"house_name"
])
.
"%"
);
}
if
(
!
empty
(
$params
[
"agent_name"
]))
{
$condition
[
"a.agent_name"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
"agent_name"
])
.
"%"
);
$condition
[
"a.agent_name"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
"agent_name"
])
.
"%"
);
}
if
(
!
empty
(
$params
[
"agent_phone"
]))
{
$condition
[
"a.agent_phone"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
"agent_phone"
])
.
"%"
);
$condition
[
"a.agent_phone"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
"agent_phone"
])
.
"%"
);
}
if
(
$this
->
userId
!=
1
)
{
...
...
@@ -71,4 +73,52 @@ class LookShop extends Basic
return
$this
->
response
(
"200"
,
"success"
,
$list
);
}
public
function
lookShopUser
()
{
$params
=
$this
->
params
;
/*$params = array(
"start_time" => '2018-07-30',
"end_time" => '2018-07-31',
"house_id" => 3084,
"house_name" => "",
"user_name" => "",
"user_phone" => "",
"page_no" => 1,
"page_size" => 15
);*/
$pageNo
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$pageSize
=
empty
(
$params
[
'page_size'
])
?
25
:
$params
[
'page_size'
];
$condition
=
[];
if
(
!
empty
(
$params
[
"start_time"
])
&&
!
empty
(
$params
[
"end_time"
]))
{
$condition
[
"a.create_time"
]
=
array
(
"between"
,
array
(
$params
[
"start_time"
],
$params
[
"end_time"
]
.
" 23:59:59"
));
}
if
(
!
empty
(
$params
[
"house_id"
]))
{
$condition
[
"a.house_id"
]
=
$params
[
"house_id"
];
}
if
(
!
empty
(
$params
[
"house_name"
]))
{
$condition
[
"b.internal_title"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
"house_name"
])
.
"%"
);
}
if
(
!
empty
(
$params
[
"user_name"
]))
{
$condition
[
"c.user_name"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
"user_name"
])
.
"%"
);
}
if
(
!
empty
(
$params
[
"user_phone"
]))
{
$condition
[
"a.user_phone"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
"user_phone"
])
.
"%"
);
}
if
(
$this
->
userId
!=
1
)
{
$condition
[
"b.city"
]
=
$this
->
city
;
}
$field
=
"a.id,a.create_time,a.house_id,b.internal_title,c.user_name,c.user_phone"
;
$tLookShopUser
=
new
TLookShopUser
();
$result
=
$tLookShopUser
->
getList
(
$condition
,
$field
,
$pageNo
,
$pageSize
);
//$total = $this->tLookShopModel->getListCount($condition, $field);
$list
[
"list"
]
=
$result
;
$list
[
"total"
]
=
150
;
return
$this
->
response
(
"200"
,
"success"
,
$list
);
}
}
\ No newline at end of file
application/model/TLookShopUser.php
0 → 100644
View file @
e1d42b42
<?php
namespace
app\model
;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/4/29
* Time: 17:25
*/
use
think\Db
;
use
think\Model
;
class
TLookShopUser
extends
Model
{
protected
$table
=
"t_look_shop_user"
;
private
$db_
;
function
__construct
()
{
$this
->
db_
=
Db
::
name
(
$this
->
table
);
}
public
function
addLookShop
(
$params
)
{
Db
::
startTrans
();
try
{
$this
->
db_
->
insertAll
(
$params
);
Db
::
commit
();
return
1
;
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
0
;
}
}
public
function
getList
(
$condition
,
$field
,
$pageNo
,
$pageSize
)
{
return
$this
->
db_
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"g_houses b"
,
"a.house_id=b.id"
,
"left"
)
->
join
(
"u_users c"
,
"a.user_id=c.id"
,
"left"
)
->
where
(
$condition
)
->
page
(
$pageNo
)
->
limit
(
$pageSize
)
//->order("id desc")
->
select
();
}
public
function
getListCount
(
$condition
,
$field
)
{
return
$this
->
db_
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"g_houses b"
,
"a.house_id=b.id"
,
"left"
)
->
join
(
"u_users c"
,
"a.user_id=c.id"
,
"left"
)
->
where
(
$condition
)
->
count
();
}
}
\ No newline at end of file
application/route.php
View file @
e1d42b42
...
...
@@ -355,6 +355,8 @@ Route::group('index', [
'operationalData'
=>
[
'index/OperationalData/operationalDataList'
,
[
'method'
=>
'POST|GET'
]],
//运营数据统计liu
'siteList'
=>
[
'index/site/siteLogList'
,
[
'method'
=>
'POST|GET'
]],
//站点列表liu
'lookShopIndex'
=>
[
'index/LookShop/lookShopIndex'
,
[
'method'
=>
'GET'
]],
//商铺查看日志
'lookShopUser'
=>
[
'index/LookShop/lookShopUser'
,
[
'method'
=>
'GET'
]],
//用户商铺查看日志
'selectDistrictPerformance'
=>
[
'index/Performance/selectDistrictPerformance'
,
[
'method'
=>
'POST|GET'
]],
//区域业绩排行 朱伟 2018-07-31
'selectStorePerformance'
=>
[
'index/Performance/selectStorePerformance'
,
[
'method'
=>
'POST|GET'
]],
//门店业绩排行 朱伟 2018-07-31
'selectIndividualPerformance'
=>
[
'index/Performance/selectIndividualPerformance'
,
[
'method'
=>
'POST|GET'
]],
//个人业绩排行 朱伟 2018-07-31
...
...
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