1
yangle
22 小时以前 6d0bfe2160e06a4502dc3052c43fab9813341db3
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
using System;
 
namespace Top.Api.Security
{
 
    public class ErrorUtil
    {
        private static readonly string[] InvalidSessionCodes = { "26", "27", "53" };
        private static readonly string[] InvalidSubUserCodes = { "12" };
        private static readonly string InvalidSessionkey = "invalid-sessionkey";
 
        public static bool IsInvalidSession(SecretException secretException) {
            foreach (string code in InvalidSessionCodes)
            {
                if (code.Equals(secretException.ErrorCode) && InvalidSessionkey.Equals(secretException.SubErrorCode)) {
                    return true;
                }
            }
            return false;
        }
 
        public static bool IsInvalidSubCode(SecretException secretException) {
            foreach (string code in InvalidSubUserCodes)
            {
                if (code.Equals(secretException.ErrorCode)) {
                    return true;
                }
            }
            return false;
        }
    }
}