qy_service_window_params.dart 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import './qy_commodity_info.dart';
  2. import './qy_source.dart';
  3. class QYServiceWindowParams {
  4. QYSource? source;
  5. QYCommodityInfo? commodityInfo;
  6. String? sessionTitle;
  7. int groupId;
  8. int staffId;
  9. int? robotId;
  10. bool robotFirst;
  11. int faqTemplateId;
  12. int vipLevel;
  13. bool showQuitQueue;
  14. bool showCloseSessionEntry;
  15. QYServiceWindowParams({
  16. this.source,
  17. this.commodityInfo,
  18. this.sessionTitle,
  19. this.groupId = 0,
  20. this.staffId = 0,
  21. this.robotId,
  22. this.robotFirst = false,
  23. this.faqTemplateId = 0,
  24. this.vipLevel = 0,
  25. this.showQuitQueue = true,
  26. this.showCloseSessionEntry = true,
  27. });
  28. factory QYServiceWindowParams.fromJson(Map<String, dynamic> json) {
  29. return QYServiceWindowParams(
  30. source: QYSource.fromJson(json['source']),
  31. commodityInfo: json.containsKey('commodityInfo')
  32. ? QYCommodityInfo.fromJson(json['commodityInfo'])
  33. : null,
  34. sessionTitle: json['sessionTitle'],
  35. groupId: json['groupId'],
  36. staffId: json['staffId'],
  37. robotId: json['robotId'],
  38. robotFirst: json['robotFirst'],
  39. faqTemplateId: json['faqTemplateId'],
  40. vipLevel: json['vipLevel'],
  41. showQuitQueue: json['showQuitQueue'],
  42. showCloseSessionEntry: json['showCloseSessionEntry'],
  43. );
  44. }
  45. Map<String, dynamic> toJson() {
  46. Map<String, dynamic> json = new Map();
  47. if (source != null) json.putIfAbsent('source', () => source!.toJson());
  48. if (commodityInfo != null)
  49. json.putIfAbsent('commodityInfo', () => commodityInfo!.toJson());
  50. if (sessionTitle != null)
  51. json.putIfAbsent('sessionTitle', () => sessionTitle);
  52. if (groupId != null) json.putIfAbsent('groupId', () => groupId);
  53. if (staffId != null) json.putIfAbsent('staffId', () => staffId);
  54. if (robotId != null) json.putIfAbsent('robotId', () => robotId);
  55. if (robotFirst != null) json.putIfAbsent('robotFirst', () => robotFirst);
  56. if (faqTemplateId != null)
  57. json.putIfAbsent('faqTemplateId', () => faqTemplateId);
  58. if (vipLevel != null) json.putIfAbsent('vipLevel', () => vipLevel);
  59. if (showQuitQueue != null)
  60. json.putIfAbsent('showQuitQueue', () => showQuitQueue);
  61. if (showCloseSessionEntry != null)
  62. json.putIfAbsent('showCloseSessionEntry', () => showCloseSessionEntry);
  63. return json;
  64. }
  65. }