浏览代码

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

Karson 5 年之前
父节点
当前提交
9d5ccb91b4
共有 1 个文件被更改,包括 6 次插入2 次删除
  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 think\Model;
+use think\Loader;
 
 class AdminLog extends Model
 {
@@ -45,11 +46,14 @@ class AdminLog extends Model
         $title = self::$title;
         if (!$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) {
                 $title[] = $v['title'];
             }
-            $title = implode(' ', $title);
+            $title = implode(' / ', $title);
         }
         self::create([
             'title'     => $title,