talks.dart 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. TalkBean(
  31. {required this.id,
  32. this.taskId,
  33. this.ssid,
  34. this.audioUrl,
  35. this.duration,
  36. this.characters,
  37. required this.status,
  38. required this.title,
  39. required this.summary,
  40. this.createTime,
  41. this.isExample,
  42. this.oversizeFile});
  43. factory TalkBean.fromJson(Map<String, dynamic> json) =>
  44. _$TalkBeanFromJson(json);
  45. static _stringFromJson(String? txt) => Rxn(txt);
  46. static _intFromJson(int? txt) => Rxn(txt);
  47. void updateBean(TalkBean talkBean) {
  48. taskId = talkBean.taskId;
  49. ssid = talkBean.ssid;
  50. audioUrl = talkBean.audioUrl;
  51. duration = talkBean.duration;
  52. characters = talkBean.characters;
  53. status.value = talkBean.status.value;
  54. title.value = talkBean.title.value;
  55. summary.value = talkBean.summary.value;
  56. createTime = talkBean.createTime;
  57. isExample = talkBean.isExample;
  58. oversizeFile = talkBean.oversizeFile;
  59. }
  60. }
  61. class TalkStatus {
  62. TalkStatus._();
  63. //(0等待生成 1生成中,都处于生成中) 2成功 3失败 4未分析
  64. static int analysing = 0;
  65. static int waitAnalysis = 1;
  66. static int analysisSuccess = 2;
  67. static int analysisFail = 3;
  68. static int notAnalysis = 4;
  69. }