import 'package:fis_jsonrpc/rpc.dart'; import 'package:vitalapp/rpc.dart'; import 'package:vitalapp/store/store.dart'; import 'package:fis_common/logger/logger.dart'; import 'interfaces/doctor.dart'; class DoctorManager implements IDoctorManager { @override Future syncInfo() async { try { final userInfo = await rpc.vitalUser.getUserDetailAsync( GetUserRequest(token: Store.user.token), ); await Store.user.updateUserInfo(userInfo); } catch (e) { logger.e("DoctorManager sync user info error.", e); } } @override Future setSignature(String signature) async { try { final request = SetSignatureRequest( token: Store.user.token, code: Store.user.userCode, signature: signature, ); final result = await rpc.vitalUser.setSignatureAsync(request); if (result) { // 更新全局状态 await Store.user.updateSignature(signature); } return result; } catch (e) { logger.e("DoctorManager set signature error.", e); return false; } } }