作者 Karson
提交者 Gitee

!240 修复管理员日志中的标题获取

Merge pull request !240 from DonsonLau/master
@@ -4,6 +4,7 @@ namespace app\admin\model; @@ -4,6 +4,7 @@ namespace app\admin\model;
4 4
5 use app\admin\library\Auth; 5 use app\admin\library\Auth;
6 use think\Model; 6 use think\Model;
  7 +use think\Loader;
7 8
8 class AdminLog extends Model 9 class AdminLog extends Model
9 { 10 {
@@ -45,11 +46,14 @@ class AdminLog extends Model @@ -45,11 +46,14 @@ class AdminLog extends Model
45 $title = self::$title; 46 $title = self::$title;
46 if (!$title) { 47 if (!$title) {
47 $title = []; 48 $title = [];
48 - $breadcrumb = Auth::instance()->getBreadcrumb(); 49 + $controllername = Loader::parseName(request()->controller());
  50 + $actionname = strtolower(request()->action());
  51 + $path = str_replace('.', '/', $controllername) . '/' . $actionname;
  52 + $breadcrumb = Auth::instance()->getBreadcrumb($path);
49 foreach ($breadcrumb as $k => $v) { 53 foreach ($breadcrumb as $k => $v) {
50 $title[] = $v['title']; 54 $title[] = $v['title'];
51 } 55 }
52 - $title = implode(' ', $title); 56 + $title = implode(' / ', $title);
53 } 57 }
54 self::create([ 58 self::create([
55 'title' => $title, 59 'title' => $title,