where(array('storeid' => $id))->find(); if (!$one) { $adata['storeid'] = $id; $ret = M('retail_store_jurisdiction')->add($adata); $one = M('retail_store_jurisdiction')->where(array('id' => $ret))->find(); } $RoleClass = new Role(); $not_arr = $RoleClass->storeUseLimit($id); //无权限集合 $not_arr = array_merge($little_arr,$not_arr); $arr = array(); foreach ($one as $k => $v) { if ($k == 'id' || $k == 'storeid' || $k == 'express_search' || $k == 'addgoods_num') { continue; } if (strpos($k, '_name')) { continue; } if (in_array($k, $not_arr)) { continue; } $name = $one[$k . '_name'] ? $one[$k . '_name'] : '权限名称'; $arr[] = array('name' => $name, 'key' => $k, 'status' => $one[$k]); } $storetag = M('retail_store')->where(array('id' => $id))->getField('storetag'); $this->assign('shopname', $storetag); $this->assign('one', $one); $this->assign('arr', $arr); $this->display(); } public function setJurisdiction() { if (IS_POST) { $id = I('post.id'); $status = I('post.status'); $key = I('post.key'); $res = M('retail_store_jurisdiction')->where(array('id' => $id))->setField($key, $status); if ($res) { $rt['status'] = 1; $rt['msg'] = '设置成功'; //操作日志记录 $source = 0;//请求来源: 0pc系统 1小助手 $type = 3;//平台:1合伙人端 2代理商端 3商户端 4门店端 $request_data = json_encode($_POST);//请求参数 json数据 $desc = '编辑门店权限';//操作行为描述 action_log($source, $type, $request_data, $desc); //end } else { $rt['status'] = 0; $rt['msg'] = '设置失败'; } $this->ajaxReturn($rt); } } }