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

miaoxing / app / 9706166028

28 Jun 2024 01:45AM UTC coverage: 25.0% (+0.2%) from 24.848%
9706166028

push

github

twinh
feat: 更新 `onControllerInit` 为 `onPageInit`

0 of 4 new or added lines in 1 file covered. (0.0%)

41 of 164 relevant lines covered (25.0%)

2.9 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 Miaoxing\Services\Middleware\Cors;
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
    public function onPageInit(BasePage $page)
34
    {
NEW
35
        $page->middleware(Cors::class);
×
NEW
36
        $page->middleware(Auth::class);
×
NEW
37
        $page->middleware(LogRequest::class);
×
38

39
        // 除去 admin/login 页面
40
        if (0 === strpos($this->app->getController(), 'admin/')) {
×
NEW
41
            $page->middleware(CheckAppStatus::class);
×
42
        }
43
    }
44

45
    public function onBeforeScript()
46
    {
47
        wei()->page->addJsVar('miaoxing', [
×
48
            'baseUrl' => wei()->req->getBaseUrl(),
×
49
        ]);
×
50
    }
51
}
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