You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.2 KiB

import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/user/pick_building_model.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:dio/dio.dart';
class SignFunc {
static Future sendMessageCode(String phone) async {
BaseModel baseModel = await NetUtil().post(
API.login.sendSMSCode,
params: {'tel': phone},
showMessage: true,
);
return baseModel;
}
4 years ago
static Future<Response> login(String phone, String code) async {
Response response = await NetUtil().dio.post(
API.login.loginBySMS,
data: {'tel': phone, 'code': code},
);
4 years ago
return response;
}
static Future<List<PickBuildingModel>> getBuildingInfo() async {
BaseModel model = await NetUtil().get(API.login.buildingInfo);
return (model.data as List)
.map((e) => PickBuildingModel.fromJson(e))
.toList();
}
static Future<List<PickBuildingModel>> getUnitInfo(int id) async {
BaseModel model = await NetUtil().get(
API.login.unitInfo,
params: {"buildingId": id},
);
return (model.data as List)
.map((e) => PickBuildingModel.fromJson(e))
.toList();
}
}