Commit 4c65a1f9 authored by hujun's avatar hujun

vip盘权限限制

parent d1a07866
......@@ -447,7 +447,18 @@ class Shop extends Basic
$param["img_type"] = 3;//图片类型:1效果图,2实景图,3样板图,4户型图,5交通图
$result["plan_images"] = $this->gHousesImgModel->getHouseImages($param, 1);
if ($params['site_area'] == 3 || $params["site_area"] == 4) {
$result['landlord_phone'] = json_decode($result['landlord_phone'], true);
$house_service = new HouseService();
$is_show_landlord = $house_service->checkLandlordShow($this->agentId, $result['id']);
if ($is_show_landlord) {
$result['landlord_phone'] = json_decode($result['landlord_phone'], true);
$result['is_show_landlord'] = 1;
} else {
$result['landlord_phone'] = ['name'=> '', 'phone'=>''];
$result['is_show_landlord'] = 0;
}
// $result['create_time'] = date('Y-m-d', strtotime($result['create_time']));
}
......
......@@ -29,16 +29,15 @@ class VipService
$auth_group_id = $agent->getAgentsById($id, $fields);
$auth_group = New AuthGroup();
$id = $auth_group_id;
$fields = 'rules';
$rules = $auth_group->getAuthGroupById($id, $fields);
$rules = $auth_group->getAuthGroupById($auth_group_id, $fields);
$auth_group = New AuthRule();
$fields = 'id';
$auth_rule_id = $auth_group->getAuthRuleByName($name, $fields);
$rules_arr = explode(',', $rules);
if (in_array($auth_rule_id, $rules_arr)) {
if (in_array($auth_rule_id, $rules_arr) || $id == 1) {
return 0;
} else {
return 1;
......
......@@ -778,7 +778,7 @@ class Houses extends Basic
}
/**
* 是否对C端显示
* vip盘
*
* @return \think\Response
*/
......
......@@ -187,7 +187,7 @@ class Basic extends Controller
if ($requestPath == 'index/editExclusive' && isset($this->params['exclusive_id'])) {
$m_house_agent = new GHousesToAgents();
//独家方
$exclusive_num = $m_house_agent->getAgentHouseNum($this->params['exclusive_id'], 3);
$exclusive_num = $m_house_agent->getAgentHouseNum($this->params['exclusive_id'], $this->params['id'], 3);
if ($exclusive_num > 0) {
$is_auth = 1;
}
......
......@@ -10,6 +10,7 @@ namespace app\index\service;
use app\api_broker\service\PushMessageService;
use app\api_broker\service\VipService;
use app\index\validate\HouseValidate;
use app\model\AAgents;
use app\model\GBusinessDistrict;
......@@ -416,4 +417,47 @@ class HouseService
}
}
/**
* 检查是否显示房东手机号和姓名
*
* @param int $agent_id
* @param int $house_id
* @return bool
*/
public function checkLandlordShow(int $agent_id, int $house_id) : bool {
$result = false;
$service_vip = new VipService();
$rule = $service_vip->vip($agent_id, 'index/vipHouse');
//检查权限
if (!$rule) {
return true;
}
$house_where['houses_id'] = $house_id;
$house_where['type'] = 2;
$agent_id_arr = $this->agent_house->getHouseAgent('b.id,b.district_id', $house_where);
if ($agent_id_arr['status'] != 'fail') {
foreach ($agent_id_arr as $v) {
//盘方
if ($agent_id == $v['id']) {
$result = true;
break;
}
$where_district['district_id'] = $v['district_id'];
$where_district['level'] = ['in', '30,40'];
$district_id = $this->agent->getAgentsByWhere($where_district, 'id');
//部门总监
if ($agent_id == $district_id) {
$result = true;
break;
}
}
}
return $result;
}
}
\ No newline at end of file
......@@ -729,8 +729,17 @@ class AAgents extends BaseModel
*/
public function getAgentsById($id, $fields)
{
$return = $this->where('id', $id)->value($fields);
return $return;
return $this->where('id', $id)->value($fields);
}
/**
* @param $where
* @param $fields
* @return mixed
*/
public function getAgentsByWhere($where, $fields)
{
return $this->where($where)->value($fields);
}
/**
......
......@@ -403,16 +403,18 @@ class GHousesToAgents extends BaseModel
/**
* @param $agent_id
* @param $house_id
* @param int $type
* @return int|string
*/
public function getAgentHouseNum($agent_id, $type = 3) {
public function getAgentHouseNum($agent_id, $house_id, $type = 3) {
return $this->alias('a')
->field('a.id')
->join('a_agents b', 'a.agents_id=b.id', 'left')
->where('a.is_del', 0)
->where('a.type', $type)
->where('a.agents_id', $agent_id)
->where('a.houses_id', $house_id)
->count();
}
......@@ -430,10 +432,8 @@ class GHousesToAgents extends BaseModel
/**
* @param $field
* @param $type
* @param $houses_id
* @param int $is_del
* @return array
* @param $where
* @return mixed
*/
public function getAgentHouseValue($field, $where) {
return $this->where($where)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment