lixiaojun
2024-11-30 cb12c35c7af4350b0f38b6d90a15d8bd9796b8c5
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
namespace Yw.BIMFace
{
    /// <summary>
    /// 返回结果辅助类
    /// </summary>
    internal class ResponseHelper
    {
        //结果与描述的对应关系字典
        private static readonly Dictionary<string, string> _dic = new Dictionary<string, string>() {
            {"system.error","BIMFACE系统异常"},
            {"authentication.failed","API访问合法性校验失败"},
            {"file.has.not.translated","文件未转换,不能获取viewToken"},
            {"file.translate.failed","文件转换失败,不能获取viewToken"},
            {"file.is.translating","文件转换中,不能获取viewToken"},
            {"integration.not.found","集成模型不存在,不能获取viewToken"},
            {"files.is.integrating","集成中,不能获取viewToken"},
            {"files.integrate.failed","集成失败,不能获取viewToken"},
            {"model.compare.not.found","对比模型不存在,不能获取viewToken"},
            {"model.compare.not.finished","对比未完成,不能获取viewToken"},
            {"model.compare.failed","对比失败,不能获取viewToken"},
            {"file.not.found","文件不存在"},
            {"success","成功"}
        };
 
        /// <summary>
        /// 获取响应编码
        /// </summary>
        internal static eResponseCode GetResponseCode(string code)
        {
            switch (code)
            {
                case "system.error": return eResponseCode.SystemError;
                case "authentication.failed": return eResponseCode.AuthenticationFailed;
                case "file.has.not.translated": return eResponseCode.FileHasNotTranslated;
                case "file.translate.failed": return eResponseCode.FileTranslateFailed;
                case "file.is.translating": return eResponseCode.FileIsTranslating;
                case "integration.not.found": return eResponseCode.IntegrationNotFound;
                case "files.is.integrating": return eResponseCode.FileIsIntegrating;
                case "files.integrate.failed": return eResponseCode.FilesIntegrateFailed;
                case "model.compare.not.found": return eResponseCode.ModelCompareNotFound;
                case "model.compare.not.finished": return eResponseCode.ModelCompareNotFinished;
                case "model.compare.failed": return eResponseCode.ModelCompareFailed;
                case "file.not.found": return eResponseCode.FileNotFound;
                case "success": return eResponseCode.Success;
                default: return eResponseCode.UnKnown;
            }
        }
 
        /// <summary>
        /// 获取响应信息
        /// </summary>
        internal static string GetResponseMessage(string code)
        {
            if (_dic.ContainsKey(code))
            {
                return _dic[code];
            }
            return null;
        }
 
 
    }
}