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.
aku_new_community/lib/pages/manager_func.dart

214 lines
5.9 KiB

// Package imports:
// Package imports:
import 'package:dio/dio.dart';
import 'package:flustars/flustars.dart';
// Project imports:
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/manager/article_QR_code_model.dart';
import 'package:akuCommunity/model/manager/fixed_detail_model.dart';
import 'package:akuCommunity/model/manager/moving_company_model.dart';
import 'package:akuCommunity/model/manager/questionnaire_detail_model.dart';
import 'package:akuCommunity/model/manager/quetionnaire_submit_model.dart';
import 'package:akuCommunity/model/manager/voting_detail_model.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
class ManagerFunc {
static insertVisitorInfo(int id, int type, String name, int sex, String tel,
String carNum, DateTime expectedVisitDate) async {
BaseModel baseModel = await NetUtil().post(API.manager.insertVisitorInfo,
params: {
'buildingUnitEstateId': id,
'type': type,
'name': name,
'sex': sex,
'tel': tel,
'carNum': carNum,
'expectedVisitDate': DateUtil.formatDate(expectedVisitDate,
format: "yyyy-MM-dd HH:mm:ss")
},
showMessage: true);
return baseModel;
}
static reportRepairInsert(
int id, int type, String reportDetail, List<String> fileUrls) async {
BaseModel baseModel = await NetUtil().post(
API.manager.reportRepairInsert,
params: {
'buildingUnitEstateId': id,
'type': type,
'reportDetail': reportDetail,
'fileUrls': fileUrls,
},
showMessage: false,
);
return baseModel;
}
static reportRepairDelete(List<int> ids) async {
BaseModel baseModel = await NetUtil().post(
API.manager.reportRepairDelete,
params: {'ids': ids},
showMessage: true,
);
return baseModel;
}
static Future<FixedDetailModel> reportRepairFindBYLD(int id) async {
Response response = await NetUtil().dio.get(
API.manager.reportRepairFindBYLD,
queryParameters: {
'repairId': id,
},
);
return FixedDetailModel.fromJson(response.data);
}
static Future<BaseModel> reportRepairCancel(int id) async {
BaseModel baseModel = await NetUtil().get(API.manager.reportRepairCancel,
params: {
'repairId': id,
},
showMessage: true);
return baseModel;
}
static Future<BaseModel> reportRepairEvaluate(
int id, int rate, String text) async {
BaseModel baseModel = await NetUtil().post(
API.manager.reportRepairEvaluate,
params: {
'repairId': id,
'evaluationLevel': rate,
'evaluationContent': text,
},
showMessage: true,
);
return baseModel;
}
static Future<BaseModel> reportRepairComplete(int id) async {
BaseModel baseModel = await NetUtil().get(
API.manager.reportRepairComplete,
params: {
'repairId': id,
},
showMessage: true,
);
return baseModel;
}
static Future<MovingCompanyModel> getMovingCompanyTel() async {
Response response = await NetUtil().dio.get(
API.manager.getMovingCompanyTel,
);
return MovingCompanyModel.fromJson(response.data);
}
static Future<BaseModel> articleOutSubmit({
int id,
String name,
int weight,
int approach,
String tel,
String time,
List<String> urls,
}) async {
BaseModel baseModel = await NetUtil().post(
API.manager.articleOutSubmit,
params: {
'buildingUnitEstateId': id,
'name': name,
'weight': weight,
'approach': approach,
'movingCompanyTel': tel,
'expectedTime':
DateUtil.formatDateStr(time, format: "yyyy-MM-dd HH:mm:ss"),
'imgUrls': urls,
},
showMessage: true,
);
return baseModel;
}
static Future<ArticleQRModel> getQRcode(int id) async {
Response response = await NetUtil().dio.get(
API.manager.getQRcode,
queryParameters: {
'articleOutId': id,
},
);
return ArticleQRModel.fromJson(response.data);
}
4 years ago
static Future<BaseModel> articleOutDelete(List<int> ids) async {
BaseModel baseModel = await NetUtil().post(
API.manager.articleOutDelete,
params: {'ids': ids},
showMessage: true,
);
return baseModel;
}
static Future<BaseModel> fromLoss(int id) async {
4 years ago
BaseModel baseModel = await NetUtil().post(
API.manager.fromLoss,
params: {'articleBorrowId': id},
4 years ago
showMessage: true,
);
return baseModel;
}
static Future<BaseModel> findEstatelsPayment() async {
BaseModel baseModel = await NetUtil().get(
API.manager.findEstatelsPament,
showMessage: false,
);
return baseModel;
}
static Future<VotingDetailModel> voteDetail(int id) async {
BaseModel baseModel = await NetUtil().get(API.manager.voteDetail,
params: {
'voteId': 1,
},
showMessage: false);
return VotingDetailModel.fromJson(baseModel.data);
}
static Future<BaseModel> vote(int voteId, int candleId) async {
BaseModel baseModel = await NetUtil().post(API.manager.vote, params: {
'voteId': voteId,
'candidateId': candleId,
});
return baseModel;
}
static Future<QuestionnaireDetialModel> questionnairefindById(int id) async {
BaseModel baseModel = await NetUtil().get(
API.manager.questionnairefindById,
params: {
'questionnaireId': id,
},
showMessage: false,
);
return QuestionnaireDetialModel.fromJson(baseModel.data);
}
static Future<BaseModel> questionnaireSubmit(
int id, List<AppQuestionnaireAnswerSubmits> model) async {
BaseModel baseModel = await NetUtil().post(
API.manager.questionnaireSubmit,
params: {
'id': id,
'appQuestionnaireAnswerSubmits': model,
},
showMessage: true,
);
return baseModel;
}
}