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}}