SubscriptionActionEnum.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace common\enums;
  3. use common\models\member\Member;
  4. /**
  5. * Class SubscriptionActionEnum
  6. * @package common\enums
  7. * @author jianyan74 <751393839@qq.com>
  8. */
  9. class SubscriptionActionEnum extends BaseEnum
  10. {
  11. /** @var string 提醒 */
  12. const ABNORMAL_LOGIN = 'abnormal_login';
  13. const ERROR = 'error';
  14. /**
  15. * @return array
  16. */
  17. public static function getMap(): array
  18. {
  19. return [
  20. self::ABNORMAL_LOGIN => '连续异常登录',
  21. self::ERROR => '请求 500 错误',
  22. ];
  23. }
  24. /**
  25. * 默认值
  26. *
  27. * @param $action
  28. * @return array|string[]
  29. */
  30. public static function default($action)
  31. {
  32. $data = [
  33. self::ERROR => [
  34. 'title' => '有一条 500 错误日志',
  35. 'content' => '具体看全局日志',
  36. // 辅助说明表
  37. 'tables' => [
  38. // [
  39. // 'title' => '用户',
  40. // 'prefix' => 'member',
  41. // 'tableName' => Member::tableName(),
  42. // 'filterField' => []
  43. // ]
  44. ],
  45. ],
  46. self::ABNORMAL_LOGIN => [
  47. 'title' => '有一条异常错误日志',
  48. 'content' => '{username} 连续 {attempts} 次错误输入账号密码',
  49. 'tables' => [
  50. ]
  51. ],
  52. ];
  53. return $data[$action] ?? [];
  54. }
  55. }
粤ICP备19079148号