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
| namespace CommonUtil
| {
| /// <summary>
| /// 生成报文
| /// </summary>
| public class TopResult
| {
| /// <summary>
| /// 生成返回报文
| /// </summary>
| /// <param name="response">返回数据</param>
| /// <param name="isSuccess">是否执行成功</param>
| /// <param name="code">错误码</param>
| /// <param name="msg">描述</param>
| /// <returns></returns>
| public static TopResultDTO<T> GetTopResultDTO<T>(T response, bool isSuccess, int code, string msg)
| {
| return new TopResultDTO<T>
| {
| Success = isSuccess,
| Code = code,
| Msg = msg,
| Response = response
| };
| }
|
| /// <summary>
| /// 生成返回报文
| /// </summary>
| /// <param name="response">返回数据</param>
| /// <param name="isSuccess">是否执行成功</param>
| /// <param name="code">错误码</param>
| /// <param name="msg">描述</param>
| /// <param name="currentPage">页码</param>
| /// <param name="pageSize">页大小</param>
| /// <param name="totalCount">总数</param>
| /// <returns></returns>
| public static TopResultDTO<TopPageResultDTO<T>> GetTopPageResultDTO<T>(T response, bool isSuccess, int code, string msg, int currentPage, int pageSize, int totalCount)
| {
| return new TopResultDTO<TopPageResultDTO<T>>
| {
| Success = isSuccess,
| Code = code,
| Msg = msg,
| Response = new TopPageResultDTO<T>
| {
| PageNo = currentPage,
| TotalCount = totalCount,
| PageSize = pageSize,
| Data = response
| }
| };
| }
|
| /// <summary>
| /// 生成返回报文
| /// </summary>
| /// <param name="isSuccess">是否执行成功</param>
| /// <param name="code">错误码</param>
| /// <param name="msg">描述</param>
| /// <returns></returns>
| public static TopResultDTO<T> GetTopResultDTO<T>(bool isSuccess, int code, string msg)
| {
| return new TopResultDTO<T>
| {
| Success = isSuccess,
| Code = code,
| Msg = msg,
| };
| }
| }
| }
|
|