钩子+商品icon优化

This commit is contained in:
Devil 2021-08-07 00:41:33 +08:00
parent d430ec929b
commit 9ce29bfe03
5 changed files with 43 additions and 4 deletions

View File

@ -1393,7 +1393,7 @@ function SyncJob($url, $port = 80, $time = 30)
* @return [json] [json数据] * @return [json] [json数据]
*/ */
function DataReturn($msg = '', $code = 0, $data = '') function DataReturn($msg = '', $code = 0, $data = '')
{ {
// 默认情况下,手动调用当前方法 // 默认情况下,手动调用当前方法
$result = ['msg'=>$msg, 'code'=>$code, 'data'=>$data]; $result = ['msg'=>$msg, 'code'=>$code, 'data'=>$data];

View File

@ -173,7 +173,7 @@
<span class="goods-plugins-view-icon-container"> <span class="goods-plugins-view-icon-container">
{{foreach $goods.plugins_view_icon_data as $v}} {{foreach $goods.plugins_view_icon_data as $v}}
{{if !empty($v) or is_array($v) and !empty($v['name'])}} {{if !empty($v) or is_array($v) and !empty($v['name'])}}
<span class="am-badge am-radius" style="{{if !empty($v['br_color'])}}border:1px solid {{$v.br_color}};{{/if}}{{if !empty($v['color'])}}color:{{$v.color}};{{/if}}">{{$v.name}}</span> <a class="am-badge am-radius" href="{{if empty($v['url'])}}javascript:;{{else /}}{{$v.url}}{{/if}}" style="{{if !empty($v['br_color'])}}border:1px solid {{$v.br_color}};{{/if}}{{if !empty($v['color'])}}color:{{$v.color}};{{/if}}">{{$v.name}}</a>
{{/if}} {{/if}}
{{/foreach}} {{/foreach}}
</span> </span>

View File

@ -473,6 +473,15 @@ class GoodsService
{ {
if(!empty($data)) if(!empty($data))
{ {
// 商品列表钩子-前面
$hook_name = 'plugins_service_goods_list_handle_begin';
MyEventTrigger($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'params' => &$params,
'data' => &$data,
]);
// 其它额外处理 // 其它额外处理
$is_photo = (isset($params['is_photo']) && $params['is_photo'] == true) ? true : false; $is_photo = (isset($params['is_photo']) && $params['is_photo'] == true) ? true : false;
$is_spec = (isset($params['is_spec']) && $params['is_spec'] == true) ? true : false; $is_spec = (isset($params['is_spec']) && $params['is_spec'] == true) ? true : false;
@ -654,11 +663,13 @@ class GoodsService
// bg_color 默认(#fff) // bg_color 默认(#fff)
// br_color 默认(#3bb4f2) // br_color 默认(#3bb4f2)
// color 默认($3bb4f2) // color 默认($3bb4f2)
// url 默认空(手机端请自行调整url地址)
// [ // [
// 'name' => 'icon名称', // 'name' => 'icon名称',
// 'bg_color' => '#fff', // 'bg_color' => '#fff',
// 'br_color' => '#3bb4f2', // 'br_color' => '#3bb4f2',
// 'color' => '#3bb4f2', // 'color' => '#3bb4f2',
// 'url' => 'url地址'
// ] // ]
$v['plugins_view_icon_data'] = []; $v['plugins_view_icon_data'] = [];
@ -677,6 +688,15 @@ class GoodsService
return $ret; return $ret;
} }
} }
// 商品列表钩子-后面
$hook_name = 'plugins_service_goods_list_handle_end';
MyEventTrigger($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'params' => &$params,
'data' => &$data,
]);
} }
return DataReturn('success', 0, $data); return DataReturn('success', 0, $data);
} }

View File

@ -139,6 +139,16 @@ class UserService
$data = Db::name('User')->where($where)->order($order_by)->field($field)->limit($m, $n)->select()->toArray(); $data = Db::name('User')->where($where)->order($order_by)->field($field)->limit($m, $n)->select()->toArray();
if(!empty($data)) if(!empty($data))
{ {
// 用户列表钩子-前面
$hook_name = 'plugins_service_user_list_handle_begin';
MyEventTrigger($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'params' => &$params,
'data' => &$data,
]);
// 开始处理数据
$common_gender_list = lang('common_gender_list'); $common_gender_list = lang('common_gender_list');
$common_user_status_list = lang('common_user_status_list'); $common_user_status_list = lang('common_user_status_list');
foreach($data as &$v) foreach($data as &$v)
@ -182,6 +192,15 @@ class UserService
$v['status_text'] = $common_user_status_list[$v['status']]['name']; $v['status_text'] = $common_user_status_list[$v['status']]['name'];
} }
} }
// 用户列表钩子-后面
$hook_name = 'plugins_service_user_list_handle_end';
MyEventTrigger($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'params' => &$params,
'data' => &$data,
]);
} }
return DataReturn('处理成功', 0, $data); return DataReturn('处理成功', 0, $data);
} }

View File

@ -579,11 +579,11 @@ flex: 1 1 0%;line-height: 16px;cursor: pointer;}
/** /**
* 插件公共icon数据 * 插件公共icon数据
*/ */
.goods-plugins-view-icon-container span { .goods-plugins-view-icon-container a {
background: #fff; background: #fff;
border: 1px solid #3bb4f2; border: 1px solid #3bb4f2;
color: #3bb4f2; color: #3bb4f2;
} }
.goods-plugins-view-icon-container span:not(:first-child) { .goods-plugins-view-icon-container a:not(:first-child) {
margin-left: 5px; margin-left: 5px;
} }