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
857ec264
Commit
857ec264
authored
Apr 12, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
缓存角色站点
parent
b55785a3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
15 deletions
+69
-15
RedisCacheService.php
application/api_broker/service/RedisCacheService.php
+28
-3
Auth.php
application/index/controller/Auth.php
+2
-0
Broker.php
application/index/controller/Broker.php
+15
-10
Basic.php
application/index/extend/Basic.php
+1
-0
AAgents.php
application/model/AAgents.php
+21
-0
AuthGroupSite.php
application/model/AuthGroupSite.php
+2
-2
No files found.
application/api_broker/service/RedisCacheService.php
View file @
857ec264
...
...
@@ -16,6 +16,7 @@ use app\model\ADistrict;
use
app\model\ASite
;
use
app\model\AStore
;
use
app\model\AuthGroup
;
use
app\model\AuthGroupSite
;
use
app\model\AuthRule
;
use
app\model\ULabels
;
use
app\model\Users
;
...
...
@@ -29,6 +30,7 @@ class RedisCacheService
private
$rule_key
=
'cache_rule_'
;
private
$site_city_key
=
'cache_site_city_'
;
private
$label_call_key
=
'cache_label_call'
;
private
$group_site_key
=
'cache_group_site_'
;
private
$time
;
private
$max_time
;
...
...
@@ -277,7 +279,26 @@ class RedisCacheService
}
/**
* @param $type 1:客户 2:经纪人 3:角色组 4:站点城市
* 缓存角色站点
*
* @param $id
* @return mixed
*/
public
function
groupSiteCache
(
$id
)
{
$group_site
=
new
AuthGroupSite
();
$site_id
=
$group_site
->
getGroupSiteField
(
'site_id'
,
[
'status'
=>
0
,
'group_id'
=>
$id
]);
//获取标签
if
(
$site_id
)
{
$this
->
setRedisCache
(
$this
->
group_site_key
.
$id
,
$site_id
);
}
else
{
$site_id
=
''
;
}
return
$site_id
;
}
/**
* @param $type 1:客户 2:经纪人 3:角色组 4:站点城市 5:角色站点
* @param $id
* @return array|bool|false|mixed|\PDOStatement|string|\think\Model
*/
...
...
@@ -315,8 +336,12 @@ class RedisCacheService
$result
=
$this
->
redis_ext
->
get
(
$this
->
site_city_key
.
$id
);
if
(
empty
(
$result
))
{
$result
=
$this
->
siteCityCache
(
$id
);
}
else
{
$result
=
json_decode
(
$result
,
true
);
}
break
;
case
5
:
$result
=
$this
->
redis_ext
->
get
(
$this
->
group_site_key
.
$id
);
if
(
empty
(
$result
))
{
$result
=
$this
->
groupSiteCache
(
$id
);
}
break
;
default
:
...
...
application/index/controller/Auth.php
View file @
857ec264
...
...
@@ -509,6 +509,8 @@ class Auth extends Basic
$data
[
'site_id'
]
=
$this
->
params
[
'site_id_string'
];
$num
=
$m_auth
->
editData
(
$data
,
$this
->
params
[
'id'
]);
if
(
$num
>
0
)
{
$redis
=
new
RedisCacheService
();
$redis
->
groupSiteCache
(
$this
->
params
[
'group_id'
]);
$msg
=
"操作成功"
;
}
else
{
$code
=
101
;
...
...
application/index/controller/Broker.php
View file @
857ec264
...
...
@@ -9,6 +9,7 @@
namespace
app\index\controller
;
use
app\api_broker\service\RedisCacheService
;
use
app\api_broker\service\VipService
;
use
app\index\service\BrokerService
;
use
app\api_broker\service\CallPhoneService
;
...
...
@@ -95,27 +96,31 @@ class Broker extends Basic
$where
=
[];
}
if
(
$this
->
params
[
'phone'
]
)
{
if
(
!
empty
(
$this
->
params
[
'phone'
])
)
{
$where
[
'concat(phone,name)'
]
=
[
'LIKE'
,
'%'
.
$this
->
params
[
'phone'
]
.
'%'
];
}
if
(
$this
->
params
[
'level'
]
)
{
if
(
!
empty
(
$this
->
params
[
'level'
])
)
{
$where
[
'level'
]
=
[
'IN'
,
$this
->
params
[
'level'
]
];
}
if
(
$this
->
params
[
'store_id'
]
)
{
if
(
!
empty
(
$this
->
params
[
'store_id'
])
)
{
$where
[
'store_id'
]
=
$this
->
params
[
'store_id'
];
}
if
(
$this
->
params
[
'district_id'
]
)
{
if
(
!
empty
(
$this
->
params
[
'district_id'
])
)
{
$where
[
'district_id'
]
=
$this
->
params
[
'district_id'
];
}
if
(
$this
->
userId
!=
1
)
{
$group_site
=
new
AuthGroupSite
();
$agent_model
=
new
AAgents
();
$auth_group_id
=
$agent_model
->
getAgentFieldById
(
$this
->
userId
,
'auth_group_id'
);
$site_id
=
$group_site
->
getAgentField
(
'site_id'
,
[
'group_id'
=>
$auth_group_id
]);
// $group_site = new AuthGroupSite();
// $agent_model = new AAgents();
// $auth_group_id = $agent_model->getAgentFieldById($this->userId, 'auth_group_id');
// $site_id = $group_site->getGroupSiteField('site_id', ['group_id'=>$auth_group_id]);
$redis_service
=
new
RedisCacheService
();
$agent_data
=
$redis_service
->
getRedisCache
(
2
,
$this
->
userId
);
$site_id
=
$redis_service
->
getRedisCache
(
5
,
$agent_data
[
'auth_group_id'
]);
if
(
empty
(
$site_id
))
{
$where
[
'site_id'
]
=
$this
->
siteId
;
}
else
{
...
...
@@ -123,14 +128,14 @@ class Broker extends Basic
}
}
if
(
$this
->
params
[
'position'
]
==
-
1
)
{
if
(
isset
(
$this
->
params
[
'position'
])
&&
$this
->
params
[
'position'
]
==
-
1
)
{
$where
[
'position'
]
=
5
;
}
if
(
$where
)
{
$agent
=
new
AAgents
();
$field
=
'id,name,phone,status'
;
$data
[
'data'
]
=
$agent
->
getList
(
$pageNo
,
$pageSize
,
'id DESC'
,
$field
,
''
,
$where
);
$data
[
'data'
]
=
$agent
->
getList
V2
(
$pageNo
,
$pageSize
,
'id DESC'
,
$field
,
$where
);
}
else
{
$data
[
'msg'
]
=
'没有经纪人信息'
;
}
...
...
application/index/extend/Basic.php
View file @
857ec264
...
...
@@ -87,6 +87,7 @@ class Basic extends Controller
'index/getActivityCoupon'
,
'index/ceshi'
,
'index/baiduText'
,
'index/getBroker_new'
,
);
/**
...
...
application/model/AAgents.php
View file @
857ec264
...
...
@@ -364,6 +364,27 @@ class AAgents extends BaseModel
return
$data
;
}
/**
*
* @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
getListV2
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
return
$this
->
field
(
$field
)
->
where
(
$params
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
}
/**
* 统计任务获取经纪人列表
*
...
...
application/model/AuthGroupSite.php
View file @
857ec264
...
...
@@ -71,11 +71,11 @@ class AuthGroupSite extends BaseModel
}
/**
* @param $id
* @param $fields
* @param $where
* @return mixed
*/
public
function
get
Agent
Field
(
$fields
,
$where
)
public
function
get
GroupSite
Field
(
$fields
,
$where
)
{
return
$this
->
where
(
$where
)
->
value
(
$fields
);
}
...
...
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