import 'package:pj_supermarket_cloud/common/index.dart'; abstract class ProductApi { /// 菜品分类 static Future?> canteenClassify( dynamic pa, ) async { final res = await HttpManage().dio.get( "/canteen/canteenCategory/getAllSimple", queryParameters: pa, ); if (res.data == null) return null; return res.data ?.map((e) => ServiceClassify.fromJson(e)) .toList(); } /// 查询指定单日的食堂菜谱商品。 static Future?> canteenProduct( dynamic pa, ) async { final res = await HttpManage().dio.get( "/canteen/canteenDailyMenu/ad/getCanteenList", queryParameters: pa, ); if (res.data == null) return null; return res.data ?.map((e) => ServiceProduct.fromJson(e)) .toList(); } /// 按闭区间查询多日食堂菜谱商品,响应结构与单日接口保持一致。 static Future?> canteenProductsByDateRange( Map requestBody, ) async { final res = await HttpManage().dio.post( "/canteen/canteenDailyMenu/ad/getCanteenListByDateRange", data: requestBody, ); if (res.data == null) return null; return res.data ?.map((e) => ServiceProduct.fromJson(e)) .toList(); } /// 超市分类 static Future?> supermarketClassify( dynamic pa, ) async { final res = await HttpManage().dio.get( "/supermarket/supermarketCategory/simpleAll", queryParameters: pa, ); if (res.data == null) return null; return res.data ?.map((e) => ServiceClassify.fromJson(e)) .toList(); } /// 超市 spu static Future supermarketSpu( dynamic pa, ) async { final res = await HttpManage().dio.post( "/supermarket/supermarketSpu/ad/selectListAll", queryParameters: { "current": pa["current"] ?? 1, "size": pa["size"] ?? 100, }, data: pa, ); if (res.data == null) return null; return ServiceSupermarketSpuPage.fromJson(res.data); } /// 超市 spu 详情 static Future?> supermarketSupDetial( dynamic pa, ) async { final res = await HttpManage().dio.get( "/supermarket/supermarketSpu/ad/SpuDetails", queryParameters: pa, ); if (res.data == null) return null; return res.data ?.map((e) => ServiceSupermarketSku.fromJson(e)) .toList(); } }