Files
chat-flutter/lib/json/json_mine.dart
2025-09-12 20:35:12 +08:00

44 lines
1.2 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'dart:math';
import 'package:demo/config/app_resource.dart';
import 'package:demo/event/event_setting.dart';
import 'package:demo/tools/tools_enum.dart';
import 'package:demo/tools/tools_storage.dart';
// 我的接口
class JsonMine {
// 获取个人详情
static Future<void> getInfo(String phone) async {
// 转换
Map<String, dynamic> data = {
'userId': '12345678$phone',
'nickname': '测试用户',
'portrait': AppImage.i0,
'gender': '1',
'phone': phone,
'userNo': '88888888',
'province': '北京市',
'city': '北京城区',
'birthday': '1970-01-01',
'privacyNo': 'N',
'privacyPhone': 'N',
'privacyScan': 'N',
'privacyCard': 'N',
'privacyGroup': 'N',
'pass': 'N',
};
LocalUser localUser = LocalUser.fromJson(data);
// 存储数据
ToolsStorage().local(value: localUser);
// 通知
EventSetting().event.add(SettingModel(SettingType.mine));
}
// 发送验证码
static Future<String> sendCode() async {
// 生成一个0到99之间的随机整数包括0和99
int random = Random().nextInt(10000);
return random.toString().padLeft(4, '0');
}
}