FirstRechargeEntity.fromJson constructor

FirstRechargeEntity.fromJson(
  1. dynamic json
)

Implementation

FirstRechargeEntity.fromJson(dynamic json) {
  showEntrance = DynamicUtils.safeToInt(json["showEntrance"], def: 0);
  dynamic propsJsonArray = json["props"];
  if (propsJsonArray != null) {
    var list = propsJsonArray as List;
    props = list.map((s) => FirstRechargeInfoEntity.fromJson(s)).toList();
  } else {
    props = <FirstRechargeInfoEntity>[];
  }
  if (showEntrance == GET_REWARD) {
    firstChargeType = DynamicUtils.safeToInt(json["firstChargeType"], def: 0);
    if (firstChargeType > 0 && firstChargeType <= props.length) {
      int i = firstChargeType - 1;
      // 标签类型 >>> 2:热门;3:推荐;9527:可领取;其他:无
      props[i].label = LABEL_RECEIVE;
    }
  } else {
    firstChargeType = 0;
  }
}