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
5c219c03
Commit
5c219c03
authored
Dec 12, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
判断是否有权限点击独家合同按钮
parent
d4344f94
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
2 deletions
+69
-2
Shop.php
application/api_broker/controller/Shop.php
+13
-0
HouseService.php
application/index/service/HouseService.php
+49
-0
UserService.php
application/index/service/UserService.php
+7
-2
No files found.
application/api_broker/controller/Shop.php
View file @
5c219c03
...
...
@@ -7,6 +7,7 @@ use app\api_broker\service\LookShopService;
use
app\api_broker\service\VerifyService
;
use
app\api_broker\service\VipService
;
use
app\index\service\HouseService
;
use
app\index\service\UserService
;
use
app\model\AAgents
;
use
app\model\ACollectHouse
;
use
app\model\AttentionModel
;
...
...
@@ -654,6 +655,18 @@ class Shop extends Basic
$external_image
=
$m_image_depot
->
getInfo
(
'img_name'
,
[
'id'
=>
$image_id
[
0
],
'img_status'
=>
0
]);
$result
[
'external_image'
]
=
empty
(
$external_image
[
'img_name'
])
?
""
:
SHOP_IMAGE_DEPOT_URL
.
$external_image
[
'img_name'
];
}
//判断是否有权限点击独家合同按钮 0:可查看 1:不可查看
$s_house
=
new
HouseService
();
//是否存在独家方 查询
$m_houses_to_agents_res
=
$s_house
->
getShopOnlyAgentId
(
$params
[
"id"
]);
if
(
$m_houses_to_agents_res
){
//存在独家方则判断当前经纪人是否是该独家方的总监或者店长
$result
[
'is_can_edit_only_contract'
]
=
$s_house
->
isUserAgentBoss
(
$m_houses_to_agents_res
,
$this
->
agentId
);
}
else
{
$result
[
'is_can_edit_only_contract'
]
=
0
;
//无独家方任何人都可以修改
}
unset
(
$result
[
'external_image_id'
]);
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
}
...
...
application/index/service/HouseService.php
View file @
5c219c03
...
...
@@ -654,4 +654,52 @@ class HouseService
return
$return
;
}
/**
*查询当前经纪人是否是某个独家方的总监或者店长
* @param $shop_agent_id 1当前商铺独家方
* @param $agent_id 1当前登录用户
* @return int 0:可查看 1:不可查看
*/
public
function
isUserAgentBoss
(
$shop_agent_id
,
$agent_id
){
if
(
!
$shop_agent_id
){
return
1
;
}
if
(
!
$agent_id
){
return
1
;
}
$agent_model
=
new
AAgents
();
$params_
[
"id"
]
=
$shop_agent_id
;
$result
=
$agent_model
->
searchAgentsByKeyword
(
"id,store_id,district_id,level"
,
$params_
);
//店长
$params__
=
[];
$params__
[
'store_id'
]
=
$result
[
0
][
'store_id'
];
$params__
[
'level'
]
=
20
;
$result_dz
=
$agent_model
->
searchAgentsByKeyword
(
"id,store_id,district_id,level"
,
$params__
);
//总监
$params__
=
[];
$params__
[
'district_id'
]
=
$result
[
0
][
'district_id'
];
$params__
[
'level'
]
=
30
;
$result_zj
=
$agent_model
->
searchAgentsByKeyword
(
"id,store_id,district_id,level"
,
$params__
);
if
((
$shop_agent_id
==
$agent_id
)
or
(
$result_dz
[
0
][
'store_id'
]
==
$agent_id
)
or
(
$result_zj
[
0
][
'district_id'
]
==
$agent_id
))
{
return
0
;
//可编辑
}
else
{
return
1
;
//不可编辑
}
}
/**
* 根据商铺id获取商铺独家方
* @param $shop_id
* @return mixed
*/
public
function
getShopOnlyAgentId
(
$shop_id
){
$m_houses_to_agents
=
new
GHousesToAgents
();
$where_houses_to_agents
[
'houses_id'
]
=
$shop_id
;
$where_houses_to_agents
[
'type'
]
=
3
;
return
$m_houses_to_agents
->
getAgentHouseValue
(
'agents_id'
,
$where_houses_to_agents
);
}
}
\ No newline at end of file
application/index/service/UserService.php
View file @
5c219c03
...
...
@@ -419,8 +419,8 @@ class UserService
/**
* 查询当前经纪人是否是某个客方的总监
* @param $user_agent_id 当前用户客方
* @param $agent_id 当前登录用户
* @param $user_agent_id
1
当前用户客方
* @param $agent_id
1
当前登录用户
* @return int 0:可查看 1:不可查看
*/
public
function
isUserAgentDirector
(
$user_agent_id
,
$agent_id
){
...
...
@@ -481,4 +481,8 @@ class UserService
return
$is_collect
;
}
}
\ No newline at end of file
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