22
schangxiang@126.com
2025-03-31 00fda34dd9bbe207583d7fac19b306ae32db18f0
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
64
65
66
67
68
69
70
71
72
73
74
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
 
namespace iWareSda
{
    /// <summary>
    /// SDA服务返回的实体类
    /// </summary>
    [Serializable]
    [DataContract]
    //增加 DataContract DataMember 是为了生成调用不自动生成k_BackingField后缀
    public class SdaResEntity
    {
        public SdaResEntity()
        {
            this.result = false;
        }
        /// <summary>
        /// 返回结果
        /// </summary>
        [DataMember]
        public bool result { get; set; }
 
        [DataMember]
        public object resData { get; set; }
 
        /// <summary>
        /// 返回信息(包含正常和错误的信息)
        /// </summary>
        [DataMember]
        public string resMsg { get; set; }
 
 
        public static SdaResEntity Success(string _resMsg)
        {
            return new SdaResEntity()
            {
                result = true,
                resMsg = _resMsg
            };
        }
        public static SdaResEntity Success(string _resMsg, object _resData)
        {
            return new SdaResEntity()
            {
                result = true,
                resData = _resData,
                resMsg = _resMsg
            };
        }
 
        public static SdaResEntity Failure(string _resMsg)
        {
            return new SdaResEntity()
            {
                result = false,
                resMsg = _resMsg
            };
        }
        public static SdaResEntity Failure(string _resMsg, object _resData)
        {
            return new SdaResEntity()
            {
                result = false,
                resData = _resData,
                resMsg = _resMsg
            };
        }
    }
}