Browse Source

!240 修复管理员日志中的标题获取
Merge pull request !240 from DonsonLau/master

Karson 5 years ago
parent
commit
9d5ccb91b4
1 changed files with 6 additions and 2 deletions
  1. 6 2
      application/admin/model/AdminLog.php

+ 6 - 2
application/admin/model/AdminLog.php

@@ -4,6 +4,7 @@ namespace app\admin\model;
 
 
 use app\admin\library\Auth;
 use app\admin\library\Auth;
 use think\Model;
 use think\Model;
+use think\Loader;
 
 
 class AdminLog extends Model
 class AdminLog extends Model
 {
 {
@@ -45,11 +46,14 @@ class AdminLog extends Model
         $title = self::$title;
         $title = self::$title;
         if (!$title) {
         if (!$title) {
             $title = [];
             $title = [];
-            $breadcrumb = Auth::instance()->getBreadcrumb();
+            $controllername = Loader::parseName(request()->controller());
+            $actionname = strtolower(request()->action());
+            $path = str_replace('.', '/', $controllername) . '/' . $actionname;
+            $breadcrumb = Auth::instance()->getBreadcrumb($path);
             foreach ($breadcrumb as $k => $v) {
             foreach ($breadcrumb as $k => $v) {
                 $title[] = $v['title'];
                 $title[] = $v['title'];
             }
             }
-            $title = implode(' ', $title);
+            $title = implode(' / ', $title);
         }
         }
         self::create([
         self::create([
             'title'     => $title,
             'title'     => $title,