//
//  SyncDownloadHandler.m
//  classonline
//
//  Created by 黄亚州 on 2018/9/26.
//  Copyright © 2018年 offcn. All rights reserved.
//

#import "SyncDownloadHandler.h"

@interface SyncDownloadHandler ()

@end

@implementation SyncDownloadHandler

#pragma mark - 公开方法

- (void)syncDownloadForLoginSucceed:(NSArray <CODownloadModel *> *)modelArray {
    if (modelArray == nil || modelArray.count <= 0) {
        return;
    }
    
    for (CODownloadModel *model in modelArray) {
        [self NETWORK_syncDownloadRecord:model];
    }
}

- (void)syncDownloadInfoByDownloadModel:(CODownloadModel *)model {
    [self NETWORK_syncDownloadRecord:model];
}

#pragma mark - Network request

- (void)NETWORK_syncDownloadRecord:(CODownloadModel *)model {
    if (model == nil || model.need_sync == needSyncValueNO) { //如果模型为空，或者是不需要同步
        return;
    }
    
//    NSString *deviceType = [SZUtil deviceVersion];
//    NSDictionary *dict = @{
//                           @"username":currentUser.user_name,
//                           @"parent_id": model.parent_id,
//                           @"lesson_id": model.lesson_id,
//                           @"lesson_type": [NSString stringWithFormat:@"%ld", (long)model.lesson_type],
//                           @"lesson_name": model.down_name,
//                           @"offcn-ticket": currentUser.user_ticket,
//                           @"download_time": [NSString stringWithFormat:@"%0.0f",
//                                              [[SZUtil dateFromStr:model.down_date withFormatterStr:@"yyyy-MM-dd HH:mm:ss"]
//                                               timeIntervalSince1970]],
//                           @"user_agent": @"2",
//                           @"device_name": deviceType,
//                           @"device_id": currentUser.device_id,
//                           @"Content-Type": @"application/json; charset=utf-8"
//                           };
}

@end
