diff --git a/application/admin/controller/Common.php b/application/admin/controller/Common.php index 06217020089a2bdfe24197b31b32b616d69f615a..1bcf568b367a3326714ea030f656036b4e85b362 100755 --- a/application/admin/controller/Common.php +++ b/application/admin/controller/Common.php @@ -29,9 +29,6 @@ class Common extends Controller // 管理员 protected $admin; - // 权限 - protected $power; - // 左边权限菜单 protected $left_menu; @@ -80,10 +77,7 @@ class Common extends Controller // 权限菜单 AdminPowerService::PowerMenuInit(); - - // 权限 - $this->left_menu = isset($this->admin['id']) ? cache(config('cache_admin_left_menu_key').$this->admin['id']) : []; - $this->power = isset($this->admin['id']) ? cache(config('cache_admin_power_key').$this->admin['id']) : []; + $this->left_menu = AdminPowerService::MenuData(); // 视图初始化 $this->ViewInit(); diff --git a/application/admin/controller/Power.php b/application/admin/controller/Power.php index fa047b0f12513b9b2ff34ab19c70f818ffaa2eaf..20bd5a43ac1686db8dc98d7f3be1f5af432d307e 100755 --- a/application/admin/controller/Power.php +++ b/application/admin/controller/Power.php @@ -50,7 +50,7 @@ class Power extends Common public function Index() { $data_params = [ - 'field' => 'id,pid,name,control,action,sort,is_show,icon', + 'field' => 'id,pid,name,control,action,url,sort,is_show,icon', 'order_by' => 'sort asc', 'where' => ['pid'=>0], ]; diff --git a/application/admin/form/Payrequestlog.php b/application/admin/form/Payrequestlog.php index d03095d9754c10d4dd0c6455ef02deba5a79fa91..6fd496d4a72869604028ebccc64abaead9581094 100644 --- a/application/admin/form/Payrequestlog.php +++ b/application/admin/form/Payrequestlog.php @@ -101,6 +101,7 @@ class PayRequestLog 'label' => '请求url地址', 'view_type' => 'field', 'view_key' => 'request_url', + 'grid_size' => 'sm', 'search_config' => [ 'form_type' => 'input', 'form_name' => 'business_handle', diff --git a/application/admin/view/default/index/init.html b/application/admin/view/default/index/init.html index d0658b69180fbcfb1343d158954473a0ae36159e..fbc6959f9c67559794c63c7bcb805f3efa105f26 100755 --- a/application/admin/view/default/index/init.html +++ b/application/admin/view/default/index/init.html @@ -14,11 +14,19 @@

用户总量

0

-
+
+ 上月 + 0 +
+
+ 当月 + 0 +
+
昨日 0
-
+
今日 0
@@ -29,11 +37,19 @@

订单总量

0

-
+
+ 上月 + 0 +
+
+ 当月 + 0 +
+
昨日 0
-
+
今日 0
@@ -44,11 +60,19 @@

成交总量

0

-
+
+ 上月 + 0 +
+
+ 当月 + 0 +
+
昨日 0
-
+
今日 0
@@ -59,11 +83,19 @@

收入总计

0.00

-
+
+ 上月 + 0 +
+
+ 当月 + 0 +
+
昨日 0.00
-
+
今日 0.00
diff --git a/application/admin/view/default/power/index.html b/application/admin/view/default/power/index.html index 358f77c56fd44100d5c7ada727d345f948c93db0..d4f8fee92bcec8db81deea6f37dc96102eb6ca31 100755 --- a/application/admin/view/default/power/index.html +++ b/application/admin/view/default/power/index.html @@ -27,7 +27,13 @@
-
+ +
+ +

1. 填写[ 控制器名称 和 方法名称 ]需要对应创建相应的控制器和方法的定义

+

2. 控制器文件位置[ application/admin/controller ]、该操作仅开发人员使用

+

3. 控制器名称/方法名称 与 自定义url地址、两者必须填写一个

+
+
- +
- + + +
+
+ +
+ +

1. 参考 http://www.iconfont.cn/ 将icon放到 [ /static/admin/default/css/iconfontmenu.css ] 文件中

+

2. 也可以直接使用框架自带的icon、参考 [ http://amazeui.shopxo.net/css/icon/ ]

+

3. 也可以自己使用插件钩子引入自定义的icon图标的css文件,然后使用定义好的icon

+
diff --git a/application/admin/view/default/public/menu.html b/application/admin/view/default/public/menu.html index ed41142957682ffaddfc5d73fb134bf1d3a500bb..e90e487e8949365ece21b40312d613156580b45c 100755 --- a/application/admin/view/default/public/menu.html +++ b/application/admin/view/default/public/menu.html @@ -10,7 +10,7 @@ {{foreach $left_menu as $v}} {{if empty($v['items'])}}
  • - + {{if !empty($v['icon'])}}{{/if}} {{$v.name}} @@ -25,7 +25,7 @@
      {{foreach $v.items as $vs}}
    • - + {{if !empty($vs['icon'])}}{{/if}} {{$vs.name}} diff --git a/application/common.php b/application/common.php index 3da3502dc06eb1ca7b17619a5c39126091f0a9af..b87057b2e7e2dfe22dcd2e97c733d6c9bcc35d3b 100755 --- a/application/common.php +++ b/application/common.php @@ -162,7 +162,7 @@ function AdminIsPower($controller = null, $action = null, $unwanted_power = []) // 权限 // 角色组权限列表校验 - $power = isset($admin['id']) ? cache(config('cache_admin_power_key').$admin['id']) : []; + $power = \app\service\AdminPowerService::PowerData(); if(!empty($power) && is_array($power) && in_array($controller.'_'.$action, $power)) { return true; diff --git a/application/service/AdminPowerService.php b/application/service/AdminPowerService.php index 31653d9b40e762d3342432ee992c6ed92fd8e089..d1c00367cc3ded68af41b9ec608f10737cbb3f15 100755 --- a/application/service/AdminPowerService.php +++ b/application/service/AdminPowerService.php @@ -11,6 +11,7 @@ namespace app\service; use think\Db; +use think\facade\Hook; /** * 权限菜单服务层 @@ -70,28 +71,6 @@ class AdminPowerService 'checked_data' => '2,16', 'error_msg' => '权限名称格式 2~16 个字符之间', ], - [ - 'checked_type' => 'empty', - 'key_name' => 'control', - 'error_msg' => '控制器名称不能为空', - ], - [ - 'checked_type' => 'length', - 'key_name' => 'control', - 'checked_data' => '1,30', - 'error_msg' => '控制器名称格式 1~30 个字符之间', - ], - [ - 'checked_type' => 'empty', - 'key_name' => 'action', - 'error_msg' => '方法名称不能为空', - ], - [ - 'checked_type' => 'length', - 'key_name' => 'action', - 'checked_data' => '1,30', - 'error_msg' => '方法名称格式 1~30 个字符之间', - ], [ 'checked_type' => 'length', 'key_name' => 'icon', @@ -106,6 +85,29 @@ class AdminPowerService 'error_msg' => '是否显示范围值有误', ], ]; + // 是否自定义url地址 + if(empty($params['url'])) + { + $p[] = [ + 'checked_type' => 'length', + 'key_name' => 'control', + 'checked_data' => '1,30', + 'error_msg' => '控制器名称格式 1~30 个字符之间', + ]; + $p[] = [ + 'checked_type' => 'length', + 'key_name' => 'action', + 'checked_data' => '1,30', + 'error_msg' => '方法名称格式 1~30 个字符之间', + ]; + } else { + $p[] = [ + 'checked_type' => 'length', + 'key_name' => 'url', + 'checked_data' => '1,255', + 'error_msg' => '自定义url地址格式 1~255 个字符之间', + ]; + } $ret = ParamsChecked($params, $p); if($ret !== true) { @@ -120,6 +122,7 @@ class AdminPowerService 'name' => $params['name'], 'control' => $params['control'], 'action' => $params['action'], + 'url' => $params['url'], 'is_show' => isset($params['is_show']) ? intval($params['is_show']) : 0, ]; if(empty($params['id'])) @@ -211,45 +214,65 @@ class AdminPowerService $admin_power = cache(config('cache_admin_power_key').$admin_id); // 缓存没数据则从数据库重新读取 - if(($role_id > 0 || $admin_id == 1) && empty($admin_left_menu)) + if((($role_id > 0 || $admin_id == 1) && empty($admin_left_menu)) || config('app_debug')) { // 获取一级数据 if($admin_id == 1 || $role_id == 1) { - $field = 'id,name,control,action,is_show,icon'; + $field = 'id,name,control,action,url,is_show,icon'; $admin_left_menu = Db::name('Power')->where(array('pid' => 0))->field($field)->order('sort')->select(); } else { - $field = 'p.id,p.name,p.control,p.action,p.is_show,p.icon'; + $field = 'p.id,p.name,p.control,p.action,p.url,p.is_show,p.icon'; $admin_left_menu = Db::name('Power')->alias('p')->join(['__ROLE_POWER__'=>'rp'], 'p.id=rp.power_id')->where(array('rp.role_id' => $role_id, 'p.pid' => 0))->field($field)->order('p.sort')->select(); } - + // 有数据,则处理子级数据 if(!empty($admin_left_menu)) { foreach($admin_left_menu as $k=>$v) { - // 权限 - $admin_power[$v['id']] = strtolower($v['control'].'_'.$v['action']); + // 是否存在控制器和方法 + if(!empty($v['control']) && !empty($v['action'])) + { + // 权限 + $admin_power[$v['id']] = strtolower($v['control'].'_'.$v['action']); + + // url、存在自定义url则不覆盖 + if(empty($v['url'])) + { + $admin_left_menu[$k]['url'] = MyUrl('admin/'.strtolower($v['control']).'/'.strtolower($v['action'])); + } + } // 获取子权限 - if($admin_id == 1 || $role_id == 1) + if(($admin_id == 1 || $role_id == 1) && !empty($v['id'])) { - $items = Db::name('Power')->where(array('pid' => $v['id']))->field($field)->order('sort')->select(); + $items = Db::name('Power')->where(['pid'=>intval($v['id'])])->field($field)->order('sort')->select(); } else { - $items = Db::name('Power')->alias('p')->join(['__ROLE_POWER__'=>'rp'], 'p.id=rp.power_id')->where(array('rp.role_id' => $role_id, 'p.pid' => $v['id']))->field($field)->order('p.sort')->select(); + $items = Db::name('Power')->alias('p')->join(['__ROLE_POWER__'=>'rp'], 'p.id=rp.power_id')->where(['rp.role_id'=>$role_id, 'p.pid'=>intval($v['id'])])->field($field)->order('p.sort')->select(); } // 权限列表 - $is_show_parent = $v['is_show']; + $is_show_parent = isset($v['is_show']) ? $v['is_show'] : 0; if(!empty($items)) { foreach($items as $ks=>$vs) { - // 权限 - $admin_power[$vs['id']] = strtolower($vs['control'].'_'.$vs['action']); + // 是否存在控制器和方法 + if(!empty($vs['control']) && !empty($vs['action'])) + { + // 权限 + $admin_power[$vs['id']] = strtolower($vs['control'].'_'.$vs['action']); + + // url、存在自定义url则不覆盖 + if(empty($vs['url'])) + { + $items[$ks]['url'] = MyUrl('admin/'.strtolower($vs['control']).'/'.strtolower($vs['action'])); + } + } // 是否显示视图 - if($vs['is_show'] == 0) + if(isset($vs['is_show']) && $vs['is_show'] == 0) { unset($items[$ks]); } @@ -275,6 +298,63 @@ class AdminPowerService cache(config('cache_admin_left_menu_key').$admin_id, $admin_left_menu); cache(config('cache_admin_power_key').$admin_id, $admin_power); } + return true; + } + + /** + * 获取菜单数据 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-09-24 + * @desc description + */ + public static function MenuData() + { + $admin = session('admin'); + if(!empty($admin['id'])) + { + $data = cache(config('cache_admin_left_menu_key').$admin['id']); + } + + // 后台左侧菜单钩子 + $hook_name = 'plugins_service_admin_menu_data'; + Hook::listen($hook_name, [ + 'hook_name' => $hook_name, + 'is_backend' => true, + 'admin' => $admin, + 'data' => &$data, + ]); + + return empty($data) ? [] : $data; + } + + /** + * 获取权限数据 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-09-24 + * @desc description + */ + public static function PowerData() + { + $admin = session('admin'); + if(!empty($admin['id'])) + { + $data = cache(config('cache_admin_power_key').$admin['id']); + } + + // 后台左侧菜单权限钩子 + $hook_name = 'plugins_service_admin_menu_power_data'; + Hook::listen($hook_name, [ + 'hook_name' => $hook_name, + 'is_backend' => true, + 'admin' => $admin, + 'data' => &$data, + ]); + + return empty($data) ? [] : $data; } } ?> \ No newline at end of file diff --git a/application/service/StatisticalService.php b/application/service/StatisticalService.php index 549c25e11d378d9dc37d4dc730bc4d0785aac103..5eaa60d678527063a7da353ae4b8973082eccc6e 100755 --- a/application/service/StatisticalService.php +++ b/application/service/StatisticalService.php @@ -27,23 +27,31 @@ class StatisticalService private static $nearly_fifteen_days; private static $nearly_thirty_days; - // 近30天日期 + // 近30天 private static $thirty_time_start; private static $thirty_time_end; - // 近15天日期 + // 近15天 private static $fifteen_time_start; private static $fifteen_time_end; - // 近7天日期 + // 近7天 private static $seven_time_start; private static $seven_time_end; - // 昨天日期 + // 上月 + private static $last_month_time_start; + private static $last_month_time_end; + + // 当月 + private static $same_month_time_start; + private static $same_month_time_end; + + // 昨天 private static $yesterday_time_start; private static $yesterday_time_end; - // 今天日期 + // 今天 private static $today_time_start; private static $today_time_end; @@ -76,6 +84,14 @@ class StatisticalService self::$seven_time_start = strtotime(date('Y-m-d 00:00:00', strtotime('-7 day'))); self::$seven_time_end = time(); + // 上月 + self::$last_month_time_start = strtotime(date('Y-m-01 00:00:00', strtotime('-1 month'))); + self::$last_month_time_end = strtotime(date('Y-m-t 23:59:59', strtotime('-1 month'))); + + // 当月 + self::$same_month_time_start = strtotime(date('Y-m-01 00:00:00')); + self::$same_month_time_end = time(); + // 昨天日期 self::$yesterday_time_start = strtotime(date('Y-m-d 00:00:00', strtotime('-1 day'))); self::$yesterday_time_end = strtotime(date('Y-m-d 23:59:59', strtotime('-1 day'))); @@ -109,7 +125,7 @@ class StatisticalService } /** - * 用户总数,今日,昨日,总数 + * 用户总数,今日,昨日,当月,上月总数 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -124,6 +140,22 @@ class StatisticalService // 总数 $total_count = Db::name('User')->count(); + // 上月 + $where = [ + ['status', '<=', 4], + ['add_time', '>=', self::$last_month_time_start], + ['add_time', '<=', self::$last_month_time_end], + ]; + $last_month_count = Db::name('User')->where($where)->count(); + + // 当月 + $where = [ + ['status', '<=', 4], + ['add_time', '>=', self::$same_month_time_start], + ['add_time', '<=', self::$same_month_time_end], + ]; + $same_month_count = Db::name('User')->where($where)->count(); + // 昨天 $where = [ ['add_time', '>=', self::$yesterday_time_start], @@ -141,6 +173,8 @@ class StatisticalService // 数据组装 $result = [ 'total_count' => $total_count, + 'last_month_count' => $last_month_count, + 'same_month_count' => $same_month_count, 'yesterday_count' => $yesterday_count, 'today_count' => $today_count, ]; @@ -148,7 +182,7 @@ class StatisticalService } /** - * 订单总数,今日,昨日,总数 + * 订单总数,今日,昨日,当月,上月总数 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -162,13 +196,29 @@ class StatisticalService // 订单状态 // (0待确认, 1已确认/待支付, 2已支付/待发货, 3已发货/待收货, 4已完成, 5已取消, 6已关闭) - + // 总数 $where = [ ['status', '<=', 4], ]; $total_count = Db::name('Order')->where($where)->count(); + // 上月 + $where = [ + ['status', '<=', 4], + ['add_time', '>=', self::$last_month_time_start], + ['add_time', '<=', self::$last_month_time_end], + ]; + $last_month_count = Db::name('Order')->where($where)->count(); + + // 当月 + $where = [ + ['status', '<=', 4], + ['add_time', '>=', self::$same_month_time_start], + ['add_time', '<=', self::$same_month_time_end], + ]; + $same_month_count = Db::name('Order')->where($where)->count(); + // 昨天 $where = [ ['status', '<=', 4], @@ -188,6 +238,8 @@ class StatisticalService // 数据组装 $result = [ 'total_count' => $total_count, + 'last_month_count' => $last_month_count, + 'same_month_count' => $same_month_count, 'yesterday_count' => $yesterday_count, 'today_count' => $today_count, ]; @@ -195,7 +247,7 @@ class StatisticalService } /** - * 订单成交总量,今日,昨日,总数 + * 订单成交总量,今日,昨日,当月,上月总数 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -216,6 +268,22 @@ class StatisticalService ]; $total_count = Db::name('Order')->where($where)->count(); + // 上月 + $where = [ + ['status', '=', 4], + ['add_time', '>=', self::$last_month_time_start], + ['add_time', '<=', self::$last_month_time_end], + ]; + $last_month_count = Db::name('Order')->where($where)->count(); + + // 当月 + $where = [ + ['status', '=', 4], + ['add_time', '>=', self::$same_month_time_start], + ['add_time', '<=', self::$same_month_time_end], + ]; + $same_month_count = Db::name('Order')->where($where)->count(); + // 昨天 $where = [ ['status', '=', 4], @@ -235,6 +303,8 @@ class StatisticalService // 数据组装 $result = [ 'total_count' => $total_count, + 'last_month_count' => $last_month_count, + 'same_month_count' => $same_month_count, 'yesterday_count' => $yesterday_count, 'today_count' => $today_count, ]; @@ -242,7 +312,7 @@ class StatisticalService } /** - * 订单收入总计,今日,昨日,总数 + * 订单收入总计,今日,昨日,当月,上月总数 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -263,6 +333,22 @@ class StatisticalService ]; $total_count = Db::name('Order')->where($where)->sum('total_price'); + // 上月 + $where = [ + ['status', 'in', [2,3,4]], + ['add_time', '>=', self::$last_month_time_start], + ['add_time', '<=', self::$last_month_time_end], + ]; + $last_month_count = Db::name('Order')->where($where)->sum('total_price'); + + // 当月 + $where = [ + ['status', 'in', [2,3,4]], + ['add_time', '>=', self::$same_month_time_start], + ['add_time', '<=', self::$same_month_time_end], + ]; + $same_month_count = Db::name('Order')->where($where)->sum('total_price'); + // 昨天 $where = [ ['status', 'in', [2,3,4]], @@ -282,6 +368,8 @@ class StatisticalService // 数据组装 $result = [ 'total_count' => PriceNumberFormat($total_count), + 'last_month_count' => PriceNumberFormat($last_month_count), + 'same_month_count' => PriceNumberFormat($same_month_count), 'yesterday_count' => PriceNumberFormat($yesterday_count), 'today_count' => PriceNumberFormat($today_count), ]; diff --git a/changelog.txt b/changelog.txt index aaf53518321ce0268d576491c34b970abe3a1962..96c75a2b190db47a66b1f0b994def2a72015fb86 100755 --- a/changelog.txt +++ b/changelog.txt @@ -9,13 +9,15 @@ 5. 网站首页可后台控制配置 web端 - 1. + 1. 后台菜单支持自定义url地址、并支持钩子自动添加 + 2. 统计维度新增当月、上月 小程序 1. QQ小程序支持微信支付 插件 1. 汇率插件支持货币自由切换 + 2. 新增IEPay新西兰货币支付(支付宝+微信) +=========================================================+ diff --git a/public/static/admin/default/css/index.init.css b/public/static/admin/default/css/index.init.css index 0ff7cc20141bfd6f98eccd510321f020379967d4..d073d55f1b291565081031e481d5773576ca6ff8 100755 --- a/public/static/admin/default/css/index.init.css +++ b/public/static/admin/default/css/index.init.css @@ -98,19 +98,16 @@ html, body { font-size: 26px; font-weight: 700; } -.shopxo-base li .li-content p, .shopxo-base li .li-content .yesterday, .shopxo-base li .li-content .today { +.shopxo-base li .li-content p, .shopxo-base li .li-content .item { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; max-width: 100%; } -.shopxo-base li .li-content .yesterday, .shopxo-base li .li-content .today { +.shopxo-base li .li-content .item { color: #f0f0f0; font-size: 12px; } -.shopxo-base li .li-content .yesterday { - padding-bottom: 5px; -} .shopxo-base li .li-content .bg-icon { font-size: 36px; position: absolute; diff --git a/sourcecode/baidu/pages/login/login.css b/sourcecode/baidu/pages/login/login.css index 119ea61328ccf452a3d32fda42b077ba6ea2df09..03392408831b15659fac8c581d0aa61a0b6583e5 100755 --- a/sourcecode/baidu/pages/login/login.css +++ b/sourcecode/baidu/pages/login/login.css @@ -67,7 +67,7 @@ page{ */ .confirm-container .login-logo { width: 200rpx; - height: 200rpx; + height: 200rpx !important; margin: 0 auto; border-radius: 50%; } diff --git a/sourcecode/weixin/pages/login/login.wxss b/sourcecode/weixin/pages/login/login.wxss index d3359998fc5d5c0f2091822d05e4e200e87ccf20..343e0e1605a9a691c8c19a356e03db5bccd0daa4 100755 --- a/sourcecode/weixin/pages/login/login.wxss +++ b/sourcecode/weixin/pages/login/login.wxss @@ -67,7 +67,7 @@ page{ */ .confirm-container .login-logo { width: 200rpx; - height: 200rpx; + height: 200rpx !important; margin: 0 auto; border-radius: 50%; }