修复用户端个人头像展示

This commit is contained in:
czl231
2026-09-02 22:48:47 +08:00
parent 2033a9407e
commit 7cc56f955f
12 changed files with 334 additions and 23 deletions

View File

@@ -1,3 +1,5 @@
import 'dart:typed_data';
import '../../domain/models/client_models.dart';
import '../services/api_client.dart';
@@ -39,6 +41,9 @@ class ClientRepository {
Future<UserProfile> profile() async =>
UserProfile.fromJson(jsonMap(await _api.get('$root/auth/profile')));
/// 通过用户端鉴权接口读取当前登录用户的头像二进制内容。
Future<Uint8List?> profileAvatar() => _api.getBytes('$root/auth/avatar');
Future<WalletSummary> wallet() async =>
WalletSummary.fromJson(jsonMap(await _api.get('$root/wallet')));
@@ -93,15 +98,17 @@ class ClientRepository {
required String channel,
required String payType,
String openid = '',
}) async => jsonMap(await _api.post(
'$root/$business/orders/$identity/pay',
body: {
'request_no': requestNo,
'channel': channel,
}) async => jsonMap(
await _api.post(
'$root/$business/orders/$identity/pay',
body: {
'request_no': requestNo,
'channel': channel,
'pay_type': payType,
if (openid.isNotEmpty) 'openid': openid,
},
));
},
),
);
Future<void> createRefund({
required String business,
@@ -110,11 +117,14 @@ class ClientRepository {
required String reason,
required List<Map<String, Object?>> items,
}) async {
await _api.post('$root/$business/orders/$identity/refunds', body: {
'request_no': requestNo,
'reason': reason,
'items': items,
});
await _api.post(
'$root/$business/orders/$identity/refunds',
body: {
'request_no': requestNo,
'reason': reason,
'items': items,
},
);
}
Future<Map<String, Object?>?> serviceRelation() async {