talks.dart 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import 'package:get/get.dart';
  2. import 'package:json_annotation/json_annotation.dart';
  3. part 'talks.g.dart';
  4. @JsonSerializable()
  5. class TalkBean {
  6. @JsonKey(name: 'id')
  7. late final String id;
  8. @JsonKey(name: 'taskId')
  9. String? taskId;
  10. @JsonKey(name: 'ssid')
  11. String? ssid;
  12. @JsonKey(name: 'audioUrl')
  13. String? audioUrl;
  14. @JsonKey(name: 'duration')
  15. double? duration;
  16. @JsonKey(name: 'characters')
  17. int? characters;
  18. @JsonKey(name: 'status', fromJson: _intFromJson, includeToJson: false)
  19. Rxn<int> status;
  20. @JsonKey(name: 'title', fromJson: _stringFromJson, includeToJson: false)
  21. Rxn<String> title;
  22. @JsonKey(name: 'summary', fromJson: _stringFromJson, includeToJson: false)
  23. Rxn<String> summary;
  24. @JsonKey(name: 'createTime')
  25. String? createTime;
  26. @JsonKey(name: 'example')
  27. bool? isExample;
  28. @JsonKey(name: 'oversizeFile')
  29. bool? oversizeFile;
  30. @JsonKey(name: 'uploadType')
  31. int? uploadType;
  32. TalkBean({
  33. required this.id,
  34. this.taskId,
  35. this.ssid,
  36. this.audioUrl,
  37. this.duration,
  38. this.characters,
  39. required this.status,
  40. required this.title,
  41. required this.summary,
  42. this.createTime,
  43. this.isExample,
  44. this.oversizeFile,
  45. this.uploadType,
  46. });
  47. factory TalkBean.fromJson(Map<String, dynamic> json) =>
  48. _$TalkBeanFromJson(json);
  49. static _stringFromJson(String? txt) => Rxn(txt);
  50. static _intFromJson(int? txt) => Rxn(txt);
  51. void updateBean(TalkBean talkBean) {
  52. taskId = talkBean.taskId;
  53. ssid = talkBean.ssid;
  54. audioUrl = talkBean.audioUrl;
  55. duration = talkBean.duration;
  56. characters = talkBean.characters;
  57. status.value = talkBean.status.value;
  58. title.value = talkBean.title.value;
  59. summary.value = talkBean.summary.value;
  60. createTime = talkBean.createTime;
  61. isExample = talkBean.isExample;
  62. oversizeFile = talkBean.oversizeFile;
  63. uploadType = talkBean.uploadType;
  64. }
  65. }
  66. class TalkStatus {
  67. TalkStatus._();
  68. //(0等待生成 1生成中,都处于生成中) 2成功 3失败 4未分析
  69. static int analysing = 0;
  70. static int waitAnalysis = 1;
  71. static int analysisSuccess = 2;
  72. static int analysisFail = 3;
  73. static int notAnalysis = 4;
  74. }
  75. class TalkUploadType {
  76. TalkUploadType._();
  77. static int record = 0;
  78. static int localUpload = 1;
  79. }