IntJson.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.Serialization;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace CP.Common
  8. {
  9. /// <summary>
  10. /// 接口返回的json数据结构
  11. /// </summary>
  12. [DataContract]
  13. public class IntJson<T>
  14. {
  15. public IntJson()
  16. {
  17. this.code = 0;//0代表成功
  18. this.msg = msg;
  19. this.stime = stime;
  20. }
  21. public IntJson(Body<T> body)
  22. {
  23. this.body = body;
  24. }
  25. public IntJson(int code, string msg, string stime)
  26. {
  27. this.code = code;
  28. this.msg = msg;
  29. this.stime = stime;
  30. }
  31. [DataMember]
  32. public int code { get; set; }
  33. [DataMember]
  34. public string msg { get; set; }
  35. [DataMember]
  36. public string stime { get; set; }
  37. //public T data { set; get; }
  38. //[DataMember(IsRequired =false)]
  39. [DataMember]
  40. public Body<T> body { get; set; }
  41. }
  42. [DataContract]
  43. public class Body<T>
  44. {
  45. [DataMember(IsRequired = false)]
  46. public int? count { set; get; }
  47. [DataMember(IsRequired = false)]
  48. public T data { set; get; }
  49. }
  50. }