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
1a6e4c25
Commit
1a6e4c25
authored
Jul 25, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
centerV2
parent
223ed239
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
0 deletions
+105
-0
MyCenterService.php
application/api_broker/service/MyCenterService.php
+58
-0
RedisCacheService.php
application/api_broker/service/RedisCacheService.php
+46
-0
route.php
application/route.php
+1
-0
No files found.
application/api_broker/service/MyCenterService.php
View file @
1a6e4c25
...
...
@@ -78,4 +78,61 @@ class MyCenterService{
}
return
$result
;
}
/**
* 我的个人中心
*
* @param $agent_id
* @return false|mixed|null|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
centerV2
(
$agent_id
){
$field
=
"a.id,a.store_id,a.auth_group_id,a.district_id,a.level,a.name,a.phone,a.sex,a.img,a.status,b.store_name,
c.district_name,a.position"
;
$params
[
"agent_id"
]
=
$agent_id
;
$result
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
$params
);
if
(
count
(
$result
)
<=
0
){
return
null
;
}
$result
=
$result
[
0
];
$level_name
=
self
::
USER_LEVEL_FIST
;
if
(
$result
[
"level"
]
==
20
){
$level_name
=
self
::
USER_LEVEL_SECOND
;
}
elseif
(
$result
[
"level"
]
==
30
||
$result
[
"level"
]
==
40
){
$level_name
=
self
::
USER_LEVEL_THIRD
;
}
$result
[
"level_name"
]
=
$level_name
;
$result
[
"sign"
]
=
$result
[
"district_name"
]
.
$result
[
"store_name"
];
if
(
!
empty
(
$result
[
"img"
])){
$result
[
"img"
]
=
AGENTHEADERIMGURL
.
$result
[
"img"
];
}
//todo 需要计算暂时没做。
//$result["money_total"] = 1000;
$result
[
'show_daily'
]
=
$result
[
'show_cost_list'
]
=
0
;
if
(
!
empty
(
$result
[
'auth_group_id'
]))
{
$redis
=
new
RedisCacheService
();
$auth_group
=
$redis
->
getRedisCache
(
3
,
$result
[
'auth_group_id'
]);
$result
[
'auth_group_name'
]
=
empty
(
$auth_group
[
'title'
])
?
''
:
$auth_group
[
'title'
];
$is_ok
=
$redis
->
checkRule
(
$redis
[
'id'
],
'index/dailyDetailsFinance'
);
if
(
!
$is_ok
)
{
$result
[
'show_daily'
]
=
1
;
//财务日报
}
$is_ok
=
$redis
->
checkRule
(
$redis
[
'id'
],
'broker/costListDistrict'
);
if
(
!
$is_ok
)
{
$result
[
'show_cost_list'
]
=
1
;
//显示费用申请
}
}
return
$result
;
}
}
\ No newline at end of file
application/api_broker/service/RedisCacheService.php
View file @
1a6e4c25
...
...
@@ -394,4 +394,49 @@ class RedisCacheService
$hash_key
=
$agent_id
.
'-'
.
$user_id
.
'-'
.
$site_id
;
return
$this
->
redis_ext
->
hDel
(
$user_key
,
$hash_key
);
}
/**
* 是否具有权限
*
* @param int $id
* @param string $name
* @return int 是否可以查看 0:可查看 1:不可查看
*/
public
function
checkRule
(
int
$id
,
string
$name
)
{
if
(
$id
==
1
)
{
return
0
;
}
try
{
$agent_data
=
$this
->
getRedisCache
(
2
,
$id
);
if
(
empty
(
$agent_data
))
{
return
0
;
}
$group_data
=
$this
->
getRedisCache
(
3
,
$agent_data
[
'auth_group_id'
]);
if
(
empty
(
$group_data
))
{
return
0
;
}
$rules
=
$group_data
[
'rules'
];
$rule_data
=
$this
->
authCache
(
$name
);
if
(
empty
(
$rule_data
))
{
return
0
;
}
$auth_rule_id
=
$rule_data
[
'id'
];
}
catch
(
\Exception
$e
)
{
return
-
1
;
}
$rules_arr
=
explode
(
','
,
$rules
);
$result
=
1
;
if
(
in_array
(
$auth_rule_id
,
$rules_arr
))
{
$result
=
0
;
}
return
$result
;
}
}
\ No newline at end of file
application/route.php
View file @
1a6e4c25
...
...
@@ -857,6 +857,7 @@ Route::group('broker', [
'center'
=>
[
'api_broker/MyCenter/center'
,
[
'method'
=>
'get|post'
]],
'centerV2'
=>
[
'api_broker/MyCenter/centerV2'
,
[
'method'
=>
'get|post'
]],
// 'houseEdit' => [ 'api_broker/shop/edit', [ 'method' => 'get|post' ] ], //编辑商铺
// 'houseEditV2' => [ 'api_broker/shop/editV2', [ 'method' => 'get|post' ] ], //编辑商铺
'houseEditV2'
=>
[
'api_broker/shop/edit'
,
[
'method'
=>
'get|post'
]],
//编辑商铺
...
...
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