Commit 244413a0 authored by hujun's avatar hujun

站点检测

parent 19132205
......@@ -314,7 +314,7 @@ class Houses extends Basic
}
$fields = 'id,shop_type,internal_title,rent_price,is_show,create_time,residue_num,rent_type,status,
shop_area_start,shop_area_end,industry_type,disc,is_carefully_chosen,is_exclusive_type,is_lock,vip';
shop_area_start,shop_area_end,industry_type,disc,is_carefully_chosen,is_exclusive_type,is_lock,is_vip';
/*楼盘编号*/
if ($this->params['id'] != NULL) {
......
......@@ -16,11 +16,10 @@ use app\model\AAgents;
use app\model\ABindingDevice;
use app\model\ADistrict;
use app\model\AOperatingRecords;
use app\model\ASite;
use app\model\AuthGroupSite;
use app\model\GHousesToAgents;
use app\model\OMarchInModel;
use app\model\Users;
use think\Request;
class BrokerService
{
......@@ -43,7 +42,6 @@ class BrokerService
*/
public function saveAgentData(array $data, int $operation_id)
{
$change_old_id = 0;
$is_new_id = 1;
$result['status'] = 'fail';
$validate = new AAgentValidate();
......@@ -262,4 +260,33 @@ class BrokerService
return $result;
}
/**
* 检查角色是否属于某个站点
*
* @param $agent_id
* @param $site_id
* @return bool
*/
public function checkSite($agent_id, $site_id) {
$m_site = new AuthGroupSite();
if (empty($agent_id)) {
return false;
}
$auth_group_id = $this->m_agent->getAgentsById($agent_id, 'auth_group_id');
if ($auth_group_id) {
$where['group_id'] = $auth_group_id;
$where['status'] = 0;
$where[] = ['EXP', 'find_in_set('.$site_id.', site_id)'];
$id = $m_site->getSite('id', $where);
if (count($id['data']) > 0) {
$result = true;
} else {
$result = false;
}
} else {
$result = false;
}
return $result;
}
}
\ No newline at end of file
......@@ -27,7 +27,6 @@ class AuthGroupSite extends BaseModel
}
/**
* @param $field
* @param $where
* @return mixed
*/
......@@ -50,4 +49,23 @@ class AuthGroupSite extends BaseModel
return $data;
}
/**
* @param $field
* @param $where
* @return mixed
*/
public function getSite($field, $where) {
$data['data'] = [];
try {
$data['data'] = $this->field($field)
->where($where)
->select();
$data['status'] = 'successful';
} catch(\Exception $e) {
$data['status'] = 'fail';
$data['msg'] = $e->getMessage();
}
return $data;
}
}
\ No newline at end of file
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