getAllExpresslist($condition, 10); View::assign('show_page', $express_model->page_info->render()); View::assign('express_list', $express_list); $this->setAdminCurItem('index'); return View::fetch(); } /** * 添加品牌 */ public function add() { $express_mod = model('express'); if (request()->isPost()) { $insert_array['express_name'] = trim(input('post.express_name')); $insert_array['express_code'] = input('post.express_code'); $insert_array['express_state'] = intval(input('post.express_state')); $insert_array['express_letter'] = strtoupper(input('post.express_letter')); $insert_array['express_order'] = intval(input('post.express_order')); $insert_array['express_url'] = input('post.express_url'); $result = $express_mod->addExpress($insert_array); if ($result) { $this->log(lang('ds_add') . lang('express') . '[' . input('post.express_name') . ']', 1); dsLayerOpenSuccess(lang('ds_common_save_succ')); } else { $this->error(lang('ds_common_save_fail')); } } else { $express = [ 'express_order' => 1, 'express_state' => 1, ]; View::assign('express', $express); return View::fetch('form'); } } public function edit() { $express_model = model('express'); $express_id = input('param.express_id'); $condition = array(); if (request()->isPost()) { $condition[] = array('express_id','=',$express_id); $data['express_name'] = trim(input('post.express_name')); $data['express_code'] = input('post.express_code'); $data['express_state'] = intval(input('post.express_state')); $data['express_letter'] = strtoupper(input('post.express_letter')); $data['express_order'] = intval(input('post.express_order')); $data['express_url'] = input('post.express_url'); $result = $express_model->editExpress($condition, $data); if ($result) { $this->log(lang('ds_edit') . lang('express_name') . lang('ds_state') . '[ID:' . $express_id . ']', 1); dsLayerOpenSuccess(lang('ds_common_save_succ')); } else { $this->log(lang('ds_edit') . lang('express_name') . lang('ds_state') . '[ID:' . $express_id . ']', 0); $this->error(lang('ds_common_save_fail')); } } else { $condition[] = array('express_id','=',$express_id); $express = $express_model->getOneExpress($condition); if (empty($express)) { $this->error(lang('param_error')); } View::assign('express', $express); return View::fetch('form'); } } /** * 删除品牌 */ public function del() { $express_id = input('param.express_id'); $express_id_array = ds_delete_param($express_id); if ($express_id_array == FALSE) { $this->log(lang('ds_del') . lang('express') . '[ID:' . $express_id . ']', 0); ds_json_encode(10001, lang('param_error')); } $express_mod = model('express'); $express_mod->delExpress(array(array('express_id','in', implode(',', $express_id_array)))); $this->log(lang('ds_del') . lang('express') . '[ID:' . $express_id . ']', 1); ds_json_encode(10000, lang('ds_common_del_succ')); } /** * ajax操作 */ public function ajax() { $branch = input('get.branch'); $column = input('get.column'); $value = trim(input('get.value')); $id = intval(input('get.id')); $condition = array(); switch ($branch) { case 'state': $express_model = model('express'); $update_array = array(); $condition[] = array('express_id','=',$id); $update_array[$column] = $value; $express_model->editExpress($condition, $update_array); $this->log(lang('ds_edit') . lang('express_name') . lang('ds_state') . '[ID:' . $id . ']', 1); echo 'true'; exit; break; case 'order': $express_model = model('express'); $update_array = array(); $condition[] = array('express_id','=',$id); $update_array[$column] = $value; $express_model->editExpress($condition, $update_array); $this->log(lang('ds_edit') . lang('express_name') . lang('ds_state') . '[ID:' . $id . ']', 1); echo 'true'; exit; break; } } public function config(){ $config_model = model('config'); if (!request()->isPost()) { $list_config = rkcache('config', true); View::assign('list_config', $list_config); /* 设置卖家当前栏目 */ $this->setAdminCurItem('express_config'); return View::fetch(); } else { $update_array = array(); $update_array['expresscf_kdn_type'] = input('post.expresscf_kdn_type'); $update_array['expresscf_kdn_id'] = input('post.expresscf_kdn_id'); $update_array['expresscf_kdn_key'] = input('post.expresscf_kdn_key'); $result = $config_model->editConfig($update_array); if ($result) { $this->success(lang('ds_common_save_succ')); } else { $this->error(lang('ds_common_save_fail')); } } } /** * 获取卖家栏目列表,针对控制器下的栏目 */ protected function getAdminItemList() { $menu_array = array( array( 'name' => 'index', 'text' => lang('ds_manage'), 'url' => (string)url('Express/index'), ), array( 'name' => 'express_config', 'text' => '快递查询设置', 'url' => (string)url('Express/config') ), array( 'name' => 'express_add', 'text' => lang('ds_add'), 'url' => "javascript:dsLayerOpen('" . (string)url('Express/add') . "','".lang('ds_add')."')" ), ); return $menu_array; } } ?>