From 2733874a9af3073bf62d1fb6220637a2fdc0e34b Mon Sep 17 00:00:00 2001 From: devil Date: Tue, 30 Jun 2020 19:31:09 +0800 Subject: [PATCH] =?UTF-8?q?=20=E7=94=A8=E6=88=B7=E7=AB=AF=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Answer.php | 13 +- application/admin/controller/Goodsbrowse.php | 138 ++++ application/admin/controller/Goodsfavor.php | 138 ++++ application/admin/form/Answer.php | 23 - .../form/{CustomView.php => Customview-s.php} | 0 application/admin/form/Goodsbrowse.php | 148 +++++ application/admin/form/Goodsfavor.php | 148 +++++ .../admin/view/default/answer/save_info.html | 2 +- .../view/default/goodsbrowse/detail.html | 2 + .../admin/view/default/goodsbrowse/index.html | 2 + .../default/goodsbrowse/module/goods.html | 12 + .../default/goodsbrowse/module/operate.html | 9 + .../admin/view/default/goodsfavor/detail.html | 2 + .../admin/view/default/goodsfavor/index.html | 2 + .../view/default/goodsfavor/module/goods.html | 12 + .../default/goodsfavor/module/operate.html | 9 + .../view/default/public/module/form.html | 338 +--------- .../public/module/form_operate_bottom.html | 18 + .../public/module/form_operate_top.html | 41 ++ .../default/public/module/form_table.html | 272 ++++++++ application/api/controller/Goods.php | 5 +- application/api/controller/Usergoodsfavor.php | 10 +- application/index/controller/Answer.php | 119 ++-- application/index/controller/Goods.php | 10 +- application/index/controller/User.php | 11 +- application/index/controller/Userfavor.php | 114 ---- .../index/controller/Usergoodsbrowse.php | 102 +-- .../index/controller/Usergoodsfavor.php | 136 ++++ application/index/controller/Userintegral.php | 17 +- application/index/form/Answer.php | 134 ++++ application/index/form/Usergoodsbrowse.php | 128 ++++ application/index/form/Usergoodsfavor.php | 128 ++++ .../index/view/default/answer/detail.html | 2 + .../index/view/default/answer/index.html | 215 ++----- .../view/default/answer/module/content.html | 4 + .../view/default/answer/module/operate.html | 5 + .../view/default/answer/module/reply.html | 4 + .../index/view/default/message/index.html | 2 +- .../view/default/public/module/form.html | 593 ++++-------------- .../public/module/form_operate_bottom.html | 18 + .../public/module/form_operate_top.html | 41 ++ .../default/public/module/form_table.html | 272 ++++++++ .../view/default/public/module/user_form.html | 160 +++++ .../index/view/default/userfavor/goods.html | 91 --- .../view/default/usergoodsbrowse/detail.html | 2 + .../view/default/usergoodsbrowse/index.html | 95 +-- .../default/usergoodsbrowse/module/goods.html | 12 + .../usergoodsbrowse/module/operate.html | 9 + .../view/default/usergoodsfavor/detail.html | 2 + .../view/default/usergoodsfavor/index.html | 2 + .../default/usergoodsfavor/module/goods.html | 12 + .../usergoodsfavor/module/operate.html | 9 + .../view/default/userintegral/index.html | 2 +- application/service/GoodsBrowseService.php | 215 +++++++ application/service/GoodsFavorService.php | 278 ++++++++ application/service/GoodsService.php | 359 ----------- application/service/NavigationService.php | 9 +- public/static/admin/default/css/admin.css | 3 + public/static/admin/default/css/answer.css | 2 +- public/static/common/css/common.css | 2 +- public/static/index/default/css/answer.css | 4 +- public/static/index/default/css/common.css | 16 +- public/static/index/default/js/answer.js | 5 + 63 files changed, 2889 insertions(+), 1799 deletions(-) create mode 100644 application/admin/controller/Goodsbrowse.php create mode 100644 application/admin/controller/Goodsfavor.php rename application/admin/form/{CustomView.php => Customview-s.php} (100%) create mode 100644 application/admin/form/Goodsbrowse.php create mode 100644 application/admin/form/Goodsfavor.php create mode 100644 application/admin/view/default/goodsbrowse/detail.html create mode 100755 application/admin/view/default/goodsbrowse/index.html create mode 100644 application/admin/view/default/goodsbrowse/module/goods.html create mode 100644 application/admin/view/default/goodsbrowse/module/operate.html create mode 100644 application/admin/view/default/goodsfavor/detail.html create mode 100755 application/admin/view/default/goodsfavor/index.html create mode 100644 application/admin/view/default/goodsfavor/module/goods.html create mode 100644 application/admin/view/default/goodsfavor/module/operate.html create mode 100644 application/admin/view/default/public/module/form_operate_bottom.html create mode 100644 application/admin/view/default/public/module/form_operate_top.html create mode 100644 application/admin/view/default/public/module/form_table.html delete mode 100755 application/index/controller/Userfavor.php create mode 100755 application/index/controller/Usergoodsfavor.php create mode 100644 application/index/form/Answer.php create mode 100644 application/index/form/Usergoodsbrowse.php create mode 100644 application/index/form/Usergoodsfavor.php create mode 100644 application/index/view/default/answer/detail.html create mode 100644 application/index/view/default/answer/module/content.html create mode 100644 application/index/view/default/answer/module/operate.html create mode 100644 application/index/view/default/answer/module/reply.html create mode 100644 application/index/view/default/public/module/form_operate_bottom.html create mode 100644 application/index/view/default/public/module/form_operate_top.html create mode 100644 application/index/view/default/public/module/form_table.html create mode 100644 application/index/view/default/public/module/user_form.html delete mode 100755 application/index/view/default/userfavor/goods.html create mode 100644 application/index/view/default/usergoodsbrowse/detail.html create mode 100644 application/index/view/default/usergoodsbrowse/module/goods.html create mode 100644 application/index/view/default/usergoodsbrowse/module/operate.html create mode 100644 application/index/view/default/usergoodsfavor/detail.html create mode 100755 application/index/view/default/usergoodsfavor/index.html create mode 100644 application/index/view/default/usergoodsfavor/module/goods.html create mode 100644 application/index/view/default/usergoodsfavor/module/operate.html create mode 100644 application/service/GoodsBrowseService.php create mode 100644 application/service/GoodsFavorService.php create mode 100644 public/static/index/default/js/answer.js diff --git a/application/admin/controller/Answer.php b/application/admin/controller/Answer.php index 55bf90240..a3da4114e 100755 --- a/application/admin/controller/Answer.php +++ b/application/admin/controller/Answer.php @@ -71,10 +71,6 @@ class Answer extends Common ]; $ret = AnswerService::AnswerList($data_params); - // 静态数据 - $this->assign('common_is_show_list', lang('common_is_show_list')); - $this->assign('common_is_text_list', lang('common_is_text_list')); - // 基础参数赋值 $this->assign('params', $this->data_request); $this->assign('page_html', $page->GetPageHtml()); @@ -84,10 +80,11 @@ class Answer extends Common /** * 详情 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @datetime 2019-08-05T08:21:54+0800 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-30 + * @desc description */ public function Detail() { diff --git a/application/admin/controller/Goodsbrowse.php b/application/admin/controller/Goodsbrowse.php new file mode 100644 index 000000000..5bf90c08a --- /dev/null +++ b/application/admin/controller/Goodsbrowse.php @@ -0,0 +1,138 @@ +IsLogin(); + + // 权限校验 + $this->IsPower(); + } + + /** + * 列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-30 + * @desc description + */ + public function Index() + { + // 总数 + $total = GoodsBrowseService::GoodsBrowseTotal($this->form_where); + + // 分页 + $page_params = [ + 'number' => $this->page_size, + 'total' => $total, + 'where' => $this->data_request, + 'page' => $this->page, + 'url' => MyUrl('admin/goodsbrowse/index'), + ]; + $page = new \base\Page($page_params); + + // 获取列表 + $data_params = [ + 'where' => $this->form_where, + 'm' => $page->GetPageStarNumber(), + 'n' => $this->page_size, + 'is_public' => 0, + 'user_type' => 'admin', + ]; + $ret = GoodsBrowseService::GoodsBrowseList($data_params); + + // 基础参数赋值 + $this->assign('params', $this->data_request); + $this->assign('page_html', $page->GetPageHtml()); + $this->assign('data_list', $ret['data']); + return $this->fetch(); + } + + /** + * 详情 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-30 + * @desc description + */ + public function Detail() + { + if(!empty($this->data_request['id'])) + { + // 条件 + $where = [ + ['b.id', '=', intval($this->data_request['id'])], + ]; + + // 获取列表 + $data_params = [ + 'm' => 0, + 'n' => 1, + 'where' => $where, + 'is_public' => 0, + 'user_type' => 'admin', + ]; + $ret = GoodsBrowseService::GoodsBrowseList($data_params); + $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; + $this->assign('data', $data); + } + return $this->fetch(); + } + + /** + * 删除 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-30 + * @desc description + */ + public function Delete() + { + // 是否ajax请求 + if(!IS_AJAX) + { + return $this->error('非法访问'); + } + + // 开始处理 + $params = $this->data_request; + $params['user_type'] = 'admin'; + return GoodsBrowseService::GoodsBrowseDelete($params); + } +} +?> \ No newline at end of file diff --git a/application/admin/controller/Goodsfavor.php b/application/admin/controller/Goodsfavor.php new file mode 100644 index 000000000..583bee4a0 --- /dev/null +++ b/application/admin/controller/Goodsfavor.php @@ -0,0 +1,138 @@ +IsLogin(); + + // 权限校验 + $this->IsPower(); + } + + /** + * 列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-30 + * @desc description + */ + public function Index() + { + // 总数 + $total = GoodsFavorService::GoodsFavorTotal($this->form_where); + + // 分页 + $page_params = [ + 'number' => $this->page_size, + 'total' => $total, + 'where' => $this->data_request, + 'page' => $this->page, + 'url' => MyUrl('admin/goodsfavor/index'), + ]; + $page = new \base\Page($page_params); + + // 获取列表 + $data_params = [ + 'where' => $this->form_where, + 'm' => $page->GetPageStarNumber(), + 'n' => $this->page_size, + 'is_public' => 0, + 'user_type' => 'admin', + ]; + $ret = GoodsFavorService::GoodsFavorList($data_params); + + // 基础参数赋值 + $this->assign('params', $this->data_request); + $this->assign('page_html', $page->GetPageHtml()); + $this->assign('data_list', $ret['data']); + return $this->fetch(); + } + + /** + * 详情 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-30 + * @desc description + */ + public function Detail() + { + if(!empty($this->data_request['id'])) + { + // 条件 + $where = [ + ['f.id', '=', intval($this->data_request['id'])], + ]; + + // 获取列表 + $data_params = [ + 'm' => 0, + 'n' => 1, + 'where' => $where, + 'is_public' => 0, + 'user_type' => 'admin', + ]; + $ret = GoodsFavorService::GoodsFavorList($data_params); + $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; + $this->assign('data', $data); + } + return $this->fetch(); + } + + /** + * 删除 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-30 + * @desc description + */ + public function Delete() + { + // 是否ajax请求 + if(!IS_AJAX) + { + return $this->error('非法访问'); + } + + // 开始处理 + $params = $this->data_request; + $params['user_type'] = 'admin'; + return GoodsFavorService::GoodsFavorDelete($params); + } +} +?> \ No newline at end of file diff --git a/application/admin/form/Answer.php b/application/admin/form/Answer.php index 70f0cdfba..946ccf547 100644 --- a/application/admin/form/Answer.php +++ b/application/admin/form/Answer.php @@ -210,28 +210,5 @@ class Answer } return $value; } - - /** - * 基础信息条件处理 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2020-06-08 - * @desc description - * @param [string] $value [条件值] - * @param [array] $params [输入参数] - */ - public function WhereValueBaseInfo($value, $params = []) - { - if(!empty($value)) - { - // 获取商品评论关联的商品 id - $ids = Db::name('answer')->alias('gc')->join(['__GOODS__'=>'g'], 'gc.goods_id=g.id')->where('title|model', 'like', '%'.$value.'%')->column('gc.id'); - - // 避免空条件造成无效的错觉 - return empty($ids) ? [0] : $ids; - } - return $value; - } } ?> \ No newline at end of file diff --git a/application/admin/form/CustomView.php b/application/admin/form/Customview-s.php similarity index 100% rename from application/admin/form/CustomView.php rename to application/admin/form/Customview-s.php diff --git a/application/admin/form/Goodsbrowse.php b/application/admin/form/Goodsbrowse.php new file mode 100644 index 000000000..661f2e060 --- /dev/null +++ b/application/admin/form/Goodsbrowse.php @@ -0,0 +1,148 @@ + [ + 'key_field' => 'id', + 'is_search' => 1, + 'search_url' => MyUrl('admin/goodsbrowse/index'), + 'is_delete' => 1, + 'delete_url' => MyUrl('admin/goodsbrowse/delete'), + 'delete_key' => 'ids', + ], + // 表单配置 + 'form' => [ + [ + 'view_type' => 'checkbox', + 'is_checked' => 0, + 'checked_text' => '反选', + 'not_checked_text' => '全选', + 'align' => 'center', + 'width' => 80, + ], + [ + 'label' => '用户信息', + 'view_type' => 'module', + 'view_key' => 'lib/module/user', + 'grid_size' => 'sm', + 'search_config' => [ + 'form_type' => 'input', + 'form_name' => 'b.user_id', + 'where_type' => 'like', + 'where_type_custom' => 'in', + 'where_handle_custom' => 'WhereValueUserInfo', + 'placeholder' => '请输入用户名/昵称/手机/邮箱', + ], + ], + [ + 'label' => '商品信息', + 'view_type' => 'module', + 'view_key' => 'goodsbrowse/module/goods', + 'grid_size' => 'lg', + 'search_config' => [ + 'form_type' => 'input', + 'form_name' => 'g.title|g.model|g.simple_desc|g.seo_title|g.seo_keywords|g.seo_keywords', + 'where_type' => 'like', + 'placeholder' => '请输入商品名称/简述/SEO信息' + ], + ], + [ + 'label' => '销售价格(元)', + 'view_type' => 'field', + 'view_key' => 'price', + 'search_config' => [ + 'form_type' => 'section', + 'form_name' => 'g.min_price', + 'is_point' => 1, + ], + ], + [ + 'label' => '原价(元)', + 'view_type' => 'field', + 'view_key' => 'original_price', + 'search_config' => [ + 'form_type' => 'section', + 'form_name' => 'g.min_original_price', + 'is_point' => 1, + ], + ], + [ + 'label' => '创建时间', + 'view_type' => 'field', + 'view_key' => 'add_time_time', + 'search_config' => [ + 'form_type' => 'datetime', + 'form_name' => 'b.add_time', + ], + ], + [ + 'label' => '操作', + 'view_type' => 'operate', + 'view_key' => 'goodsbrowse/module/operate', + 'align' => 'center', + 'fixed' => 'right', + ], + ], + ]; + } + + /** + * 用户信息条件处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-30 + * @desc description + * @param [string] $value [条件值] + * @param [array] $params [输入参数] + */ + public function WhereValueUserInfo($value, $params = []) + { + if(!empty($value)) + { + // 获取用户 id + $ids = Db::name('User')->where('username|nickname|mobile|email', 'like', '%'.$value.'%')->column('id'); + + // 避免空条件造成无效的错觉 + return empty($ids) ? [0] : $ids; + } + return $value; + } +} +?> \ No newline at end of file diff --git a/application/admin/form/Goodsfavor.php b/application/admin/form/Goodsfavor.php new file mode 100644 index 000000000..ec5c3d948 --- /dev/null +++ b/application/admin/form/Goodsfavor.php @@ -0,0 +1,148 @@ + [ + 'key_field' => 'id', + 'is_search' => 1, + 'search_url' => MyUrl('admin/goodsfavor/index'), + 'is_delete' => 1, + 'delete_url' => MyUrl('admin/goodsfavor/delete'), + 'delete_key' => 'ids', + ], + // 表单配置 + 'form' => [ + [ + 'view_type' => 'checkbox', + 'is_checked' => 0, + 'checked_text' => '反选', + 'not_checked_text' => '全选', + 'align' => 'center', + 'width' => 80, + ], + [ + 'label' => '用户信息', + 'view_type' => 'module', + 'view_key' => 'lib/module/user', + 'grid_size' => 'sm', + 'search_config' => [ + 'form_type' => 'input', + 'form_name' => 'f.user_id', + 'where_type' => 'like', + 'where_type_custom' => 'in', + 'where_handle_custom' => 'WhereValueUserInfo', + 'placeholder' => '请输入用户名/昵称/手机/邮箱', + ], + ], + [ + 'label' => '商品信息', + 'view_type' => 'module', + 'view_key' => 'goodsfavor/module/goods', + 'grid_size' => 'lg', + 'search_config' => [ + 'form_type' => 'input', + 'form_name' => 'g.title|g.model|g.simple_desc|g.seo_title|g.seo_keywords|g.seo_keywords', + 'where_type' => 'like', + 'placeholder' => '请输入商品名称/简述/SEO信息' + ], + ], + [ + 'label' => '销售价格(元)', + 'view_type' => 'field', + 'view_key' => 'price', + 'search_config' => [ + 'form_type' => 'section', + 'form_name' => 'g.min_price', + 'is_point' => 1, + ], + ], + [ + 'label' => '原价(元)', + 'view_type' => 'field', + 'view_key' => 'original_price', + 'search_config' => [ + 'form_type' => 'section', + 'form_name' => 'g.min_original_price', + 'is_point' => 1, + ], + ], + [ + 'label' => '创建时间', + 'view_type' => 'field', + 'view_key' => 'add_time_time', + 'search_config' => [ + 'form_type' => 'datetime', + 'form_name' => 'f.add_time', + ], + ], + [ + 'label' => '操作', + 'view_type' => 'operate', + 'view_key' => 'goodsfavor/module/operate', + 'align' => 'center', + 'fixed' => 'right', + ], + ], + ]; + } + + /** + * 用户信息条件处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-30 + * @desc description + * @param [string] $value [条件值] + * @param [array] $params [输入参数] + */ + public function WhereValueUserInfo($value, $params = []) + { + if(!empty($value)) + { + // 获取用户 id + $ids = Db::name('User')->where('username|nickname|mobile|email', 'like', '%'.$value.'%')->column('id'); + + // 避免空条件造成无效的错觉 + return empty($ids) ? [0] : $ids; + } + return $value; + } +} +?> \ No newline at end of file diff --git a/application/admin/view/default/answer/save_info.html b/application/admin/view/default/answer/save_info.html index e64d09b18..a23db9c41 100644 --- a/application/admin/view/default/answer/save_info.html +++ b/application/admin/view/default/answer/save_info.html @@ -18,7 +18,7 @@

用户信息

{{if !empty($data['user'])}} - {{$data.user.user_name_view}} + {{$data.user.user_name_view}}