ajaxReturn($re); } else { session(null); echo ''; exit; } } $Auth = new Auth; $res = $Auth->check($jurisdiction_user['id']); if ($res) { if (IS_POST) { // 是ajax请求数据 $user = session("ls_userinfo"); if (!$user) { $rt['status'] = 0; $rt['msg'] = '登录超时,请重新登录'; $rt['code'] = 1; $rt['count'] = 0; $rt['data'] = array(); $this->ajaxReturn($rt); } $hash = I('get.hash'); $storeid = session('storeid'); if ($hash && $hash != md5($storeid) && $storeid) { $str = '系统检测到您切换了门店,请刷新当前页面再操作'; $rt['status'] = 0; $rt['msg'] = $str; $rt['code'] = 1; $rt['count'] = 0; $rt['data'] = array(); $this->ajaxReturn($rt); } } else { $id = I('get.ls_store_id'); //有传storeid if (!empty($id)) { $store = D('Store')->getFind(array('id' => $id, 'merchantid' => $jurisdiction_user['merchantid'])); if (!empty($store)) { session('storeid', $id); } else { if (IS_POST) { $re['status'] = 0; $re['state'] = 0; $re['code'] = 0; $re['count'] = 0; $re['data'] = array(); $re['msg'] = '您无权操作2'; $this->ajaxReturn($re); } else { $this->diemsg(0, '您无权操作'); } } } //checkSite();//检测该域名是否可用 $this->loadBaseInfo(); $this->checkwebset(); // 全局添加 storeid 的md5 加密 参数 通过 U 方法 判断 session("ls_userhash"); $hash = I('get.hash'); $storeid = session('storeid'); if ($hash && $hash != md5($storeid) && $storeid) { $str = '系统检测到您切换了门店,将刷新跳转到最后的门店,立即刷新?'; echo ''; exit; } } } else { if (IS_POST) { $re['status'] = 0; $re['state'] = 0; $re['code'] = 0; $re['count'] = 0; $re['data'] = array(); $re['msg'] = '您无权操作2'; $this->ajaxReturn($re); } else { $this->diemsg(0, '您无权操作'); } } $this->role_info = session("ls_userinfo"); $this->login_user = $jurisdiction_user; $this->merchant_id = $jurisdiction_user['merchant_id']; $this->store_id = $jurisdiction_user['store_id'] ? $jurisdiction_user['store_id'] : session('store_id') ? session('store_id') : session('storeid'); self::$identity = session("identity") ? session("identity") : ''; self::$showPrice = $global_store_jurisdiction['showpurch_price'] ? $global_store_jurisdiction['showpurch_price'] : ''; self::$global_store_jurisdiction = $global_store_jurisdiction ? $global_store_jurisdiction : []; $this->assign('identity', self::$identity); } public function loadBaseInfo() { $user = session("jurisdiction_user"); $store_id = session('storeid'); if ($store_id) { //全局设置的门店权限 $global_store_jurisdiction = M('retail_store_jurisdiction')->where(array('storeid' => $store_id))->find(); if ($user['login_type'] == 3) { //商户身份进行权限转换 foreach ($global_store_jurisdiction as $key => &$val) { if (!strpos($key, '_name')) { $val = 1; } } } session('global_store_jurisdiction', $global_store_jurisdiction); $this->assign('global_store_jurisdiction', $global_store_jurisdiction); } // 店长账号 if ($user['account_type'] == 2 && !$store_id) { session('storeid', $user['storeid']); //全局设置的门店权限 $global_store_jurisdiction = session('global_store_jurisdiction'); if (!$global_store_jurisdiction) { $global_store_jurisdiction = M('retail_store_jurisdiction')->where(array('storeid' => $store_id))->find(); $global_store_jurisdiction = $global_store_jurisdiction ? $global_store_jurisdiction : array(); session('global_store_jurisdiction', $global_store_jurisdiction); } $this->assign('global_store_jurisdiction', $global_store_jurisdiction); } } //禁止不动的失败提示的信息 public function diemsg($status, $msg) { //成功为1,失败为0 $this->error($msg); die(); } public function error2() { $rt['status'] = -1; $rt['msg'] = '您无权操作'; $this->ajaxReturn($rt); } }