This repository was archived by the owner on Aug 16, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +21
-8
lines changed Expand file tree Collapse file tree 2 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,12 @@ namespace Cyan
61
61
{
62
62
if (json[" type" ].is_null () || json[" type" ].get <string>() != this ->GetType ())
63
63
throw std::runtime_error (" 给定的json不正确" );
64
+
65
+ imageId_ = " " ;
66
+ url_ = " " ;
67
+ path_ = " " ;
68
+ base64_ = " " ;
69
+
64
70
if (!json[" imageId" ].is_null ())
65
71
imageId_ = json[" imageId" ].get <string>();
66
72
if (!json[" url" ].is_null ())
@@ -76,10 +82,10 @@ namespace Cyan
76
82
return
77
83
{
78
84
{ " type" , GetType () },
79
- { " imageId" , imageId_ },
80
- { " url" , url_ },
81
- { " path" , path_ },
82
- { " base64" , base64_ }
85
+ { " imageId" , imageId_. empty ()? nullptr : imageId_ },
86
+ { " url" , url_. empty ()? nullptr : url_ },
87
+ { " path" , path_. empty ()? nullptr : path_ },
88
+ { " base64" , base64_. empty ()? nullptr : base64_ }
83
89
};
84
90
}
85
91
virtual ~ImageMessage () {}
Original file line number Diff line number Diff line change @@ -63,6 +63,13 @@ namespace Cyan
63
63
{
64
64
if (json[" type" ].is_null () || json[" type" ].get <string>() != this ->GetType ())
65
65
throw std::runtime_error (" 给定的json不正确" );
66
+
67
+ voiceId_ = " " ;
68
+ url_ = " " ;
69
+ path_ = " " ;
70
+ base64_ = " " ;
71
+ length_ = 0 ;
72
+
66
73
if (!json[" voiceId" ].is_null ())
67
74
voiceId_ = json[" voiceId" ].get <string>();
68
75
if (!json[" url" ].is_null ())
@@ -80,10 +87,10 @@ namespace Cyan
80
87
return
81
88
{
82
89
{ " type" , type_ },
83
- { " voiceId" , voiceId_ },
84
- { " url" , url_ },
85
- { " path" , path_ },
86
- { " base64" , base64_ },
90
+ { " voiceId" , voiceId_. empty ()? nullptr : voiceId_ },
91
+ { " url" , url_. empty ()? nullptr : url_ },
92
+ { " path" , path_. empty ()? nullptr : path_ },
93
+ { " base64" , base64_. empty ()? nullptr : base64_ },
87
94
{ " length" , length_ }
88
95
};
89
96
}
You can’t perform that action at this time.
0 commit comments