Przeglądaj źródła

人工翻译协议增加群名

master
zdc 5 lat temu
rodzic
commit
8e9be56b9a
2 zmienionych plików z 34 dodań i 2 usunięć
  1. +26
    -0
      lib/data/group_data_mgr.dart
  2. +8
    -2
      lib/utils/HttpUtil.dart

+ 26
- 0
lib/data/group_data_mgr.dart Wyświetl plik

@@ -176,6 +176,32 @@ class GroupInfoMgr {
return '';
}
//获取群名
getGroupName(int groupId) {
for (var i = 0; i < groupInfoList.length; i++) {
var info = groupInfoList[i];
if (info.sessionId == groupId) {
if (info.name != null && info.name != '') {
return info.name;
} else {
var members = info.getMembersInGroup();
String res = '';
int nums = members.length > 4 ? 4 : members.length;
for (int i = 0; i < nums; i++) {
if (i != 0) {
res += '、';
}
String name = members[i].refName;
res += name.length > 8 ? name.substring(0, 8) + '..' : name;
}
return res;
}
}
}
return '';
}
//获取群信息
Future<GroupInfoModel> getGroupInfo(int sessionId,
{bool isSave = true}) async {


+ 8
- 2
lib/utils/HttpUtil.dart Wyświetl plik

@@ -1083,7 +1083,6 @@ class HttpUtil {
}
}
//付费人工翻译
getPersonalTranslate(MsgModel msgModel) async {
Map data = {
@@ -1103,11 +1102,18 @@ class HttpUtil {
showToast('请稍后再试');
return;
}
data['content'] = base64Encode(File(msgModel.localFile).readAsBytesSync());
data['content'] =
base64Encode(File(msgModel.localFile).readAsBytesSync());
print('语音转换的文字: ${utf8.decode(msgModel.enTranslateContent)}');
data['vcontent'] = base64Encode(msgModel.enTranslateContent);
}
if (msgModel.channelType == ChatChannelType.Group.value) {
data['theme'] = GroupInfoMgr().getGroupName(msgModel.sessionId);
} else {
data['theme'] = '';
}
data['list'] = ChatDataMgr().getForeChatRecord(msgModel);
data["tuserids"] = [UserData().basicInfo.userId];


Ładowanie…
Anuluj
Zapisz