Blame view

稻城亚丁小程序/backend/app/service/AuthContext.php 645 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  <?php
  declare(strict_types=1);
  
  namespace app\service;
  
  /**
   * 请求内管理员 / 小程序用户上下文(PHP-FPM 每请求独立进程,静态变量安全)
   */
  class AuthContext
  {
      protected static ?array $admin = null;
  
      protected static ?array $mpUser = null;
  
      public static function setAdmin(array $row): void
      {
          self::$admin = $row;
      }
  
      public static function admin(): ?array
      {
          return self::$admin;
      }
  
      public static function setMpUser(array $row): void
      {
          self::$mpUser = $row;
      }
  
      public static function mpUser(): ?array
      {
          return self::$mpUser;
      }
  }