diff --git a/application/admin/controller/Article.php b/application/admin/controller/Article.php index dcb71c9cadde2449a8ac956585d0827807691e5b..d18426f0436da5750f6deeaf370463e1110c2b0b 100755 --- a/application/admin/controller/Article.php +++ b/application/admin/controller/Article.php @@ -133,9 +133,6 @@ class Article extends Common $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; } - // 是否启用 - $this->assign('common_is_enable_list', lang('common_is_enable_list')); - // 文章分类 $article_category = ArticleService::ArticleCategoryList(['field'=>'id,name']); $this->assign('article_category_list', $article_category['data']); diff --git a/application/admin/controller/Warehouse.php b/application/admin/controller/Warehouse.php new file mode 100644 index 0000000000000000000000000000000000000000..3b069fad6506dc876adf7d89c1ca17f3c9be849c --- /dev/null +++ b/application/admin/controller/Warehouse.php @@ -0,0 +1,213 @@ +IsLogin(); + + // 权限校验 + $this->IsPower(); + } + + /** + * 列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-07-07 + * @desc description + */ + public function Index() + { + // 获取列表 + $data_params = [ + 'where' => $this->form_where, + ]; + $ret = WarehouseService::WarehouseList($data_params); + + // 基础参数赋值 + $this->assign('params', $this->data_request); + $this->assign('data_list', $ret['data']); + return $this->fetch(); + } + + /** + * 详情 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-07-07 + */ + public function Detail() + { + if(!empty($this->data_request['id'])) + { + // 条件 + $where = [ + ['id', '=', intval($this->data_request['id'])], + ]; + + // 获取列表 + $data_params = [ + 'm' => 0, + 'n' => 1, + 'where' => $where, + ]; + $ret = WarehouseService::WarehouseList($data_params); + $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; + $this->assign('data', $data); + + // 加载百度地图api + $this->assign('is_load_baidu_map_api', 1); + } + return $this->fetch(); + } + + /** + * 文章添加/编辑页面 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-07-07 + * @desc description + */ + public function SaveInfo() + { + // 参数 + $params = $this->data_request; + + // 数据 + $data = []; + if(!empty($params['id'])) + { + // 获取列表 + $data_params = array( + 'where' => ['id'=>intval($params['id'])], + ); + $ret = WarehouseService::WarehouseList($data_params); + $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; + } + + // 文章编辑页面钩子 + $hook_name = 'plugins_view_admin_warehouse_save'; + $this->assign($hook_name.'_data', Hook::listen($hook_name, + [ + 'hook_name' => $hook_name, + 'is_backend' => true, + 'warehouse_id' => isset($params['id']) ? $params['id'] : 0, + 'data' => &$data, + 'params' => &$params, + ])); + + // 加载百度地图api + $this->assign('is_load_baidu_map_api', 1); + + // 编辑器文件存放地址 + $this->assign('editor_path_type', 'warehouse'); + + // 数据 + $this->assign('data', $data); + $this->assign('params', $params); + return $this->fetch(); + } + + /** + * 文章添加/编辑 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-07-07 + * @desc description + */ + public function Save() + { + // 是否ajax请求 + if(!IS_AJAX) + { + return $this->error('非法访问'); + } + + // 开始处理 + $params = $this->data_request; + return WarehouseService::WarehouseSave($params); + } + + /** + * 删除 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-07-07 + * @desc description + */ + public function Delete() + { + // 是否ajax请求 + if(!IS_AJAX) + { + return $this->error('非法访问'); + } + + // 开始处理 + $params = $this->data_request; + $params['admin'] = $this->admin; + return WarehouseService::WarehouseDelete($params); + } + + /** + * 状态更新 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-07-07 + * @desc description + */ + public function StatusUpdate() + { + // 是否ajax请求 + if(!IS_AJAX) + { + return $this->error('非法访问'); + } + + // 开始处理 + $params = $this->data_request; + $params['admin'] = $this->admin; + return WarehouseService::WarehouseStatusUpdate($params); + } +} +?> \ No newline at end of file diff --git a/application/admin/form/Warehouse.php b/application/admin/form/Warehouse.php new file mode 100644 index 0000000000000000000000000000000000000000..043bf9909c25f570b81ce7d97a5b3e295f412f94 --- /dev/null +++ b/application/admin/form/Warehouse.php @@ -0,0 +1,223 @@ + [ + 'key_field' => 'id', + 'status_field' => 'is_enable', + 'is_search' => 1, + 'search_url' => MyUrl('admin/warehouse/index'), + 'is_delete' => 1, + 'delete_url' => MyUrl('admin/warehouse/delete'), + 'delete_key' => 'ids', + 'detail_title' => '基础信息', + ], + // 表单配置 + 'form' => [ + [ + 'view_type' => 'checkbox', + 'is_checked' => 0, + 'checked_text' => '反选', + 'not_checked_text' => '全选', + 'align' => 'center', + 'width' => 80, + ], + [ + 'label' => '名称/别名', + 'view_type' => 'module', + 'view_key' => 'warehouse/module/info', + 'grid_size' => 'sm', + 'search_config' => [ + 'form_type' => 'input', + 'form_name' => 'name|alias', + 'where_type' => 'like', + ], + ], + [ + 'label' => '权重', + 'view_type' => 'field', + 'view_key' => 'level', + 'search_config' => [ + 'form_type' => 'section', + ], + ], + [ + 'label' => '是否启用', + 'view_type' => 'status', + 'view_key' => 'is_enable', + 'post_url' => MyUrl('admin/warehouse/statusupdate'), + 'is_form_su' => 1, + 'align' => 'center', + 'search_config' => [ + 'form_type' => 'select', + 'where_type' => 'in', + 'data' => lang('common_is_enable_list'), + 'data_key' => 'id', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '联系人', + 'view_type' => 'field', + 'view_key' => 'contacts_name', + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => 'like', + ], + ], + [ + 'label' => '联系电话', + 'view_type' => 'field', + 'view_key' => 'contacts_tel', + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => 'like', + ], + ], + [ + 'label' => '所在省', + 'view_type' => 'field', + 'view_key' => 'province_name', + 'search_config' => [ + 'form_type' => 'select', + 'form_name' => 'province', + 'data' => $this->RegionItems('province'), + 'data_key' => 'id', + 'data_name' => 'name', + 'where_type' => 'in', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '所在市', + 'view_type' => 'field', + 'view_key' => 'city_name', + 'search_config' => [ + 'form_type' => 'select', + 'form_name' => 'city', + 'data' => $this->RegionItems('city'), + 'data_key' => 'id', + 'data_name' => 'name', + 'where_type' => 'in', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '所在区/县', + 'view_type' => 'field', + 'view_key' => 'county_name', + 'search_config' => [ + 'form_type' => 'select', + 'form_name' => 'county', + 'data' => $this->RegionItems('county'), + 'data_key' => 'id', + 'data_name' => 'name', + 'where_type' => 'in', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '详细地址', + 'view_type' => 'field', + 'view_key' => 'address', + 'grid_size' => 'sm', + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => 'like', + ], + ], + [ + 'label' => '经纬度', + 'view_type' => 'module', + 'view_key' => 'warehouse/module/position', + 'grid_size' => 'sm', + ], + [ + 'label' => '创建时间', + 'view_type' => 'field', + 'view_key' => 'add_time', + 'search_config' => [ + 'form_type' => 'datetime', + ], + ], + [ + 'label' => '更新时间', + 'view_type' => 'field', + 'view_key' => 'upd_time', + 'search_config' => [ + 'form_type' => 'datetime', + ], + ], + [ + 'label' => '操作', + 'view_type' => 'operate', + 'view_key' => 'warehouse/module/operate', + 'align' => 'center', + 'fixed' => 'right', + ], + ], + ]; + } + + /** + * 获取地区数据 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-07-08 + * @desc description + * @param [string] $field [地区字段] + */ + public function RegionItems($field) + { + $result = []; + $ids = Db::name('Warehouse')->where($this->condition_base)->column($field); + if(!empty($ids)) + { + $result = RegionService::RegionNode(['field'=>'id,name', 'where'=>['id'=>$ids]]); + } + return $result; + } +} +?> \ No newline at end of file diff --git a/application/admin/view/default/admin/save_info.html b/application/admin/view/default/admin/save_info.html index fa5fb488508f56a861b41b36d575fa180dab61a0..7676f1e4f00b99a6b7ffa65632a5fe1951f73c66 100755 --- a/application/admin/view/default/admin/save_info.html +++ b/application/admin/view/default/admin/save_info.html @@ -6,13 +6,7 @@
- - {{if empty($data['id'])}} - 管理员添加 - {{else /}} - 管理员编辑 - {{/if}} - + 管理员{{if empty($data['id'])}}添加{{else /}}编辑{{/if}} 返回
diff --git a/application/admin/view/default/answer/save_info.html b/application/admin/view/default/answer/save_info.html index a23db9c41384139235feb22f90c1733256eb3859..fbf5bf0342c0044b7def5c3b61b9a94b6200426a 100644 --- a/application/admin/view/default/answer/save_info.html +++ b/application/admin/view/default/answer/save_info.html @@ -6,13 +6,7 @@ - - {{if empty($data['id'])}} - 问答添加 - {{else /}} - 问答编辑 - {{/if}} - + 问答{{if empty($data['id'])}}添加{{else /}}编辑{{/if}} 返回