• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

miaoxing / app / 6336160079

24 Sep 2023 08:27AM UTC coverage: 2.614% (-0.3%) from 2.941%
6336160079

push

github

twinh
feat(app, experimental): 记录请求日志

0 of 17 new or added lines in 2 files covered. (0.0%)

4 of 153 relevant lines covered (2.61%)

0.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/AppPlugin.php
1
<?php
2

3
namespace Miaoxing\App;
4

5
use Miaoxing\App\Middleware\CheckAppStatus;
6
use Miaoxing\App\Middleware\LogRequest;
7
use Miaoxing\Plugin\BasePage;
8
use Miaoxing\Services\Middleware\Auth;
9
use Wei\BaseController;
10

11
class AppPlugin extends \Miaoxing\Plugin\BasePlugin
12
{
13
    protected $name = '应用';
14

15
    protected $description = '';
16

17
    protected $code = 202;
18

19
    public function onLinkToGetLinks(&$links, &$types)
20
    {
21
        $types['site'] = [
×
22
            'name' => '官网',
23
            'sort' => 900,
24
        ];
25

26
        $links[] = [
×
27
            'typeId' => 'site',
28
            'name' => '首页',
29
            'url' => '',
30
        ];
31
    }
32

33
    /**
34
     * 限制命令行控制器,只有在命令行下或超级管理员才可以访问
35
     *
36
     * @param BaseController $controller
37
     */
38
    public function onControllerInit(BaseController $controller)
39
    {
40
        $controller->middleware(Auth::class);
×
NEW
41
        $controller->middleware(LogRequest::class);
×
42

43
        // 除去 admin/login 页面
44
        if (0 === strpos($this->app->getController(), 'admin/')) {
×
45
            $controller->middleware(CheckAppStatus::class);
×
46
        }
47
    }
48

49
    public function onPageInit(BasePage $page)
50
    {
51
        $this->onControllerInit($page);
×
52
    }
53

54
    public function onBeforeScript()
55
    {
56
        wei()->page->addJsVar('miaoxing', [
×
57
            'baseUrl' => wei()->req->getBaseUrl(),
×
58
        ]);
59
    }
60
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc