Commit 892537fb authored by hujun's avatar hujun

基类

parent 857ec264
......@@ -9,6 +9,8 @@ namespace app\index\extend;
* Time: 9:35
* 基类
*/
use app\api_broker\service\RedisCacheService;
use app\extra\RedisExt;
use app\model\AAgents;
use app\model\GHousesToAgents;
......@@ -144,7 +146,7 @@ class Basic extends Controller
public function userAuth($requestPath){
$session_menu = Session::get("user_info.menu");
$session_auth = Session::get("user_info.auth");
$auth_id = 0;
$auth_id = $is_auth = 0;
//去除管理验证
if ($this->userId != 1) {
......@@ -174,7 +176,19 @@ class Basic extends Controller
$agents = new AAgents();
$is_auth = $agents->agentsAuth($auth_id, $this->userId);
$is_auth = empty($is_auth['id']) ? 0:1;
$agent_house = new GHousesToAgents();
$redis_cache = new RedisCacheService();
$agent_data = $redis_cache->getRedisCache(2, $this->userId);
if ($agent_data['auth_group_id']) {
$group_data = $redis_cache->getRedisCache(3, $agent_data['auth_group_id']);
if ($group_data['rules']) {
$rules_arr = explode(',', $group_data['rules']);
if (in_array($auth_id, $rules_arr)) {
$is_auth = 1;
}
}
}
if ($is_auth == 0) {
//处理盘方编辑商铺
if ($requestPath == 'index/houseEdit' && isset($this->params['id'])) {
......@@ -204,7 +218,8 @@ class Basic extends Controller
}
if (!empty($store_id)) {
$is_ = $agents->getTotal(['store_id'=>$store_id, 'id'=>$this->userId, 'level'=>20]);
$agents = new AAgents();
$is_ = $agents->getTotal(['store_id'=>['in', $store_id], 'id'=>$this->userId, 'level'=>20]);
$is_auth = $is_ > 0 ? 1:0;
}
}
......@@ -232,6 +247,7 @@ class Basic extends Controller
//没有独家方编辑权限处理
if ($requestPath == 'index/editExclusive' && isset($this->params['exclusive_id'])) {
//独家方
$agent_house = new GHousesToAgents();
$exclusive_num = $agent_house->getAgentHouseNum($this->params['exclusive_id'], $this->params['id'], 3);
if ($exclusive_num > 0) {
$is_auth = 1;
......
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