diff --git a/application/service/AppCenterNavService.php b/application/service/AppCenterNavService.php
index b718c12dd..1d933254a 100755
--- a/application/service/AppCenterNavService.php
+++ b/application/service/AppCenterNavService.php
@@ -11,6 +11,7 @@
namespace app\service;
use think\Db;
+use think\facade\Hook;
use app\service\ResourcesService;
/**
@@ -275,19 +276,39 @@ class AppCenterNavService
*/
public static function AppCenterNav($params = [])
{
- $client_type = (APPLICATION_CLIENT_TYPE == 'pc') ? (IsMobile() ? 'h5' : 'pc') : APPLICATION_CLIENT_TYPE;
- $field = 'id,name,images_url,event_value,event_type,desc';
- $order_by = 'sort asc,id asc';
- $data = Db::name('AppCenterNav')->field($field)->where(['platform'=>$client_type, 'is_enable'=>1])->order($order_by)->select();
- if(!empty($data))
+ // 平台
+ $platform = ApplicationClientType();
+
+ // 缓存
+ $key = config('shopxo.cache_app_user_center_navigation_key').$platform;
+ $data = cache($key);
+
+ if(empty($data))
{
- foreach($data as &$v)
+ $field = 'id,name,images_url,event_value,event_type,desc';
+ $order_by = 'sort asc,id asc';
+ $data = Db::name('AppCenterNav')->field($field)->where(['platform'=>$platform, 'is_enable'=>1])->order($order_by)->select();
+ if(!empty($data))
{
- $v['images_url_old'] = $v['images_url'];
- $v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
- $v['event_value'] = empty($v['event_value']) ? null : $v['event_value'];
+ foreach($data as &$v)
+ {
+ $v['images_url_old'] = $v['images_url'];
+ $v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
+ $v['event_value'] = empty($v['event_value']) ? null : $v['event_value'];
+ }
}
+ // 存储缓存
+ cache($key, $data, 3600*24);
}
+
+ // 手机用户中心导航钩子
+ $hook_name = 'plugins_service_app_user_center_navigation_'.$platform;
+ Hook::listen($hook_name, [
+ 'hook_name' => $hook_name,
+ 'is_backend' => true,
+ 'data' => &$data,
+ ]);
+
return $data;
}
}
diff --git a/application/service/AppHomeNavService.php b/application/service/AppHomeNavService.php
index 4e7758878..86a340f44 100755
--- a/application/service/AppHomeNavService.php
+++ b/application/service/AppHomeNavService.php
@@ -11,6 +11,7 @@
namespace app\service;
use think\Db;
+use think\facade\Hook;
use app\service\ResourcesService;
/**
@@ -271,16 +272,10 @@ class AppHomeNavService
public static function AppHomeNav($params = [])
{
// 平台
- $platform = APPLICATION_CLIENT_TYPE;
-
- // web端手机访问
- if($platform == 'pc' && IsMobile())
- {
- $platform = 'h5';
- }
+ $platform = ApplicationClientType();
// 缓存
- $key = config('shopxo.cache_navigation_key').$platform;
+ $key = config('shopxo.cache_app_home_navigation_key').$platform;
$data = cache($key);
if(empty($data))
@@ -302,6 +297,15 @@ class AppHomeNavService
// 存储缓存
cache($key, $data, 3600*24);
}
+
+ // 手机首页导航钩子
+ $hook_name = 'plugins_service_app_home_navigation_'.$platform;
+ Hook::listen($hook_name, [
+ 'hook_name' => $hook_name,
+ 'is_backend' => true,
+ 'data' => &$data,
+ ]);
+
return $data;
}
}
diff --git a/application/service/BannerService.php b/application/service/BannerService.php
index 2eedaf35e..9f8c9c810 100755
--- a/application/service/BannerService.php
+++ b/application/service/BannerService.php
@@ -34,13 +34,7 @@ class BannerService
public static function Banner($params = [])
{
// 平台
- $platform = APPLICATION_CLIENT_TYPE;
-
- // web端手机访问
- if($platform == 'pc' && IsMobile())
- {
- $platform = 'h5';
- }
+ $platform = ApplicationClientType();
// 缓存
$key = config('shopxo.cache_banner_list_key').$platform;
diff --git a/application/service/BuyService.php b/application/service/BuyService.php
index a8294e7a0..d8d6a0c57 100755
--- a/application/service/BuyService.php
+++ b/application/service/BuyService.php
@@ -1029,7 +1029,7 @@ class BuyService
$order_status = (intval(MyC('common_order_is_booking', 0)) == 1) ? 0 : 1;
// 订单来源
- $client_type = (APPLICATION_CLIENT_TYPE == 'pc' && IsMobile()) ? 'h5' : APPLICATION_CLIENT_TYPE;
+ $client_type = ApplicationClientType();
// 开始事务
Db::startTrans();
diff --git a/application/service/OrderService.php b/application/service/OrderService.php
index c669dc853..7f93b09c3 100755
--- a/application/service/OrderService.php
+++ b/application/service/OrderService.php
@@ -250,28 +250,25 @@ class OrderService
}
// 微信中打开并且webopenid为空
- if(in_array(APPLICATION_CLIENT_TYPE, ['pc', 'h5']))
+ if(ApplicationClientType() == 'h5' && IsWeixinEnv() && empty($pay_data['user']['weixin_web_openid']))
{
- if(!empty($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false && empty($pay_data['user']['weixin_web_openid']))
+ // 授权成功后回调订单详情页面重新自动发起支付
+ // 单个订单进入详情,则进入列表
+ $weixin_params = [
+ 'is_pay_auto' => 1,
+ 'is_pay_submit' => 1,
+ 'payment_id' => $payment['id'],
+ ];
+ if(count($order_ids) == 1)
{
- // 授权成功后回调订单详情页面重新自动发起支付
- // 单个订单进入详情,则进入列表
- $weixin_params = [
- 'is_pay_auto' => 1,
- 'is_pay_submit' => 1,
- 'payment_id' => $payment['id'],
- ];
- if(count($order_ids) == 1)
- {
- $weixin_params['id'] = $order_ids[0];
- $weixin_params['ids'] = $order_ids[0];
- $url = MyUrl('index/order/detail', $weixin_params);
- } else {
- $weixin_params['ids'] = urldecode(implode(',', $order_ids));
- $url = MyUrl('index/order/index', $weixin_params);
- }
- session('plugins_weixinwebauth_pay_callback_view_url', $url);
+ $weixin_params['id'] = $order_ids[0];
+ $weixin_params['ids'] = $order_ids[0];
+ $url = MyUrl('index/order/detail', $weixin_params);
+ } else {
+ $weixin_params['ids'] = urldecode(implode(',', $order_ids));
+ $url = MyUrl('index/order/index', $weixin_params);
}
+ session('plugins_weixinwebauth_pay_callback_view_url', $url);
}
// 发起支付
diff --git a/application/service/QuickNavService.php b/application/service/QuickNavService.php
new file mode 100755
index 000000000..ef644317d
--- /dev/null
+++ b/application/service/QuickNavService.php
@@ -0,0 +1,312 @@
+where($where)->order($order_by)->limit($m, $n)->select();
+ if(!empty($data))
+ {
+ $common_platform_type = lang('common_platform_type');
+ $common_app_event_type = lang('common_app_event_type');
+ foreach($data as &$v)
+ {
+ // 平台类型
+ if(isset($v['platform']))
+ {
+ $v['platform_text'] = $common_platform_type[$v['platform']]['name'];
+ }
+
+ // 事件类型
+ if(isset($v['event_type']) && $v['event_type'] != -1)
+ {
+ $v['event_type_text'] = $common_app_event_type[$v['event_type']]['name'];
+ }
+
+ // 图片地址
+ if(isset($v['images_url']))
+ {
+ $v['images_url_old'] = $v['images_url'];
+ $v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
+ }
+
+ // 时间
+ if(isset($v['add_time']))
+ {
+ $v['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
+ }
+ if(isset($v['upd_time']))
+ {
+ $v['upd_time'] = empty($v['upd_time']) ? '' : date('Y-m-d H:i:s', $v['upd_time']);
+ }
+ }
+ }
+ return DataReturn('处理成功', 0, $data);
+ }
+
+ /**
+ * 首页导航总数
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 0.0.1
+ * @datetime 2016-12-10T22:16:29+0800
+ * @param [array] $where [条件]
+ */
+ public static function QuickNavTotal($where)
+ {
+ return (int) Db::name('QuickNav')->where($where)->count();
+ }
+
+ /**
+ * 首页导航数据保存
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-12-19
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public static function QuickNavSave($params = [])
+ {
+ // 请求类型
+ $p = [
+ [
+ 'checked_type' => 'length',
+ 'key_name' => 'name',
+ 'checked_data' => '2,60',
+ 'error_msg' => '名称长度 2~60 个字符',
+ ],
+ [
+ 'checked_type' => 'in',
+ 'key_name' => 'platform',
+ 'checked_data' => array_column(lang('common_platform_type'), 'value'),
+ 'error_msg' => '平台类型有误',
+ ],
+ [
+ 'checked_type' => 'in',
+ 'key_name' => 'event_type',
+ 'checked_data' => array_column(lang('common_app_event_type'), 'value'),
+ 'is_checked' => 2,
+ 'error_msg' => '事件值类型有误',
+ ],
+ [
+ 'checked_type' => 'length',
+ 'key_name' => 'event_value',
+ 'checked_data' => '255',
+ 'error_msg' => '事件值最多 255 个字符',
+ ],
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'images_url',
+ 'checked_data' => '255',
+ 'error_msg' => '请上传图片',
+ ],
+ [
+ 'checked_type' => 'length',
+ 'key_name' => 'sort',
+ 'checked_data' => '3',
+ 'error_msg' => '顺序 0~255 之间的数值',
+ ],
+ ];
+ $ret = ParamsChecked($params, $p);
+ if($ret !== true)
+ {
+ return DataReturn($ret, -1);
+ }
+
+ // 附件
+ $data_fields = ['images_url'];
+ $attachment = ResourcesService::AttachmentParams($params, $data_fields);
+
+ // 数据
+ $data = [
+ 'name' => $params['name'],
+ 'platform' => $params['platform'],
+ 'event_type' => isset($params['event_type']) ? intval($params['event_type']) : -1,
+ 'event_value' => $params['event_value'],
+ 'images_url' => $attachment['data']['images_url'],
+ 'bg_color' => isset($params['bg_color']) ? $params['bg_color'] : '',
+ 'sort' => intval($params['sort']),
+ 'is_enable' => isset($params['is_enable']) ? intval($params['is_enable']) : 0,
+ ];
+
+ if(empty($params['id']))
+ {
+ $data['add_time'] = time();
+ if(Db::name('QuickNav')->insertGetId($data) > 0)
+ {
+ return DataReturn('添加成功', 0);
+ }
+ return DataReturn('添加失败', -100);
+ } else {
+ $data['upd_time'] = time();
+ if(Db::name('QuickNav')->where(['id'=>intval($params['id'])])->update($data))
+ {
+ return DataReturn('编辑成功', 0);
+ }
+ return DataReturn('编辑失败', -100);
+ }
+ }
+
+ /**
+ * 首页导航删除
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-12-18
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public static function QuickNavDelete($params = [])
+ {
+ // 参数是否有误
+ if(empty($params['ids']))
+ {
+ return DataReturn('操作id有误', -1);
+ }
+ // 是否数组
+ if(!is_array($params['ids']))
+ {
+ $params['ids'] = explode(',', $params['ids']);
+ }
+
+ // 删除操作
+ if(Db::name('QuickNav')->where(['id'=>$params['ids']])->delete())
+ {
+ return DataReturn('删除成功');
+ }
+
+ return DataReturn('删除失败', -100);
+ }
+
+ /**
+ * 首页导航状态更新
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 0.0.1
+ * @datetime 2016-12-06T21:31:53+0800
+ * @param [array] $params [输入参数]
+ */
+ public static function QuickNavStatusUpdate($params = [])
+ {
+ // 请求参数
+ $p = [
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'id',
+ 'error_msg' => '操作id有误',
+ ],
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'field',
+ 'error_msg' => '操作字段有误',
+ ],
+ [
+ 'checked_type' => 'in',
+ 'key_name' => 'state',
+ 'checked_data' => [0,1],
+ 'error_msg' => '状态有误',
+ ],
+ ];
+ $ret = ParamsChecked($params, $p);
+ if($ret !== true)
+ {
+ return DataReturn($ret, -1);
+ }
+
+ // 数据更新
+ if(Db::name('QuickNav')->where(['id'=>intval($params['id'])])->update([$params['field']=>intval($params['state']), 'upd_time'=>time()]))
+ {
+ return DataReturn('操作成功');
+ }
+ return DataReturn('操作失败', -100);
+ }
+
+ /**
+ * APP获取首页导航
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-11-19
+ * @desc description
+ * @param array $params [description]
+ */
+ public static function QuickNav($params = [])
+ {
+ // 平台
+ $platform = ApplicationClientType();
+
+ // 缓存
+ $key = config('shopxo.cache_quick_navigation_key').$platform;
+ $data = cache($key);
+
+ if(empty($data))
+ {
+ // 获取导航数据
+ $field = 'id,name,images_url,event_value,event_type,bg_color';
+ $order_by = 'sort asc,id asc';
+ $data = Db::name('QuickNav')->field($field)->where(['platform'=>$platform, 'is_enable'=>1])->order($order_by)->select();
+ if(!empty($data))
+ {
+ foreach($data as &$v)
+ {
+ $v['images_url_old'] = $v['images_url'];
+ $v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
+ $v['event_value'] = empty($v['event_value']) ? null : $v['event_value'];
+ }
+ }
+
+ // 存储缓存
+ cache($key, $data, 3600*24);
+ }
+
+ // 快捷导航钩子
+ // 数据参数可以自定义新增 class_name 名称、方便非url事件使用js控制点击事件
+ $hook_name = 'plugins_service_quick_navigation_'.$platform;
+ Hook::listen($hook_name, [
+ 'hook_name' => $hook_name,
+ 'is_backend' => true,
+ 'data' => &$data,
+ ]);
+
+ return $data;
+ }
+}
+?>
\ No newline at end of file
diff --git a/application/tags.php b/application/tags.php
index 53c802a31..cb3649c9a 100755
--- a/application/tags.php
+++ b/application/tags.php
@@ -35,14 +35,18 @@ return array (
'plugins_css' =>
array (
0 => 'app\\plugins\\share\\Hook',
+ 1 => 'app\\plugins\\exchangerate\\Hook',
+ 2 => 'app\\plugins\\freightfee\\Hook',
),
'plugins_js' =>
array (
0 => 'app\\plugins\\share\\Hook',
+ 1 => 'app\\plugins\\exchangerate\\Hook',
),
'plugins_view_common_bottom' =>
array (
0 => 'app\\plugins\\share\\Hook',
+ 1 => 'app\\plugins\\exchangerate\\Hook',
),
'plugins_common_page_bottom' =>
array (
@@ -95,6 +99,14 @@ return array (
array (
0 => 'app\\plugins\\wallet\\Hook',
),
+ 'plugins_service_quick_navigation_pc' =>
+ array (
+ 0 => 'app\\plugins\\exchangerate\\Hook',
+ ),
+ 'plugins_service_quick_navigation_h5' =>
+ array (
+ 0 => 'app\\plugins\\exchangerate\\Hook',
+ ),
'plugins_service_currency_price_symbol' =>
array (
0 => 'app\\plugins\\exchangerate\\Hook',
@@ -111,5 +123,13 @@ return array (
array (
0 => 'app\\plugins\\exchangerate\\Hook',
),
+ 'plugins_service_buy_group_goods_handle' =>
+ array (
+ 0 => 'app\\plugins\\freightfee\\Hook',
+ ),
+ 'plugins_view_goods_detail_title' =>
+ array (
+ 0 => 'app\\plugins\\freightfee\\Hook',
+ ),
);
?>
\ No newline at end of file
diff --git a/config/shopxo.php b/config/shopxo.php
index 65b84440c..26499c5d8 100755
--- a/config/shopxo.php
+++ b/config/shopxo.php
@@ -54,8 +54,14 @@ return [
// 轮播缓存信息
'cache_banner_list_key' => 'cache_banner_list_data_',
- // 导航缓存信息
- 'cache_navigation_key' => 'cache_navigation_data_',
+ // 手机首页导航缓存信息
+ 'cache_app_home_navigation_key' => 'cache_app_home_navigation_data_',
+
+ // 手机用户中心导航缓存信息
+ 'cache_app_user_center_navigation_key' => 'cache_app_user_center_navigation_data_',
+
+ // 快捷导航缓存信息
+ 'cache_quick_navigation_key' => 'cache_quick_navigation_data_',
// 附件host、最后不要带/斜杠结尾, 数据库图片地址以/static/...开头
'attachment_host' => defined('__MY_PUBLIC_URL__') ? substr(__MY_PUBLIC_URL__, 0, -1) : '',
diff --git a/extend/payment/QQ.php b/extend/payment/QQ.php
index eb6476bfa..fb67cd1c3 100644
--- a/extend/payment/QQ.php
+++ b/extend/payment/QQ.php
@@ -217,7 +217,7 @@ class QQ
// 手机模式下直接返回微信的支付url地址,打开支付(缺点是支付后会直接关闭站点)
// QQ支付本身没有提供H5支付方案,这种方式也可以直接支付(缺点是支付后不能回调到原来浏览器)
// 公众号后续再采用公众号的方式支付,体验会更好一些,只是可以不关闭站点
- if(APPLICATION_CLIENT_TYPE == 'h5' || IsMobile())
+ if(ApplicationClientType() == 'h5')
{
$result = DataReturn('success', 0, $data['code_url']);
} else {
@@ -312,6 +312,10 @@ class QQ
*/
private function GetTradeType()
{
+ // 平台
+ $client_type = ApplicationClientType();
+
+ // 平台类型定义
$type_all = [
'pc' => 'NATIVE',
'h5' => 'NATIVE',
@@ -321,7 +325,7 @@ class QQ
'android' => 'APP',
];
- return isset($type_all[APPLICATION_CLIENT_TYPE]) ? $type_all[APPLICATION_CLIENT_TYPE] : '';
+ return isset($type_all[$client_type]) ? $type_all[$client_type] : '';
}
/**
diff --git a/extend/payment/Weixin.php b/extend/payment/Weixin.php
index 5c2a74bd1..094c30e66 100755
--- a/extend/payment/Weixin.php
+++ b/extend/payment/Weixin.php
@@ -162,12 +162,9 @@ class Weixin
}
// 微信中打开
- if(in_array(APPLICATION_CLIENT_TYPE, ['pc', 'h5']))
+ if(ApplicationClientType() == 'h5' && IsWeixinEnv())
{
- if(!empty($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false && empty($params['user']['weixin_web_openid']))
- {
- exit(header('location:'.PluginsHomeUrl('weixinwebauthorization', 'pay', 'index', input())));
- }
+ exit(header('location:'.PluginsHomeUrl('weixinwebauthorization', 'pay', 'index', input())));
}
// 获取支付参数
@@ -246,7 +243,7 @@ class Weixin
$pay_data['paySign'] = $this->GetSign($pay_data);
// 微信中
- if(in_array(APPLICATION_CLIENT_TYPE, ['pc', 'h5']) && !empty($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false)
+ if(ApplicationClientType() == 'h5' && IsWeixinEnv())
{
$this->PayHtml($pay_data, $redirect_url);
} else {
@@ -383,6 +380,10 @@ class Weixin
*/
private function GetTradeType()
{
+ // 平台
+ $client_type = ApplicationClientType();
+
+ // 平台类型定义
$type_all = [
'pc' => 'NATIVE',
'weixin' => 'JSAPI',
@@ -393,22 +394,13 @@ class Weixin
'android' => 'APP',
];
- // 手机中打开pc版本
- if(APPLICATION_CLIENT_TYPE == 'pc' && IsMobile())
- {
- $type_all['pc'] = $type_all['h5'];
- }
-
// 微信中打开
- if(in_array(APPLICATION_CLIENT_TYPE, ['pc', 'h5']))
+ if($client_type == 'h5' && IsWeixinEnv())
{
- if(!empty($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false)
- {
- $type_all['pc'] = $type_all['weixin'];
- }
+ $type_all['pc'] = $type_all['weixin'];
}
- return isset($type_all[APPLICATION_CLIENT_TYPE]) ? $type_all[APPLICATION_CLIENT_TYPE] : '';
+ return isset($type_all[$client_type]) ? $type_all[$client_type] : '';
}
/**
diff --git a/public/static/admin/default/css/quicknav.css b/public/static/admin/default/css/quicknav.css
new file mode 100644
index 000000000..9807b9268
--- /dev/null
+++ b/public/static/admin/default/css/quicknav.css
@@ -0,0 +1,12 @@
+/**
+ * 列表
+ */
+.nav-icon-circle {
+ width: 50px;
+ height: 50px;
+ text-align: center;
+ line-height: 50px;
+}
+table.am-table .nav-icon-circle {
+ margin: 0 auto;
+}
\ No newline at end of file
diff --git a/public/static/common/lib/amazeui-dialog/amazeui.dialog.js b/public/static/common/lib/amazeui-dialog/amazeui.dialog.js
index 4129ef832..327f3237f 100755
--- a/public/static/common/lib/amazeui-dialog/amazeui.dialog.js
+++ b/public/static/common/lib/amazeui-dialog/amazeui.dialog.js
@@ -150,7 +150,7 @@ dialog.popup = function(options) {
} else {
html.push('