2019-04-19 18:19:41 +08:00
|
|
|
<?php
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | Author: Devil
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\plugins\share;
|
|
|
|
|
|
|
|
use think\Controller;
|
|
|
|
use app\service\PluginsService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 分享 - 钩子入口
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 0.0.1
|
|
|
|
* @datetime 2016-12-01T21:51:08+0800
|
|
|
|
*/
|
|
|
|
class Hook extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 应用响应入口
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @datetime 2019-02-09T14:25:44+0800
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
*/
|
|
|
|
public function run($params = [])
|
|
|
|
{
|
|
|
|
$ret = '';
|
|
|
|
if(!empty($params['hook_name']))
|
|
|
|
{
|
|
|
|
switch($params['hook_name'])
|
|
|
|
{
|
|
|
|
case 'plugins_css' :
|
|
|
|
$ret = [
|
2019-04-30 16:27:01 +08:00
|
|
|
__MY_ROOT_PUBLIC__.'static/plugins/css/share/index/iconfont.css',
|
|
|
|
__MY_ROOT_PUBLIC__.'static/plugins/css/share/index/style.css',
|
2019-04-19 18:19:41 +08:00
|
|
|
];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'plugins_js' :
|
2019-04-30 16:27:01 +08:00
|
|
|
$ret = __MY_ROOT_PUBLIC__.'static/plugins/js/share/index/style.js';
|
2019-04-19 18:19:41 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'plugins_view_common_bottom' :
|
2019-04-22 02:21:38 +08:00
|
|
|
$ret = $this->Content($params);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'plugins_view_goods_detail_photo_bottom' :
|
|
|
|
$ret = $this->GoodsPhotoBottom($params);
|
2019-04-19 18:19:41 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-04-22 02:21:38 +08:00
|
|
|
* 商品页面相册底部钩子
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @datetime 2019-04-22T02:08:26+0800
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
*/
|
|
|
|
private function GoodsPhotoBottom($params = [])
|
|
|
|
{
|
|
|
|
// html
|
2019-04-22 12:33:46 +08:00
|
|
|
$html ='<div class="am-dropdown plugins-goods-share-view" data-am-dropdown>';
|
|
|
|
$html .= '<a href="javascript:;" class="am-dropdown-toggle am-icon-share-alt" data-am-dropdown-toggle> 分享</a>';
|
|
|
|
$html .= '<div class="am-dropdown-content plugins-share-view"';
|
2019-04-22 02:21:38 +08:00
|
|
|
|
|
|
|
// 默认图片
|
|
|
|
if(!empty($params['goods']['photo'][0]['images']))
|
|
|
|
{
|
|
|
|
$html .= ' data-pic="'.$params['goods']['photo'][0]['images'].'"';
|
|
|
|
}
|
|
|
|
|
2019-04-22 12:33:46 +08:00
|
|
|
return $html.'></div></div>';
|
2019-04-22 02:21:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 视图html
|
2019-04-19 18:19:41 +08:00
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @datetime 2019-02-06T16:16:34+0800
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
*/
|
2019-04-22 02:21:38 +08:00
|
|
|
private function Content($params = [])
|
2019-04-19 18:19:41 +08:00
|
|
|
{
|
|
|
|
// 获取应用数据
|
2019-04-22 00:18:56 +08:00
|
|
|
$ret = PluginsService::PluginsData('share', ['pic']);
|
2019-04-19 18:19:41 +08:00
|
|
|
if($ret['code'] == 0)
|
|
|
|
{
|
|
|
|
$this->assign('data', $ret['data']);
|
2019-05-09 01:15:36 +08:00
|
|
|
return $this->fetch('../../../plugins/view/share/index/public/content');
|
2019-04-19 18:19:41 +08:00
|
|
|
} else {
|
|
|
|
return $ret['msg'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|