| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace common\enums;
- /**
- *
- * Class LoginEnum
- * @package common\enums
- * @author qimall
- */
- class LoginEnum extends BaseEnum
- {
- const AUTHORIZED_LOGIN = -1000;
- const AUTHORIZED_MOBILE = -1001;
- /**
- * @return array
- */
- public static function getMap(): array
- {
- return [];
- }
- public static function getReplaceMap(): array
- {
- return [
- 'Your request was made with invalid credentials.' => '请登录'
- ];
- }
- public static function getMessageMap(): array
- {
- return [
- self::AUTHORIZED_LOGIN =>[
- '用户访问令牌已过期,请重新登录获取',
- '此openid未授权,请重新授权',
- 'Your request was made with invalid credentials.'
- ],
- self::AUTHORIZED_MOBILE => [
- '此用户未授权手机号码',
- ]
- ];
- }
- public static function checkMessage($message){
- $messages = self::getMessageMap();
- $code = '';
- foreach ($messages as $k => $message_arr){
- if(in_array($message,$message_arr)){
- $code = $k;
- break;
- }
- }
- return $code;
- }
- }
|