mirror of
https://github.com/StarCitizenToolBox/app.git
synced 2026-02-06 15:10:20 +00:00
fix: default avatar url
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||
|
||||
class PartyRoomUtils {
|
||||
static final DateFormat dateTimeFormatter = DateFormat('yyyy-MM-dd HH:mm:ss');
|
||||
@@ -19,4 +20,20 @@ class PartyRoomUtils {
|
||||
}
|
||||
return dateTimeFormatter.format(dateTime);
|
||||
}
|
||||
|
||||
/// 统一处理 avatarUrl
|
||||
/// 对于 http/https 开头的直接返回,否则使用旧的拼接规则
|
||||
static String? getAvatarUrl(String? avatarUrl) {
|
||||
if (avatarUrl == null || avatarUrl.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 如果已经是完整的 URL,直接返回
|
||||
if (avatarUrl.startsWith('http://') || avatarUrl.startsWith('https://')) {
|
||||
return avatarUrl;
|
||||
}
|
||||
|
||||
// 否则使用 RSI 头像基础 URL 拼接
|
||||
return '${URLConf.rsiAvatarBaseUrl}$avatarUrl';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user