From b081167d19c764b6435c8479964d70d41f4505fb Mon Sep 17 00:00:00 2001 From: devil Date: Sun, 7 Jun 2020 18:16:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=85=B1=E8=AF=A6=E6=83=85=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Common.php | 12 ++- application/admin/controller/Goods.php | 44 ++++----- .../admin/view/default/goods/detail.html | 20 ++-- .../admin/view/default/goods/index.html | 2 +- .../admin/view/default/order/detail.html | 20 ++-- .../view/default/public/module/detail.html | 97 +++++++++++++++++++ .../default/public/{ => module}/form.html | 0 application/index/controller/Common.php | 27 ++++++ 8 files changed, 172 insertions(+), 50 deletions(-) create mode 100644 application/admin/view/default/public/module/detail.html rename application/admin/view/default/public/{ => module}/form.html (100%) diff --git a/application/admin/controller/Common.php b/application/admin/controller/Common.php index 4f9aedde9..998472762 100755 --- a/application/admin/controller/Common.php +++ b/application/admin/controller/Common.php @@ -122,7 +122,7 @@ class Common extends Controller // 公共底部钩子 $this->assign('plugins_admin_view_common_bottom_data', Hook::listen('plugins_admin_view_common_bottom', ['hook_name'=>'plugins_admin_view_common_bottom', 'is_backend'=>true, 'admin'=>$this->admin])); - // 公共钩子名称动态处理 + // 公共表格钩子名称动态处理 $current = 'plugins_view_admin_'.$this->controller_name; // 内容外部顶部 $this->assign('hook_name_content_top', $current.'_content_top'); @@ -138,6 +138,16 @@ class Common extends Controller $this->assign('hook_name_form_bottom_operate', $current.'_bottom_operate'); // 表格列表后面操作栏 $this->assign('hook_name_form_list_operate', $current.'_list_operate'); + + // 公共详情页面钩子名称动态处理 + // 内容外部顶部 + $this->assign('hook_name_detail_top', $current.'_detail_top'); + // 内容外部底部 + $this->assign('hook_name_detail_bottom', $current.'_detail_bottom'); + // 内容内部顶部 + $this->assign('hook_name_detail_inside_top', $current.'_detail_inside_top'); + // 内容内部底部 + $this->assign('hook_name_detail_inside_bottom', $current.'_detail_inside_bottom'); } /** diff --git a/application/admin/controller/Goods.php b/application/admin/controller/Goods.php index 8da34948b..002b99b06 100755 --- a/application/admin/controller/Goods.php +++ b/application/admin/controller/Goods.php @@ -89,28 +89,28 @@ class Goods extends Common */ public function Detail() { - // 参数 - $params = input(); - - // 条件 - $where = GoodsService::GetAdminIndexWhere($params); - - // 获取列表 - $data_params = array( - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'is_category' => 1, - ); - $ret = GoodsService::GoodsList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - $this->assign('data', $data); - - // 是否上下架 - $this->assign('common_is_shelves_list', lang('common_is_shelves_list')); - - // 参数 - $this->assign('params', $params); + if(!empty($this->data_request['id'])) + { + // 条件 + $where = [ + ['is_delete_time', '=', 0], + ['id', '=', intval($this->data_request['id'])], + ]; + + // 获取列表 + $data_params = array( + 'm' => 0, + 'n' => 1, + 'where' => $where, + 'is_category' => 1, + ); + $ret = GoodsService::GoodsList($data_params); + $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; + $this->assign('data', $data); + + // 是否上下架 + $this->assign('common_is_shelves_list', lang('common_is_shelves_list')); + } return $this->fetch(); } diff --git a/application/admin/view/default/goods/detail.html b/application/admin/view/default/goods/detail.html index ed6aeb913..d7b20497f 100644 --- a/application/admin/view/default/goods/detail.html +++ b/application/admin/view/default/goods/detail.html @@ -1,8 +1,9 @@ -{{include file="public/header" /}} + +{{extend name="public/module/detail" /}} - -
- {{if !empty($data)}} + +{{if !empty($data)}} + {{block name="detail_data"}}
标题名称
@@ -89,12 +90,5 @@
更新时间
{{$data.upd_time}}
- {{else /}} -
没有相关数据
- {{/if}} -
- - - -{{include file="public/footer" /}} - \ No newline at end of file + {{/block}} +{{/if}} \ No newline at end of file diff --git a/application/admin/view/default/goods/index.html b/application/admin/view/default/goods/index.html index 2dec03f9a..d3845717b 100755 --- a/application/admin/view/default/goods/index.html +++ b/application/admin/view/default/goods/index.html @@ -1,5 +1,5 @@ -{{extend name="public/form" /}} +{{extend name="public/module/form" /}} {{block name="form_operate_top"}} diff --git a/application/admin/view/default/order/detail.html b/application/admin/view/default/order/detail.html index 4293a9792..d47aad337 100644 --- a/application/admin/view/default/order/detail.html +++ b/application/admin/view/default/order/detail.html @@ -1,8 +1,9 @@ -{{include file="public/header" /}} + +{{extend name="public/module/detail" /}} - -
- {{if !empty($data)}} + +{{if !empty($data)}} + {{block name="detail_data"}}
订单号
@@ -237,12 +238,5 @@
更新时间
{{$data.upd_time}}
- {{else /}} -
没有相关数据
- {{/if}} -
- - - -{{include file="public/footer" /}} - \ No newline at end of file + {{/block}} +{{/if}} \ No newline at end of file diff --git a/application/admin/view/default/public/module/detail.html b/application/admin/view/default/public/module/detail.html new file mode 100644 index 000000000..0dc968013 --- /dev/null +++ b/application/admin/view/default/public/module/detail.html @@ -0,0 +1,97 @@ +{{include file="public/header" /}} + + +{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} +
+ {{$hook_name_detail_top}} +
+{{/if}} +{{php}} + $hook_data = Hook::listen($hook_name_detail_top, ['hook_name'=>$hook_name_detail_top, 'is_backend'=>true]); + if(!empty($hook_data) && is_array($hook_data)) + { + foreach($hook_data as $hook) + { + if(is_string($hook) || is_int($hook)) + { + echo htmlspecialchars_decode($hook); + } + } + } +{{/php}} + + +
+ + {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} +
+ {{$hook_name_detail_inside_top}} +
+ {{/if}} + {{php}} + $hook_data = Hook::listen($hook_name_detail_inside_top, ['hook_name'=>$hook_name_detail_inside_top, 'is_backend'=>true]); + if(!empty($hook_data) && is_array($hook_data)) + { + foreach($hook_data as $hook) + { + if(is_string($hook) || is_int($hook)) + { + echo htmlspecialchars_decode($hook); + } + } + } + {{/php}} + + {{if !empty($data)}} + {{block name="detail_data"}}{{/block}} + {{else /}} + {{block name="detail_not_data"}} +
没有相关数据
+ {{/block}} + {{/if}} + + + {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} +
+ {{$hook_name_detail_inside_bottom}} +
+ {{/if}} + {{php}} + $hook_data = Hook::listen($hook_name_detail_inside_bottom, ['hook_name'=>$hook_name_detail_inside_bottom, 'is_backend'=>true]); + if(!empty($hook_data) && is_array($hook_data)) + { + foreach($hook_data as $hook) + { + if(is_string($hook) || is_int($hook)) + { + echo htmlspecialchars_decode($hook); + } + } + } + {{/php}} +
+ + + +{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} +
+ {{$hook_name_detail_bottom}} +
+{{/if}} +{{php}} + $hook_data = Hook::listen($hook_name_detail_bottom, ['hook_name'=>$hook_name_detail_bottom, 'is_backend'=>true]); + if(!empty($hook_data) && is_array($hook_data)) + { + foreach($hook_data as $hook) + { + if(is_string($hook) || is_int($hook)) + { + echo htmlspecialchars_decode($hook); + } + } + } +{{/php}} + + +{{include file="public/footer" /}} + \ No newline at end of file diff --git a/application/admin/view/default/public/form.html b/application/admin/view/default/public/module/form.html similarity index 100% rename from application/admin/view/default/public/form.html rename to application/admin/view/default/public/module/form.html diff --git a/application/index/controller/Common.php b/application/index/controller/Common.php index b35f42e3e..abb25203e 100755 --- a/application/index/controller/Common.php +++ b/application/index/controller/Common.php @@ -166,6 +166,33 @@ class Common extends Controller // 底部导航上面钩子 $this->assign('plugins_view_common_footer_top_data', Hook::listen('plugins_view_common_footer_top', ['hook_name'=>'plugins_view_common_footer_top', 'is_backend'=>false, 'user'=>$this->user])); + + // 公共表格钩子名称动态处理 + $current = 'plugins_view_index_'.$this->controller_name; + // 内容外部顶部 + $this->assign('hook_name_content_top', $current.'_content_top'); + // 内容外部底部 + $this->assign('hook_name_content_bottom', $current.'_content_bottom'); + // 内容内部顶部 + $this->assign('hook_name_content_inside_top', $current.'_content_inside_top'); + // 内容内部底部 + $this->assign('hook_name_content_inside_bottom', $current.'_content_inside_bottom'); + // 表格列表顶部操作 + $this->assign('hook_name_form_top_operate', $current.'_top_operate'); + // 表格列表底部操作 + $this->assign('hook_name_form_bottom_operate', $current.'_bottom_operate'); + // 表格列表后面操作栏 + $this->assign('hook_name_form_list_operate', $current.'_list_operate'); + + // 公共详情页面钩子名称动态处理 + // 内容外部顶部 + $this->assign('hook_name_detail_top', $current.'_detail_top'); + // 内容外部底部 + $this->assign('hook_name_detail_bottom', $current.'_detail_bottom'); + // 内容内部顶部 + $this->assign('hook_name_detail_inside_top', $current.'_detail_inside_top'); + // 内容内部底部 + $this->assign('hook_name_detail_inside_bottom', $current.'_detail_inside_bottom'); } /** -- GitLab