商品保存新增钩子
parent
e035dca25b
commit
2e4d73d624
|
|
@ -10,6 +10,7 @@
|
|||
// +----------------------------------------------------------------------
|
||||
namespace app\admin\controller;
|
||||
|
||||
use think\facade\Hook;
|
||||
use app\service\ResourcesService;
|
||||
use app\service\GoodsService;
|
||||
use app\service\RegionService;
|
||||
|
|
@ -129,7 +130,6 @@ class Goods extends Common
|
|||
$specifications = GoodsService::GoodsEditSpecifications($ret['data'][0]['id']);
|
||||
$this->assign('specifications', $specifications);
|
||||
}
|
||||
$this->assign('data', $data);
|
||||
|
||||
// 地区信息
|
||||
$this->assign('region_province_list', RegionService::RegionItems(['pid'=>0]));
|
||||
|
|
@ -144,12 +144,22 @@ class Goods extends Common
|
|||
$goods_spec_extends = GoodsService::GoodsSpecificationsExtends();
|
||||
$this->assign('goods_specifications_extends', $goods_spec_extends['data']);
|
||||
|
||||
// 参数
|
||||
$this->assign('params', $params);
|
||||
// 商品编辑页面钩子
|
||||
$this->assign('plugins_view_admin_goods_save_data', Hook::listen('plugins_view_admin_goods_save',
|
||||
[
|
||||
'hook_name' => 'plugins_view_admin_goods_save',
|
||||
'is_backend' => false,
|
||||
'goods_id' => $params['id'],
|
||||
'data' => &$data,
|
||||
'params' => &$params,
|
||||
]));
|
||||
|
||||
// 编辑器文件存放地址
|
||||
// 编辑器文件存放地址
|
||||
$this->assign('editor_path_type', 'goods');
|
||||
|
||||
// 数据
|
||||
$this->assign('data', $data);
|
||||
$this->assign('params', $params);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@
|
|||
<li>
|
||||
<a href="#goods-nav-web">电脑端详情</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#goods-nav-extends">扩展数据</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#goods-nav-seo">SEO</a>
|
||||
</li>
|
||||
|
|
@ -377,6 +380,27 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 扩展数据 -->
|
||||
<div id="goods-nav-extends" class="division-block">
|
||||
<label class="block nav-detail-title">扩展数据<span class="am-form-group-label-tips-must">该区域为插件扩展数据,请按照插件文档填写相应的值</span></label>
|
||||
<!-- 插件扩展数据 start -->
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
|
||||
<div class="plugins-tag">
|
||||
<span>plugins_view_admin_goods_save</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($plugins_view_admin_goods_save_data) and is_array($plugins_view_admin_goods_save_data)}}
|
||||
{{foreach $plugins_view_admin_goods_save_data as $hook}}
|
||||
{{if is_string($hook) or is_int($hook)}}
|
||||
{{$hook|raw}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{else /}}
|
||||
<div class="table-no"><i class="am-icon-warning"></i> 没有扩展数据</div>
|
||||
{{/if}}
|
||||
<!-- 插件扩展数据 end -->
|
||||
</div>
|
||||
|
||||
<!-- seo -->
|
||||
<div id="goods-nav-seo" class="division-block">
|
||||
<label class="block nav-detail-title">SEO</label>
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
<!-- plugins config start -->
|
||||
{{if !empty($data['element'])}}
|
||||
<div class="am-alert am-alert-secondary">
|
||||
<label class="am-text-sm am-text-warning">该区域为插件配置填写项,请按照插件文档填写相应的值。</label>
|
||||
<label class="am-text-sm am-text-warning">该区域为插件配置填写项,请按照插件文档填写相应的值</label>
|
||||
{{foreach $data.element as $element}}
|
||||
<div class="am-form-group">
|
||||
<label class="block">{{$element.title}}{{if !empty($element['desc'])}}<span class="am-form-group-label-tips">{{$element.desc}}</span>{{/if}}</label>
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@
|
|||
{{/if}}
|
||||
{{if !empty($plugins_view_admin_user_save_data) and is_array($plugins_view_admin_user_save_data)}}
|
||||
<div class="am-alert am-alert-secondary">
|
||||
<label class="am-text-sm am-text-warning">该区域为插件扩展数据,请按照插件文档填写相应的值。</label>
|
||||
<label class="am-text-sm am-text-warning">该区域为插件扩展数据,请按照插件文档填写相应的值</label>
|
||||
<div>
|
||||
{{foreach $plugins_view_admin_user_save_data as $hook}}
|
||||
{{if is_string($hook) or is_int($hook)}}
|
||||
|
|
|
|||
|
|
@ -1090,6 +1090,20 @@ class GoodsService
|
|||
'seo_desc' => empty($params['seo_desc']) ? '' : $params['seo_desc'],
|
||||
];
|
||||
|
||||
// 商品保存处理钩子
|
||||
$hook_name = 'plugins_service_goods_save_handle';
|
||||
$ret = Hook::listen($hook_name, [
|
||||
'hook_name' => $hook_name,
|
||||
'is_backend' => true,
|
||||
'params' => &$params,
|
||||
'data' => &$data,
|
||||
'goods_id' => isset($params['id']) ? intval($params['id']) : 0,
|
||||
]);
|
||||
if(isset($ret['code']) && $ret['code'] != 0)
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// 启动事务
|
||||
Db::startTrans();
|
||||
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ class UserService
|
|||
'upd_time' => time(),
|
||||
];
|
||||
|
||||
// 用户编辑处理钩子
|
||||
// 用户保存处理钩子
|
||||
$hook_name = 'plugins_service_user_save_handle';
|
||||
$ret = Hook::listen($hook_name, [
|
||||
'hook_name' => $hook_name,
|
||||
|
|
|
|||
Loading…
Reference in New Issue