Commit 03702502 authored by hujun's avatar hujun

针对商铺列表特殊权限管理

parent 8d25bc94
...@@ -95,6 +95,9 @@ class Broker extends Basic ...@@ -95,6 +95,9 @@ class Broker extends Basic
* 获取经纪人列表 * 获取经纪人列表
* *
* @return \think\Response * @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function getBrokerList() { public function getBrokerList() {
$data['status'] = 200; $data['status'] = 200;
......
...@@ -13,6 +13,7 @@ use app\index\extend\Basic; ...@@ -13,6 +13,7 @@ use app\index\extend\Basic;
use app\model\AAgents; use app\model\AAgents;
use app\model\GHouses; use app\model\GHouses;
use think\Request; use think\Request;
use think\Session;
class Houses extends Basic class Houses extends Basic
...@@ -176,7 +177,7 @@ class Houses extends Basic ...@@ -176,7 +177,7 @@ class Houses extends Basic
$where['id'] = $params['id']; $where['id'] = $params['id'];
} }
$where['status'] = ['<>',3]; $where['status'] = ['<>',3];
$data['data']['list'] = $this->house->getHouseList($pageNo, $pageSize, 'id DESC', $fields, $where); $data['data']['list'] = $this->house->getHouseList($pageNo, $pageSize, 'id DESC', $fields, $where, $this->userId);
$data['data']['total'] = $this->house->getTotal($where); $data['data']['total'] = $this->house->getTotal($where);
} else { } else {
//盘方人搜索 //盘方人搜索
...@@ -187,10 +188,10 @@ class Houses extends Basic ...@@ -187,10 +188,10 @@ class Houses extends Basic
$where['a.status'] = ['<>',3]; $where['a.status'] = ['<>',3];
$where['c.name'] = ['LIKE',$params['dish'].'%']; $where['c.name'] = ['LIKE',$params['dish'].'%'];
$where['b.type'] = ['=',1]; $where['b.type'] = ['=',1];
$data['data']['list'] = $this->house->getHouseListDish($pageNo, $pageSize, 'a.id DESC', $fields, $where); $data['data']['list'] = $this->house->getHouseListDish($pageNo, $pageSize, 'a.id DESC', $fields, $where, $this->userId);
$data['data']['total'] = $this->house->getHouseListDishTotal($where); $data['data']['total'] = $this->house->getHouseListDishTotal($where);
} }
$data['data']['auth_c'] = Session::get('user_info.auth');
return $this->response($data['status'], $data['msg'], $data['data']); return $this->response($data['status'], $data['msg'], $data['data']);
} }
......
...@@ -110,11 +110,24 @@ class Basic extends Controller ...@@ -110,11 +110,24 @@ class Basic extends Controller
} }
} }
if($auth_id == '0'){ $exclude_auth = [
'index/addHousesAgents',
'index/addHousesAgentsDish',
'index/addHousesAgentsExclusive',
'index/houseEdit',
];
if (in_array($requestPath, $exclude_auth)) {
if (empty($this->params['upload_id']) || ($this->params['upload_id'] != $this->userId)) {
$is_auth = 0; $is_auth = 0;
} else { } else {
$is_auth = 1;
}
}
if ($is_auth == 0) {
$agents = new AAgents(); $agents = new AAgents();
$is_auth = $agents->agentsAuth($auth_id, Session::get('userId')); $is_auth = $agents->agentsAuth($auth_id, $this->userId);
$is_auth = empty($is_auth['id']) ? 0:1; $is_auth = empty($is_auth['id']) ? 0:1;
} }
......
...@@ -99,12 +99,13 @@ class GHouses extends BaseModel ...@@ -99,12 +99,13 @@ class GHouses extends BaseModel
* @param string $order_ * @param string $order_
* @param string $field * @param string $field
* @param string $params * @param string $params
* @return mixed * @param string $agents_id
* @return array|false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getHouseList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') public function getHouseList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '', $agents_id = '')
{ {
$data = $this->field($field) $data = $this->field($field)
->where($params) ->where($params)
...@@ -114,6 +115,11 @@ class GHouses extends BaseModel ...@@ -114,6 +115,11 @@ class GHouses extends BaseModel
->select(); ->select();
$house_id = array(); $house_id = array();
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if ($v['upload_id'] == $agents_id) {
$data[$k]['auth_edit_house'] = 1;
} else {
$data[$k]['auth_edit_house'] = 0;
}
$house_id[$k] = $v['id']; $house_id[$k] = $v['id'];
$v->create_time = date('Y-m-d', strtotime($v->create_time)); $v->create_time = date('Y-m-d', strtotime($v->create_time));
} }
...@@ -131,6 +137,11 @@ class GHouses extends BaseModel ...@@ -131,6 +137,11 @@ class GHouses extends BaseModel
->select(); ->select();
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if ($v['upload_id'] == $agents_id) {
$data[$k]['auth_edit_house'] = 1;
} else {
$data[$k]['auth_edit_house'] = 0;
}
$result[$k] = $v->toArray(); $result[$k] = $v->toArray();
$dish_name = ''; $dish_name = '';
$result[$k]['dish_name'] = ''; $result[$k]['dish_name'] = '';
...@@ -158,12 +169,13 @@ class GHouses extends BaseModel ...@@ -158,12 +169,13 @@ class GHouses extends BaseModel
* @param string $order_ * @param string $order_
* @param string $field * @param string $field
* @param string $params * @param string $params
* @param string $agents_id
* @return array|false|\PDOStatement|string|\think\Collection * @return array|false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getHouseListDish($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') public function getHouseListDish($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '',$agents_id = '')
{ {
$data = $this->field($field)->alias('a') $data = $this->field($field)->alias('a')
->join('g_houses_to_agents b', 'a.id=b.houses_id', 'left') ->join('g_houses_to_agents b', 'a.id=b.houses_id', 'left')
...@@ -175,6 +187,11 @@ class GHouses extends BaseModel ...@@ -175,6 +187,11 @@ class GHouses extends BaseModel
->select(); ->select();
$house_id = array(); $house_id = array();
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if ($v['upload_id'] == $agents_id) {
$data[$k]['auth_edit_house'] = 1;
} else {
$data[$k]['auth_edit_house'] = 0;
}
$house_id[$k] = $v['id']; $house_id[$k] = $v['id'];
} }
...@@ -191,6 +208,11 @@ class GHouses extends BaseModel ...@@ -191,6 +208,11 @@ class GHouses extends BaseModel
->select(); ->select();
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if ($v['upload_id'] == $agents_id) {
$data[$k]['auth_edit_house'] = 1;
} else {
$data[$k]['auth_edit_house'] = 0;
}
$result[$k] = $v->toArray(); $result[$k] = $v->toArray();
$dish_name = ''; $dish_name = '';
$result[$k]['dish_name'] = ''; $result[$k]['dish_name'] = '';
......
...@@ -70,7 +70,9 @@ Route::group('index', [ ...@@ -70,7 +70,9 @@ Route::group('index', [
'getBroker' => ['index/broker/getBroker',['method'=>'get']], 'getBroker' => ['index/broker/getBroker',['method'=>'get']],
'getBroker_new' => ['index/broker/getBroker_new',['method'=>'get']], 'getBroker_new' => ['index/broker/getBroker_new',['method'=>'get']],
'getBrokerList' => ['index/broker/getBrokerList',['method'=>'get']],//门店列表的经纪人 'getBrokerList' => ['index/broker/getBrokerList',['method'=>'get']],//门店列表的经纪人
'addHousesAgents' => ['index/broker/AddHousesAgents', ['method' => 'POST']], //新增楼盘与经纪人关系 'addHousesAgents' => ['index/broker/AddHousesAgents', ['method' => 'POST']], //新增楼盘与经纪人关系(案场权限人)
'addHousesAgentsDish' => ['index/broker/AddHousesAgents', ['method' => 'POST']], //新增楼盘与经纪人关系(盘方)
'addHousesAgentsExclusive' => ['index/broker/AddHousesAgents', ['method' => 'POST']], //新增楼盘与经纪人关系(独家)
'delTohouses' => ['index/broker/delTohouses', ['method' => 'POST']], //解除经纪人和楼盘关系 'delTohouses' => ['index/broker/delTohouses', ['method' => 'POST']], //解除经纪人和楼盘关系
'getAgentsTohouses' => ['index/broker/getAgentsTohouses', ['method' => 'GET']], //获取经纪人和楼盘关系信息 'getAgentsTohouses' => ['index/broker/getAgentsTohouses', ['method' => 'GET']], //获取经纪人和楼盘关系信息
......
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