CustomPromotionModel.m 2.87 KB
Newer Older
曹云霄's avatar
曹云霄 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
//
//  CustomPromotionModel.m
//  Lighting
//
//  Created by 曹云霄 on 2016/11/15.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "CustomPromotionModel.h"
#import "PromotionLuckyDrawModel.h"
#import "PromotionalGoodsModel.h"
#import "PromotionalDeductionModel.h"
#import "PromotionWeChatCardModel.h"
#import "PromotionalReadPacketModel.h"

@implementation CustomPromotionModel


+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
    return YES;
}

- (instancetype)initCustomPromotionModel:(JSONModel *)model
{
    if (self = [super init]) {
            //微信卡劵
        if ([model isMemberOfClass:[PromotionWeChatCardModel class]]) {
            PromotionWeChatCardModel *weChatModel = (PromotionWeChatCardModel *)model;
            self.descriptionString = weChatModel.descriptionString;
            self.type = weChatModel.type;
            self.body = weChatModel.body;
            self.conflicts = weChatModel.conflicts;
            self.priority = weChatModel.priority;
        }else if ([model isMemberOfClass:[PromotionalDeductionModel class]]) {
            //抵扣
            PromotionalDeductionModel *deductionModel = (PromotionalDeductionModel *)model;
            self.descriptionString = deductionModel.descriptionString;
            self.type = deductionModel.type;
            self.body = deductionModel.body;
            self.conflicts = deductionModel.conflicts;
            self.priority = deductionModel.priority;
        }else if ([model isMemberOfClass:[PromotionLuckyDrawModel class]]) {
            //抽奖
            PromotionLuckyDrawModel *drawModel = (PromotionLuckyDrawModel *)model;
            self.descriptionString = drawModel.descriptionString;
            self.type = drawModel.type;
            self.body = drawModel.body;
            self.conflicts = drawModel.conflicts;
            self.priority = drawModel.priority;
        }else if ([model isMemberOfClass:[PromotionalGoodsModel class]]) {
            //送商品
            PromotionalGoodsModel *goodsModel = (PromotionalGoodsModel *)model;
            self.descriptionString = goodsModel.descriptionString;
            self.type = goodsModel.type;
            self.body = goodsModel.body;
            self.conflicts = goodsModel.conflicts;
            self.priority = goodsModel.priority;
        }else if ([model isMemberOfClass:[PromotionalReadPacketModel class]]) {
            //现金红包
            PromotionalReadPacketModel *readPacketModel = (PromotionalReadPacketModel *)model;
            self.descriptionString = readPacketModel.descriptionString;
            self.type = readPacketModel.type;
            self.body = readPacketModel.body;
            self.conflicts = readPacketModel.conflicts;
            self.priority = readPacketModel.priority;
            self.promotionBillNumber = readPacketModel.promotionBillNumber;
        }
    }
    return self;
}


@end