protected function handleRequestInner() { $supplier = $this->request->get_attribute('supplier'); $is_admin = $this->request->get_attribute('is_admin'); $account_id = $this->request->get_attribute('account_id'); $current_page = $this->request->get_parameter('p'); if (isset($current_page)) { $current_page = intval($current_page); } else { $current_page = 1; } $pre_page = $current_page - 1; $next_page = $current_page + 1; if ($is_admin) { $selected_supplier = $this->request->get_parameter('ss'); } else { $selected_supplier = $supplier; } $selected_supplier = trim($selected_supplier); if ($selected_supplier) { $datas = $this->data->getData($selected_supplier, $current_page); } if ($this->data->hasUnreadCheatingInfo($account_id)) { $has_notice = true; } if ($is_admin) { $suppliers = $this->account->getSuppliers(); return array('Supplier_Channel_Data', array('supplier' => $supplier, 'is_admin' => true, 'suppliers' => $suppliers, 'datas' => $datas, 'ss' => $selected_supplier, 'page_size' => PAGE_SIZE, 'pre_page' => $pre_page, 'current_page' => $current_page, 'next_page' => $next_page)); } else { return array('Supplier_Channel_Data', array('supplier' => $supplier, 'is_admin' => false, 'datas' => $datas, 'page_size' => PAGE_SIZE, 'pre_page' => $pre_page, 'current_page' => $current_page, 'next_page' => $next_page, 'has_notice' => $has_notice)); } }
protected function handleRequestInner() { $parmas = $this->request->get_attributes(); if ($this->request->get_method() == 'POST') { $rs = $this->doPost($_POST); echo json_encode($rs); return; } $supplier = $parmas['supplier']; $is_admin = $parmas['is_admin']; $current_page = $this->request->get_parameter('p'); if (!isset($current_page)) { $current_page = 1; } $page_size = $this->request->get_parameter('pz'); if (!is_numeric($page_size) || $page_size > 50) { $page_size = 10; } $supplierId = 0; if ($is_admin) { if ($_GET['ss']) { $supplierId = $_GET['ss']; $channelList = $this->serviceSupplier->getChannelListBySupplierId($supplierId, $current_page, $page_size); } $supplierList = $this->serviceAccount->getSupplierList(); } else { $supplierId = $this->serviceAccount->getIdBySupplier($supplier); // 通过$supplier查出supplierId $channelList = $this->serviceSupplier->getChannelListBySupplierId($supplierId, $current_page, $page_size); } $totalCount = $this->serviceSupplier->getChannelCount($supplierId); $this->request->set_attribute('channelList', $channelList); $this->request->set_attribute('supplierList', $supplierList); $pageInfo = array("current_page" => $current_page, "total_page" => round($totalCount / $page_size) + 1, "page_size" => $page_size, "total_count" => $totalCount, "ss" => $supplierId); $this->request->set_attribute('pageInfo', $pageInfo); $pre_page = $current_page - 1; $next_page = $current_page + 1; $page_size = 10; return array('Supplier_Channel_ChannelManager', array('channelList' => $channelList, 'supplierList' => $supplierList, 'pageInfo' => $pageInfo, 'pre_page' => $pre_page, 'current_page' => $current_page, 'next_page' => $next_page)); }
protected function handleRequestInner() { if ($this->request->get_method() == 'POST') { $info = $this->account->getAccountInfo($this->accountname, $this->password); if (is_array($info)) { $account_info = $info['accountname'] . ':' . $info['id'] . ':' . $info['is_admin'] . ':' . $info['supplier'] . ':' . $this->apf->get_config('aes_iv'); $crypted_account_info = $this->crypt_util->aes_encode($this->apf->get_config('aes_private_key'), $this->apf->get_config('aes_iv'), $account_info); $this->response->set_cookie('account_info', $crypted_account_info); $this->response->redirect('/data', false, false); return false; } else { if ($info == Service_Account::ERROR_INVALID_ACCOUNT) { $this->error['accountname'] = true; } else { if ($info == Service_Account::ERROR_INVALID_PASSWORD) { $this->error['password'] = true; } } } } return array('Supplier_Channel_Login', array('error' => $this->error)); }