import 'package:flutter/cupertino.dart';
import 'package:zhiying_base_widget/widgets/home/home_banner/model/HomeBannerModel.dart';
import 'package:zhiying_comm/util/empty_util.dart';
import 'package:zhiying_comm/util/net_util.dart';

class HomeBannerRepository {
  /// 读取缓存数据
  Future<HomeBannerModel> fetchCacheData({@required int modId}) async {
    var reult = await NetUtil.getRequestCachedData('/api/v1/mod', params: {
      'ids': [modId]
    });
    if (!EmptyUtil.isEmpty(reult)) {
      return HomeBannerModel();
    }
    return null;
  }

  /// 获取网路数据
  Future<HomeBannerModel> fetchNetData({@required int modId}) async {
    var result = await NetUtil.post('/api/v1/mod', params: {
      'ids': [modId]
    });
    if (NetUtil.isSuccess(result)) {
      return HomeBannerModel();
    }
    return null;
  }
}
