vr-shopxo-source/application/plugins/answers/Hook.php

59 lines
2.1 KiB
PHP
Raw Normal View History

2019-03-06 10:34:55 +00:00
<?php
2019-03-08 09:36:45 +00:00
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
2019-03-06 10:34:55 +00:00
namespace app\plugins\answers;
use think\Controller;
2019-03-11 09:57:15 +00:00
use app\service\PluginsService;
2019-03-06 10:34:55 +00:00
/**
* 问答 - 钩子入口
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class Hook extends Controller
{
2019-03-16 08:38:42 +00:00
/**
* 钩子入口
* @author Guoguo
* @blog http://gadmin.cojz8.com
* @version 1.0.0
* @datetime 2019年3月14日
*/
2019-03-06 10:34:55 +00:00
public function run($params = [])
{
2019-03-16 08:38:42 +00:00
// 大导航前面添加问答地址
if(!empty($params['hook_name']) && $params['hook_name'] == 'plugins_service_navigation_header_handle')
2019-03-06 10:34:55 +00:00
{
2019-03-16 08:38:42 +00:00
if(is_array($params['header']))
2019-03-11 09:57:15 +00:00
{
2019-03-16 08:38:42 +00:00
// 获取应用数据
2019-03-26 09:48:53 +00:00
$ret = PluginsService::PluginsData('answers', ['images', 'images_bottom']);
2019-03-16 08:38:42 +00:00
if($ret['code'] == 0 && !empty($ret['data']['application_name']))
2019-03-11 09:57:15 +00:00
{
2019-03-16 08:38:42 +00:00
$nav = [
'id' => 0,
'pid' => 0,
'name' => $ret['data']['application_name'],
'url' => PluginsHomeUrl('answers', 'index', 'index'),
'data_type' => 'custom',
'is_show' => 1,
'is_new_window_open' => 0,
'items' => [],
];
array_unshift($params['header'], $nav);
2019-03-11 09:57:15 +00:00
}
}
2019-03-06 10:34:55 +00:00
}
}
}
?>