diff --git a/application/admin/controller/Quicknav.php b/application/admin/controller/Quicknav.php new file mode 100755 index 000000000..c6b0e8c77 --- /dev/null +++ b/application/admin/controller/Quicknav.php @@ -0,0 +1,211 @@ +IsLogin(); + + // 权限校验 + $this->IsPower(); + } + + /** + * [Index 快捷导航列表] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-06T21:31:53+0800 + */ + public function Index() + { + // 总数 + $total = QuickNavService::QuickNavTotal($this->form_where); + + // 分页 + $page_params = [ + 'number' => $this->page_size, + 'total' => $total, + 'where' => $this->data_request, + 'page' => $this->page, + 'url' => MyUrl('admin/QuickNav/index'), + ]; + $page = new \base\Page($page_params); + + // 获取列表 + $data_params = [ + 'where' => $this->form_where, + 'm' => $page->GetPageStarNumber(), + 'n' => $this->page_size, + ]; + $ret = QuickNavService::QuickNavList($data_params); + + // 基础参数赋值 + $this->assign('params', $this->data_request); + $this->assign('page_html', $page->GetPageHtml()); + $this->assign('data_list', $ret['data']); + return $this->fetch(); + } + + /** + * 详情 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2019-08-05T08:21:54+0800 + */ + public function Detail() + { + if(!empty($this->data_request['id'])) + { + // 条件 + $where = [ + ['id', '=', intval($this->data_request['id'])], + ]; + + // 获取列表 + $data_params = [ + 'm' => 0, + 'n' => 1, + 'where' => $where, + ]; + $ret = QuickNavService::QuickNavList($data_params); + $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; + $this->assign('data', $data); + } + return $this->fetch(); + } + + /** + * [SaveInfo 添加/编辑页面] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-14T21:37:02+0800 + */ + public function SaveInfo() + { + // 参数 + $params = $this->data_request; + + // 数据 + $data = []; + if(!empty($params['id'])) + { + // 获取列表 + $data_params = array( + 'm' => 0, + 'n' => 1, + 'where' => ['id'=>intval($params['id'])], + 'field' => '*', + ); + $ret = QuickNavService::QuickNavList($data_params); + $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; + } + $this->assign('data', $data); + + // 静态数据 + $this->assign('common_platform_type', lang('common_platform_type')); + $this->assign('common_app_event_type', lang('common_app_event_type')); + + // 参数 + $this->assign('params', $params); + + // 编辑器文件存放地址 + $this->assign('editor_path_type', 'quick_nav'); + + return $this->fetch(); + } + + /** + * [Save 快捷导航添加/编辑] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-14T21:37:02+0800 + */ + public function Save() + { + // 是否ajax请求 + if(!IS_AJAX) + { + return $this->error('非法访问'); + } + + // 开始处理 + $params = $this->data_request; + return QuickNavService::QuickNavSave($params); + } + + /** + * [Delete 快捷导航删除] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-15T11:03:30+0800 + */ + public function Delete() + { + // 是否ajax请求 + if(!IS_AJAX) + { + return $this->error('非法访问'); + } + + // 开始处理 + $params = $this->data_request; + $params['user_type'] = 'admin'; + return QuickNavService::QuickNavDelete($params); + } + + /** + * [StatusUpdate 状态更新] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-01-12T22:23:06+0800 + */ + public function StatusUpdate() + { + // 是否ajax请求 + if(!IS_AJAX) + { + return $this->error('非法访问'); + } + + // 开始处理 + $params = $this->data_request; + return QuickNavService::QuickNavStatusUpdate($params); + } +} +?> \ No newline at end of file diff --git a/application/admin/form/Quicknav.php b/application/admin/form/Quicknav.php new file mode 100644 index 000000000..0d5d59310 --- /dev/null +++ b/application/admin/form/Quicknav.php @@ -0,0 +1,162 @@ + [ + 'key_field' => 'id', + 'status_field' => 'is_enable', + 'is_search' => 1, + 'search_url' => MyUrl('admin/quicknav/index'), + 'is_delete' => 1, + 'delete_url' => MyUrl('admin/quicknav/delete'), + 'delete_key' => 'ids', + ], + // 表单配置 + 'form' => [ + [ + 'view_type' => 'checkbox', + 'is_checked' => 0, + 'checked_text' => '反选', + 'not_checked_text' => '全选', + 'align' => 'center', + 'width' => 80, + ], + [ + 'label' => '名称', + 'view_type' => 'field', + 'view_key' => 'name', + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => 'like', + ], + ], + [ + 'label' => '所属平台', + 'view_type' => 'field', + 'view_key' => 'platform', + 'view_data_key' => 'name', + 'view_data' => lang('common_platform_type'), + 'search_config' => [ + 'form_type' => 'select', + 'where_type' => 'in', + 'data' => lang('common_platform_type'), + 'data_key' => 'value', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '导航图标', + 'view_type' => 'module', + 'view_key' => 'quicknav/module/images', + 'align' => 'center', + ], + [ + 'label' => '事件类型', + 'view_type' => 'field', + 'view_key' => 'event_type', + 'view_data_key' => 'name', + 'view_data' => lang('common_app_event_type'), + 'grid_size' => 'sm', + 'search_config' => [ + 'form_type' => 'select', + 'where_type' => 'in', + 'data' => lang('common_app_event_type'), + 'data_key' => 'value', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '事件值', + 'view_type' => 'field', + 'view_key' => 'event_value', + 'grid_size' => 'sm', + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => 'like', + ], + ], + [ + 'label' => '是否启用', + 'view_type' => 'status', + 'view_key' => 'is_enable', + 'post_url' => MyUrl('admin/quicknav/statusupdate'), + 'is_form_su' => 1, + 'align' => 'center', + 'search_config' => [ + 'form_type' => 'select', + 'where_type' => 'in', + 'data' => lang('common_is_enable_list'), + 'data_key' => 'id', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '排序', + 'view_type' => 'field', + 'view_key' => 'sort', + ], + [ + 'label' => '创建时间', + 'view_type' => 'field', + 'view_key' => 'add_time', + 'search_config' => [ + 'form_type' => 'datetime', + ], + ], + [ + 'label' => '更新时间', + 'view_type' => 'field', + 'view_key' => 'upd_time', + 'search_config' => [ + 'form_type' => 'datetime', + ], + ], + [ + 'label' => '操作', + 'view_type' => 'operate', + 'view_key' => 'quicknav/module/operate', + 'align' => 'center', + 'fixed' => 'right', + ], + ], + ]; + } +} +?> \ No newline at end of file diff --git a/application/admin/view/default/admin/save_info.html b/application/admin/view/default/admin/save_info.html index 7676f1e4f..766729d7f 100755 --- a/application/admin/view/default/admin/save_info.html +++ b/application/admin/view/default/admin/save_info.html @@ -64,7 +64,7 @@ {{/if}} -
+
diff --git a/application/admin/view/default/appcenternav/save_info.html b/application/admin/view/default/appcenternav/save_info.html index 3d9bf6fcd..fa08b6050 100755 --- a/application/admin/view/default/appcenternav/save_info.html +++ b/application/admin/view/default/appcenternav/save_info.html @@ -6,7 +6,7 @@
- 用户中心导航{{if empty($data['id'])}}添加{{else /}}编辑{{/if}} + 手机用户中心导航{{if empty($data['id'])}}添加{{else /}}编辑{{/if}} 返回
@@ -36,14 +36,14 @@
+ +

WEB页面
   1.以http开头
   2.并在小程序后台加入白名单

内部页面(小程序/APP内部地址)
   1.小程序或APP内部地址
   2.小程序以/pages开始
   3.例如:/pages/user/user
   4.支持带参数 ?x=xx

跳转原生地图查看指定位置
   1.以 | 竖线分割,分别顺序 名称|地址|经度|纬度
   2.例如:ShopXO|上海浦东新区张江高科技园区XXX号|121.626444|31.20843

- -
@@ -70,7 +70,7 @@
-
+
diff --git a/application/admin/view/default/apphomenav/save_info.html b/application/admin/view/default/apphomenav/save_info.html index a6f2c9059..a33743d5d 100755 --- a/application/admin/view/default/apphomenav/save_info.html +++ b/application/admin/view/default/apphomenav/save_info.html @@ -6,7 +6,7 @@ - 导航{{if empty($data['id'])}}添加{{else /}}编辑{{/if}} + 手机首页导航{{if empty($data['id'])}}添加{{else /}}编辑{{/if}} 返回
@@ -36,14 +36,14 @@
+ +

WEB页面
   1.以http开头
   2.并在小程序后台加入白名单

内部页面(小程序/APP内部地址)
   1.小程序或APP内部地址
   2.小程序以/pages开始
   3.例如:/pages/user/user
   4.支持带参数 ?x=xx

跳转原生地图查看指定位置
   1.以 | 竖线分割,分别顺序 名称|地址|经度|纬度
   2.例如:ShopXO|上海浦东新区张江高科技园区XXX号|121.626444|31.20843

- -
@@ -76,7 +76,7 @@
-
+
diff --git a/application/admin/view/default/article/save_info.html b/application/admin/view/default/article/save_info.html index 2980454fd..07b8eb339 100755 --- a/application/admin/view/default/article/save_info.html +++ b/application/admin/view/default/article/save_info.html @@ -71,7 +71,7 @@ {{include file="lib/seo" /}}
-
+
diff --git a/application/admin/view/default/brand/save_info.html b/application/admin/view/default/brand/save_info.html index eb089c3ca..8ce3c60b4 100755 --- a/application/admin/view/default/brand/save_info.html +++ b/application/admin/view/default/brand/save_info.html @@ -73,7 +73,7 @@ {{include file="lib/seo" /}}
-
+
diff --git a/application/admin/view/default/customview/save_info.html b/application/admin/view/default/customview/save_info.html index 74d6fdcd4..d07b921d8 100755 --- a/application/admin/view/default/customview/save_info.html +++ b/application/admin/view/default/customview/save_info.html @@ -37,7 +37,7 @@
-
+
diff --git a/application/admin/view/default/goods/save_info.html b/application/admin/view/default/goods/save_info.html index 8dea288f0..18415dd96 100755 --- a/application/admin/view/default/goods/save_info.html +++ b/application/admin/view/default/goods/save_info.html @@ -631,7 +631,7 @@ {{include file="lib/seo" /}}
-
+
diff --git a/application/admin/view/default/payment/save_info.html b/application/admin/view/default/payment/save_info.html index 06a6bb070..091949399 100755 --- a/application/admin/view/default/payment/save_info.html +++ b/application/admin/view/default/payment/save_info.html @@ -159,7 +159,7 @@
-
+
diff --git a/application/admin/view/default/quicknav/detail.html b/application/admin/view/default/quicknav/detail.html new file mode 100644 index 000000000..06eeee457 --- /dev/null +++ b/application/admin/view/default/quicknav/detail.html @@ -0,0 +1,2 @@ + +{{extend name="public/module/detail" /}} \ No newline at end of file diff --git a/application/admin/view/default/quicknav/index.html b/application/admin/view/default/quicknav/index.html new file mode 100755 index 000000000..0924e9864 --- /dev/null +++ b/application/admin/view/default/quicknav/index.html @@ -0,0 +1,9 @@ + +{{extend name="public/module/form" /}} + + +{{block name="form_operate_top"}} + 新增 + + {__block__} +{{/block}} \ No newline at end of file diff --git a/application/admin/view/default/quicknav/module/images.html b/application/admin/view/default/quicknav/module/images.html new file mode 100644 index 000000000..b75b0300d --- /dev/null +++ b/application/admin/view/default/quicknav/module/images.html @@ -0,0 +1,8 @@ + +{{if !empty($module_data) and !empty($module_data['images_url'])}} + +{{/if}} \ No newline at end of file diff --git a/application/admin/view/default/quicknav/module/operate.html b/application/admin/view/default/quicknav/module/operate.html new file mode 100644 index 000000000..089811889 --- /dev/null +++ b/application/admin/view/default/quicknav/module/operate.html @@ -0,0 +1,13 @@ + + + + + 编辑 + + \ No newline at end of file diff --git a/application/admin/view/default/quicknav/save_info.html b/application/admin/view/default/quicknav/save_info.html new file mode 100755 index 000000000..fa7f5c33f --- /dev/null +++ b/application/admin/view/default/quicknav/save_info.html @@ -0,0 +1,86 @@ +{{include file="public/header" /}} + + +
+
+ + + + 快捷导航{{if empty($data['id'])}}添加{{else /}}编辑{{/if}} + 返回 + +
+ + +
+ +
+ + +
+ +
+ + +
+
+ + +
+ +

+ WEB页面
   1.以http开头
   2.并在小程序后台加入白名单

内部页面(小程序/APP内部地址)
   1.小程序或APP内部地址
   2.小程序以/pages开始
   3.例如:/pages/user/user
   4.支持带参数 ?x=xx +

+
+
+ +
+ +
    +
  • + + +
  • +
+
+上传图片
+
+
+ + + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+
+ + + +{{include file="public/footer" /}} + \ No newline at end of file diff --git a/application/admin/view/default/role/save_info.html b/application/admin/view/default/role/save_info.html index 19b8aa407..887a60f1c 100755 --- a/application/admin/view/default/role/save_info.html +++ b/application/admin/view/default/role/save_info.html @@ -70,7 +70,7 @@ {{/if}} -
+
diff --git a/application/admin/view/default/site/base.html b/application/admin/view/default/site/base.html index 08bac2a13..b27767689 100755 --- a/application/admin/view/default/site/base.html +++ b/application/admin/view/default/site/base.html @@ -91,7 +91,7 @@
-
+
diff --git a/application/admin/view/default/slide/save_info.html b/application/admin/view/default/slide/save_info.html index 2dce6cbe2..e68e214ac 100755 --- a/application/admin/view/default/slide/save_info.html +++ b/application/admin/view/default/slide/save_info.html @@ -69,7 +69,7 @@
-
+
diff --git a/application/admin/view/default/user/save_info.html b/application/admin/view/default/user/save_info.html index 952532ba3..fc65f87d9 100755 --- a/application/admin/view/default/user/save_info.html +++ b/application/admin/view/default/user/save_info.html @@ -106,7 +106,7 @@ {{/if}} -
+
diff --git a/application/common.php b/application/common.php index 93e4f6ce5..8ed5218de 100755 --- a/application/common.php +++ b/application/common.php @@ -11,6 +11,27 @@ // 应用公共文件 +/** + * 当前应用平台 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-09-11 + * @desc description + */ +function ApplicationClientType() +{ + // 平台 + $platform = APPLICATION_CLIENT_TYPE; + + // web端手机访问 + if($platform == 'pc' && IsMobile()) + { + $platform = 'h5'; + } + return $platform; +} + /** * 是否微信环境 * @author Devil diff --git a/application/index/controller/Common.php b/application/index/controller/Common.php index 0f2ec7c10..29af87129 100755 --- a/application/index/controller/Common.php +++ b/application/index/controller/Common.php @@ -14,6 +14,7 @@ use think\facade\Hook; use think\Controller; use app\module\FormHandleModule; use app\service\SystemService; +use app\service\ResourcesService; use app\service\GoodsService; use app\service\NavigationService; use app\service\BuyService; @@ -22,7 +23,7 @@ use app\service\SearchService; use app\service\ConfigService; use app\service\LinkService; use app\service\UserService; -use app\service\ResourcesService; +use app\service\QuickNavService; /** * 前端公共控制器 @@ -34,11 +35,10 @@ use app\service\ResourcesService; */ class Common extends Controller { - // 顶部导航 + // 顶部导航、底部导航、快捷导航 protected $nav_header; - - // 底部导航 protected $nav_footer; + protected $nav_quick; // 用户信息 protected $user; @@ -324,6 +324,7 @@ class Common extends Controller // 导航 $this->assign('nav_header', $this->nav_header); $this->assign('nav_footer', $this->nav_footer); + $this->assign('nav_quick', $this->nav_quick); // 导航/底部默认显示 $this->assign('is_header', 1); @@ -443,9 +444,13 @@ class Common extends Controller */ private function NavInit() { - $navigation = NavigationService::Nav(); - $this->nav_header = $navigation['header']; - $this->nav_footer = $navigation['footer']; + // 主导航和底部导航 + $nav = NavigationService::Nav(); + $this->nav_header = $nav['header']; + $this->nav_footer = $nav['footer']; + + // 快捷导航 + $this->nav_quick = QuickNavService::QuickNav(); } /** diff --git a/application/index/view/default/buy/index.html b/application/index/view/default/buy/index.html index fa2f6a2fc..8c6f43a77 100755 --- a/application/index/view/default/buy/index.html +++ b/application/index/view/default/buy/index.html @@ -196,7 +196,7 @@
diff --git a/application/index/view/default/public/footer_nav.html b/application/index/view/default/public/footer_nav.html index 489c7e896..3803aff16 100755 --- a/application/index/view/default/public/footer_nav.html +++ b/application/index/view/default/public/footer_nav.html @@ -118,4 +118,30 @@

+{{/if}} + + +{{if !empty($nav_quick) and is_array($nav_quick)}} + + {{/if}} \ No newline at end of file diff --git a/application/index/view/default/user/forget_pwd_info.html b/application/index/view/default/user/forget_pwd_info.html index 427fd1939..83bc4823a 100755 --- a/application/index/view/default/user/forget_pwd_info.html +++ b/application/index/view/default/user/forget_pwd_info.html @@ -30,13 +30,13 @@
-
+
-
+
@@ -46,7 +46,7 @@
-
+
@@ -56,7 +56,7 @@
-
+
@@ -67,7 +67,7 @@
- × + ×
diff --git a/application/index/view/default/user/login_info.html b/application/index/view/default/user/login_info.html index 5501be5a5..98d28c7ab 100755 --- a/application/index/view/default/user/login_info.html +++ b/application/index/view/default/user/login_info.html @@ -45,19 +45,19 @@
-
+
-
+
{{if MyC('home_user_login_img_verify_state') eq 1}} -
+
@@ -71,7 +71,7 @@
{{/if}} -
+ diff --git a/application/index/view/default/user/modal_login_info.html b/application/index/view/default/user/modal_login_info.html index 25596f288..424239c45 100755 --- a/application/index/view/default/user/modal_login_info.html +++ b/application/index/view/default/user/modal_login_info.html @@ -30,13 +30,13 @@
-
+
{{if MyC('home_user_login_img_verify_state') eq 1}} -
+
@@ -50,7 +50,7 @@
{{/if}} -
+ diff --git a/application/index/view/default/user/reg_info.html b/application/index/view/default/user/reg_info.html index 1e9227116..a45c62590 100755 --- a/application/index/view/default/user/reg_info.html +++ b/application/index/view/default/user/reg_info.html @@ -66,7 +66,7 @@
  • 邮箱注册
  • {{/if}} -
    +
    {{if in_array('username', MyC('home_user_reg_state'))}}
    @@ -76,7 +76,7 @@
    -
    +
    @@ -87,7 +87,7 @@
    {{if MyC('home_user_register_img_verify_state') eq 1}} -
    +
    @@ -127,7 +127,7 @@
    -
    +
    @@ -137,7 +137,7 @@
    -
    +
    @@ -173,7 +173,7 @@
    -
    +
    @@ -183,7 +183,7 @@
    -
    +
    @@ -218,7 +218,7 @@
    - × + ×
    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('