public function handle_request_internel() { // if(strstr($this->get_user_job_name(),'软件开发')===false){ // return 'error_HTTP404'; // }; $params = $this->getParam(); $logcount = Bll_Changelog::get_log_info_count(null, $params['searchText']); if ($logcount > 0) { $page = isset($params['p']) ? (int) $params['p'] : 1; if ($this->request->is_post_method()) { $page = 1; } $page_size = 10; $show_num = 10; $loginfo = Bll_Changelog::get_log_info(null, $params['searchText'], $page, $page_size); $this->setAttribute('loginfo', $loginfo); $m_url = $this->build_url(__CLASS__); $this->set_multipage($page, $page_size, $logcount, $m_url, $show_num, $params); } $this->setAttribute('params', $params); $this->setAttribute('logcount', $logcount); return 'Menus_ChangeLog'; }
public function handle_request_internel() { $params = $this->getParam(); $res = $this->_res; switch ($params['type']) { case 'getitem': if (!empty($params['itemcode']) && !empty($params['itemtype'])) { $result = Bll_Menus::get_menus_info_with_item_parent($params['itemcode'], $params['itemtype']); $html = '<option value="0">全部</option>'; foreach ($result as $resultKey => $resultVal) { $b = intval($resultVal['item_deepth']) + 1; $html .= '<option b="' . $b . '" value="' . $resultVal['item_code'] . '">' . $resultVal['item_title'] . '</option>'; } $res = $this->init_res($html); } break; case 'getitemnew': if (!empty($params['itemcode']) && !empty($params['itemtype'])) { $result = Bll_Menus::get_menus_info_with_item_parent($params['itemcode'], $params['itemtype']); $html = ''; foreach ($result as $resultKey => $resultVal) { $b = intval($resultVal['item_deepth']) + 1; $html .= '<li><a b="' . $b . '" p="' . $resultVal['item_code'] . '" href="javascript:void(0);">' . $resultVal['item_title'] . '</a></li>'; } $res = $this->init_res($html); } break; case 'getitemcode': if (!empty($params['itemdeepth']) && !empty($params['itemcode'])) { $result = Bll_Menus::get_new_menus_with_item($params['itemcode'], $params['itemdeepth']); if (empty($result)) { $maxitemcode = str_pad($params['itemcode'], intval($params['itemdeepth']) * 3, "0", STR_PAD_RIGHT); $maxitemcode = str_pad($maxitemcode, intval($params['itemdeepth']) * 3 + 1, "1", STR_PAD_RIGHT); } else { $maxitemcode = $this->addManiac($result, 1); } $res = $this->init_res($this->itemcode_prep_replace($maxitemcode)); } break; case 'getitemparent': if (!empty($params['itemparentcode'])) { $result = Bll_Menus::get_menus_parent($params['itemparentcode']); $res = $this->init_res(json_encode($result)); } break; case 'modify': if (!empty($params['itemid']) && !empty($params['itemname']) && (!empty($params['itemurl']) || $params['itemdeepth'] != 4)) { $ch = Bll_Menus::check_data_is_exist($params['itemid']); if ($ch > 0) { $ch_url = Bll_Menus::check_data_is_exist_with_url($params['itemurl'], $params['itemid'], intval($params['itemdeepth'])); if (empty($ch_url)) { $data = array('item_title' => $params['itemname'], 'item_url' => $params['itemurl']); if (!empty($params['newitemcode'])) { $data = array_merge($data, array('item_parent' => $params['newitemcode'])); } $iswhere = array('id' => $params['itemid']); $result = Bll_Menus::update_data_row($data, $iswhere); $res = $this->init_res($result); } else { $this->_res['mes'] = 'URL地址已存在'; $res = $this->_res; } } else { $this->_res['mes'] = '没有该条数据'; $res = $this->_res; } } else { $this->_res['mes'] = '参数为空'; $res = $this->_res; } break; case 'adddata': if (!empty($params['itemdeepth']) && !empty($params['itemtitle']) && !empty($params['itemcode']) && !empty($params['itemparent'])) { $ch = Bll_Menus::check_data_is_exist_with_url($params['itemurl'], null, intval($params['urllv'])); if ($ch > 0) { $this->_res['mes'] = 'URL地址已存在'; $res = $this->_res; } else { $addData = array('item_code' => str_replace('_', '', $params['itemcode']), 'item_parent' => $params['itemparent'], 'item_title' => $params['itemtitle'], 'item_url' => $params['itemurl'], 'item_deepth' => $params['itemdeepth'], 'operation_name' => $this->get_user_name(), 'operation_id' => $this->get_user_id(), 'create_time' => time(), 'status' => $params['itemstatus']); $result = Bll_Menus::insert_data_row($addData); $res = $this->init_res($result); } } break; case 'delete': if (!empty($params['itemid'])) { $setData = array('status' => intval($params['status'])); $whereData = array('id' => intval($params['itemid'])); $result = Bll_Menus::update_data_row($setData, $whereData); $res = $this->init_res($result); } break; //记录操作日志 //记录操作日志 case 'log': $loginfo = array('type' => 1, 'operation_type' => $params['operationtype'], 'item_code' => str_replace('_', '', $params['itemcode']), 'title' => $params['itemtitle'], 'comment' => $params['comment'], 'operation_id' => $this->get_user_id(), 'operation_name' => $this->get_user_name(), 'create_time' => date('Y-m-d H:i:s', time())); $result = Bll_Changelog::insert_data_row($loginfo); $res = $this->init_res($result); break; default: $res = $this->_res; break; } echo json_encode($res); exit; }