|
|
|
@ -13,21 +13,20 @@ import 'package:recook/manager/http_manager.dart';
|
|
|
|
|
import 'package:recook/models/category_model.dart';
|
|
|
|
|
|
|
|
|
|
class HomeDao {
|
|
|
|
|
static getCategories({@required OnSuccess<List<FirstCategory>> success,@required OnFailure failure}) async {
|
|
|
|
|
ResultData res = await HttpManager.post(GoodsApi.categories, {
|
|
|
|
|
});
|
|
|
|
|
static Future getCategories(
|
|
|
|
|
{@required OnSuccess<List<FirstCategory>> success,
|
|
|
|
|
@required OnFailure failure}) async {
|
|
|
|
|
ResultData res = await HttpManager.post(GoodsApi.categories, {});
|
|
|
|
|
|
|
|
|
|
if (!res.result) {
|
|
|
|
|
failure(res.code, res.msg);
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
CategoryModel model = CategoryModel.fromJson(res.data);
|
|
|
|
|
if (model.code == HttpStatus.SUCCESS) {
|
|
|
|
|
success(model.data, model.code, model.msg);
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
failure(HttpStatus.FAILURE, model.msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|