diff --git a/application/admin/controller/Goods.php b/application/admin/controller/Goods.php index 2e8866342..d6828df38 100755 --- a/application/admin/controller/Goods.php +++ b/application/admin/controller/Goods.php @@ -56,13 +56,13 @@ class Goods extends Common $total = GoodsService::GoodsTotal($this->form_where); // 分页 - $page_params = array( - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/goods/index'), - ); + $page_params = [ + 'number' => $this->page_size, + 'total' => $total, + 'where' => $this->data_request, + 'page' => $this->page, + 'url' => MyUrl('admin/goods/index'), + ]; $page = new \base\Page($page_params); // 获取数据列表 diff --git a/application/admin/controller/Goodscomments.php b/application/admin/controller/Goodscomments.php index e5ec8929f..35bddb97d 100644 --- a/application/admin/controller/Goodscomments.php +++ b/application/admin/controller/Goodscomments.php @@ -49,47 +49,63 @@ class Goodscomments extends Common */ public function Index() { - // 参数 - $params = input(); + // 总数 + $total = GoodsCommentsService::GoodsCommentsTotal($this->form_where); // 分页 - $number = MyC('admin_page_number', 10, true); - - // 条件 - $where = GoodsCommentsService::GoodsCommentsListWhere($params); - - // 获取总数 - $total = GoodsCommentsService::GoodsCommentsTotal($where); - - // 分页 - $page_params = array( - 'number' => $number, - 'total' => $total, - 'where' => $params, - 'page' => isset($params['page']) ? intval($params['page']) : 1, - 'url' => MyUrl('admin/goodscomments/index'), - ); + $page_params = [ + 'number' => $this->page_size, + 'total' => $total, + 'where' => $this->data_request, + 'page' => $this->page, + 'url' => MyUrl('admin/goodscomments/index'), + ]; $page = new \base\Page($page_params); - $this->assign('page_html', $page->GetPageHtml()); // 获取列表 - $data_params = array( - 'm' => $page->GetPageStarNumber(), - 'n' => $number, - 'where' => $where, - 'is_public' => 0, - ); - $data = GoodsCommentsService::GoodsCommentsList($data_params); - $this->assign('data_list', $data['data']); + $data_params = [ + 'where' => $this->form_where, + 'm' => $page->GetPageStarNumber(), + 'n' => $this->page_size, + 'is_public' => 0, + ]; + $ret = GoodsCommentsService::GoodsCommentsList($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('common_goods_comments_rating_list', lang('common_goods_comments_rating_list')); - $this->assign('common_goods_rating_business_type_list', lang('common_goods_rating_business_type_list')); + $this->assign('params', $this->data_request); + $this->assign('page_html', $page->GetPageHtml()); + $this->assign('data_list', $ret['data']); + return $this->fetch(); + } - // 参数 - $this->assign('params', $params); + /** + * 详情 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2019-08-05T08:21:54+0800 + */ + public function Detail() + { + if(!empty($this->data_request['id'])) + { + // 条件 + $where = [ + ['id', '=', intval($this->data_request['id'])], + ]; + + // 获取列表 + $data_params = [ + 'm' => 0, + 'n' => 1, + 'where' => $where, + 'is_category' => 1, + ]; + $ret = GoodsCommentsService::GoodsCommentsList($data_params); + $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; + $this->assign('data', $data); + + $this->assign('common_goods_comments_rating_list', lang('common_goods_comments_rating_list')); + } return $this->fetch(); } @@ -125,7 +141,7 @@ class Goodscomments extends Common $this->assign('common_is_show_list', lang('common_is_show_list')); $this->assign('common_is_text_list', lang('common_is_text_list')); $this->assign('common_goods_comments_rating_list', lang('common_goods_comments_rating_list')); - $this->assign('common_goods_rating_business_type_list', lang('common_goods_rating_business_type_list')); + $this->assign('common_goods_comments_business_type_list', lang('common_goods_comments_business_type_list')); // 参数 unset($params['id']); diff --git a/application/admin/controller/Order.php b/application/admin/controller/Order.php index dd5cab985..8b6e422ff 100755 --- a/application/admin/controller/Order.php +++ b/application/admin/controller/Order.php @@ -55,23 +55,23 @@ class Order extends Common $total = OrderService::OrderTotal($this->form_where); // 分页 - $page_params = array( - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/order/index'), - ); + $page_params = [ + 'number' => $this->page_size, + 'total' => $total, + 'where' => $this->data_request, + 'page' => $this->page, + 'url' => MyUrl('admin/order/index'), + ]; $page = new \base\Page($page_params); // 获取列表 - $data_params = array( + $data_params = [ 'm' => $page->GetPageStarNumber(), 'n' => $this->page_size, 'where' => $this->form_where, 'is_public' => 0, 'user_type' => 'admin', - ); + ]; $ret = OrderService::OrderList($data_params); // 发起支付 - 支付方式 diff --git a/application/admin/controller/Orderaftersale.php b/application/admin/controller/Orderaftersale.php index 183f92e42..ee9ae7851 100644 --- a/application/admin/controller/Orderaftersale.php +++ b/application/admin/controller/Orderaftersale.php @@ -56,13 +56,13 @@ class Orderaftersale extends Common $total = OrderAftersaleService::OrderAftersaleTotal($this->form_where); // 分页 - $page_params = array( - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/orderaftersale/index'), - ); + $page_params = [ + 'number' => $this->page_size, + 'total' => $total, + 'where' => $this->data_request, + 'page' => $this->page, + 'url' => MyUrl('admin/orderaftersale/index'), + ]; $page = new \base\Page($page_params); // 获取数据列表 diff --git a/application/admin/form/Goods.php b/application/admin/form/Goods.php index 79aed7e2f..90245f472 100644 --- a/application/admin/form/Goods.php +++ b/application/admin/form/Goods.php @@ -125,7 +125,6 @@ class Goods 'align' => 'center', 'search_config' => [ 'form_type' => 'select', - 'form_name' => 'is_shelves', 'where_type' => 'in', 'data' => lang('common_is_shelves_list'), 'data_key' => 'id', @@ -141,7 +140,6 @@ class Goods 'align' => 'center', 'search_config' => [ 'form_type' => 'select', - 'form_name' => 'is_home_recommended', 'where_type' => 'in', 'data' => lang('common_is_text_list'), 'data_key' => 'id', diff --git a/application/admin/form/Goodscomments.php b/application/admin/form/Goodscomments.php new file mode 100644 index 000000000..67f890bc8 --- /dev/null +++ b/application/admin/form/Goodscomments.php @@ -0,0 +1,276 @@ + [ + 'key_field' => 'id', + 'status_field' => 'is_show', + 'is_search' => 1, + 'search_url' => MyUrl('admin/goodscomments/index'), + 'is_delete' => 1, + 'delete_url' => MyUrl('admin/goodscomments/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' => 'goodscomments/module/info', + 'grid_size' => 'lg', + 'search_config' => [ + 'form_type' => 'input', + 'form_name' => 'id', + 'where_type' => 'like', + 'where_type_custom' => 'in', + 'where_handle_custom' => 'WhereValueBaseInfo', + 'placeholder' => '请输入商品名称/型号', + ], + ], + [ + 'label' => '用户信息', + 'view_type' => 'module', + 'view_key' => 'goodscomments/module/user', + 'grid_size' => 'sm', + 'search_config' => [ + 'form_type' => 'input', + 'form_name' => 'user_id', + 'where_type' => 'like', + 'where_type_custom' => 'in', + 'where_handle_custom' => 'WhereValueUserInfo', + 'placeholder' => '请输入用户名/昵称/手机/邮箱', + ], + ], + [ + 'label' => '业务类型', + 'view_type' => 'field', + 'view_key' => 'business_type_text', + 'width' => 120, + 'search_config' => [ + 'form_type' => 'select', + 'form_name' => 'business_type', + 'where_type' => 'in', + 'data' => lang('common_goods_comments_business_type_list'), + 'data_key' => 'value', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '评论内容', + 'view_type' => 'module', + 'view_key' => 'goodscomments/module/content', + 'grid_size' => 'lg', + 'search_config' => [ + 'form_type' => 'input', + 'form_name' => 'content', + 'where_type' => 'like', + ], + ], + [ + 'label' => '评论图片', + 'view_type' => 'module', + 'view_key' => 'goodscomments/module/images', + 'width' => 140, + ], + [ + 'label' => '评分', + 'view_type' => 'module', + 'view_key' => 'goodscomments/module/rating', + 'width' => 100, + 'search_config' => [ + 'form_type' => 'select', + 'form_name' => 'rating', + 'where_type' => 'in', + 'data' => lang('common_goods_comments_rating_list'), + 'data_key' => 'value', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '回复内容', + 'view_type' => 'module', + 'view_key' => 'goodscomments/module/reply', + 'grid_size' => 'lg', + 'search_config' => [ + 'form_type' => 'input', + 'form_name' => 'reply', + 'where_type' => 'like', + ], + ], + [ + 'label' => '是否显示', + 'view_type' => 'status', + 'view_key' => 'is_show', + 'post_url' => MyUrl('admin/goodscomments/statusupdate'), + 'is_form_su' => 1, + 'align' => 'center', + 'search_config' => [ + 'form_type' => 'select', + 'where_type' => 'in', + 'data' => lang('common_is_shelves_list'), + 'data_key' => 'id', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '是否匿名', + 'view_type' => 'status', + 'view_key' => 'is_anonymous', + 'post_url' => MyUrl('admin/goodscomments/statusupdate'), + 'align' => 'center', + 'search_config' => [ + 'form_type' => 'select', + 'where_type' => 'in', + 'data' => lang('common_is_text_list'), + 'data_key' => 'id', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '是否回复', + 'view_type' => 'status', + 'view_key' => 'is_reply', + 'post_url' => MyUrl('admin/goodscomments/statusupdate'), + 'align' => 'center', + 'search_config' => [ + 'form_type' => 'select', + 'where_type' => 'in', + 'data' => lang('common_is_text_list'), + 'data_key' => 'id', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '回复时间', + 'view_type' => 'field', + 'view_key' => 'reply_time_time', + 'search_config' => [ + 'form_type' => 'datetime', + 'form_name' => 'reply_time', + ], + ], + [ + 'label' => '创建时间', + 'view_type' => 'field', + 'view_key' => 'add_time_time', + 'search_config' => [ + 'form_type' => 'datetime', + 'form_name' => 'add_time', + ], + ], + [ + 'label' => '更新时间', + 'view_type' => 'field', + 'view_key' => 'upd_time_time', + 'search_config' => [ + 'form_type' => 'datetime', + 'form_name' => 'upd_time', + ], + ], + [ + 'label' => '操作', + 'view_type' => 'operate', + 'view_key' => 'goodscomments/module/operate', + 'align' => 'center', + 'fixed' => 'right', + ], + ], + ]; + } + + /** + * 用户信息条件处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-08 + * @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; + } + + /** + * 基础信息条件处理 + * @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('GoodsComments')->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/view/default/goods/detail.html b/application/admin/view/default/goods/detail.html index d7b20497f..017b1656e 100644 --- a/application/admin/view/default/goods/detail.html +++ b/application/admin/view/default/goods/detail.html @@ -7,9 +7,9 @@
{{$price_symbol}}{{$data.goods.price}}
+ {{else /}} + 商品信息异常 + {{/if}} +