iOS网络——SDWebImage SDImageDownloader源码解析

你要知道的NSURLSession都在这里

转载请注明出处 http://www.jianshu.com/p/6a9fb7c85251

本系列文章主要讲解iOS中网络请求类NSURLSession的使用方法进行详解,同时也会以此为扩展,讲解SDWebImage中图片下载功能的源码分析,讲解AFNetworking相关源码分析。本系列文章主要分为以下几篇进行讲解,读者可按需查阅。

SDWebImage SDWebImageDownloader源码解析

前一篇文章中讲解了SDWebImageDownloaderOperation是如何自定义NSOperation子类以及如何使用NSURLSession实现下载的,本文将会讲解SDWebImageDownloader类,来探索SDWebImage如何实现多线程下载多张图片的。

首先看一下接口声明代码:

//下载选项设置的一系列枚举
typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) {
    SDWebImageDownloaderLowPriority = 1 << 0,
    SDWebImageDownloaderProgressiveDownload = 1 << 1,
    SDWebImageDownloaderUseNSURLCache = 1 << 2,
    SDWebImageDownloaderIgnoreCachedResponse = 1 << 3,
    SDWebImageDownloaderContinueInBackground = 1 << 4,
    SDWebImageDownloaderHandleCookies = 1 << 5,
    SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6,
    SDWebImageDownloaderHighPriority = 1 << 7,  
    SDWebImageDownloaderScaleDownLargeImages = 1 << 8,
};

//下载图片时的顺序,FIFO或者LIFO
typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) {
    SDWebImageDownloaderFIFOExecutionOrder,
    SDWebImageDownloaderLIFOExecutionOrder
};

//声明通知的全局变量名
FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadStartNotification;
FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadStopNotification;

//进度回调块
typedef void(^SDWebImageDownloaderProgressBlock)(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL);

//下载完成的回调块
typedef void(^SDWebImageDownloaderCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished);

//http首部数据字典
typedef NSDictionary<NSString *, NSString *> SDHTTPHeadersDictionary;
//http首部可变数据字典
typedef NSMutableDictionary<NSString *, NSString *> SDHTTPHeadersMutableDictionary;

//http首部过滤的一个回调块
typedef SDHTTPHeadersDictionary * _Nullable (^SDWebImageDownloaderHeadersFilterBlock)(NSURL * _Nullable url, SDHTTPHeadersDictionary * _Nullable headers);

上面就是一些枚举、变量、自定义类型的声明。

/*
自定义token类,用于取消下载任务
这个token第二个属性其实就是SDWebImageDownloaderOperation中使用的token即回调块的字典
目的相同,都是为了取消特定的下载任务
*/
@interface SDWebImageDownloadToken : NSObject

@property (nonatomic, strong, nullable) NSURL *url;
@property (nonatomic, strong, nullable) id downloadOperationCancelToken;

@end

//异步下载图片
@interface SDWebImageDownloader : NSObject

//是否压缩图片
@property (assign, nonatomic) BOOL shouldDecompressImages;

//支持的最大同时下载图片的数量,其实就是NSOperationQueue支持的最大并发数
@property (assign, nonatomic) NSInteger maxConcurrentDownloads;

//当前正在下载图片的数量,其实就是NSOperationQueue的operationCount即正在执行下载任务的operation的数量
@property (readonly, nonatomic) NSUInteger currentDownloadCount;

//下载时连接服务器的超时时间,默认15s
@property (assign, nonatomic) NSTimeInterval downloadTimeout;

//session运行模式,默认使用默认模式,即 defaultSessionConfiguration
@property (readonly, nonatomic, nonnull) NSURLSessionConfiguration *sessionConfiguration;

//执行下载任务的顺序,FIFO或LIFO
@property (assign, nonatomic) SDWebImageDownloaderExecutionOrder executionOrder;

//类方法,获取全局共享的单例对象
+ (nonnull instancetype)sharedDownloader;

//默认的URL credential
@property (strong, nonatomic, nullable) NSURLCredential *urlCredential;

//用户名,有些图片下载的地址需要做用户认证
@property (strong, nonatomic, nullable) NSString *username;

//密码
@property (strong, nonatomic, nullable) NSString *password;

//过滤http首部的回调块
@property (nonatomic, copy, nullable) SDWebImageDownloaderHeadersFilterBlock headersFilter;

//初始化方法,不使用全局共享的downloader时创建
- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)sessionConfiguration NS_DESIGNATED_INITIALIZER;

//为http首部设置值
- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field;

//返回http首部的值
- (nullable NSString *)valueForHTTPHeaderField:(nullable NSString *)field;

//设置下载类的Class,默认使用SDWebImageDownloaderOperation,开发者可以自定义只需实现相关协议
- (void)setOperationClass:(nullable Class)operationClass;

/*
下载url对应的图片
设置下载配置选项、进度回调块、下载完成回调块
返回一个token,用于取消对应的下载任务
*/
- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url
                                                   options:(SDWebImageDownloaderOptions)options
                                                  progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
                                                 completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;

//取消下载任务,需要传入上面创建下载任务时返回的token
- (void)cancel:(nullable SDWebImageDownloadToken *)token;

//设置下载队列NSOperationQueue挂起
- (void)setSuspended:(BOOL)suspended;

//设置取消NSOperationQueue队列中的所有下载任务
- (void)cancelAllDownloads;

//要求downloader使用特定运行模式创建一个NSURLSession对象
- (void)createNewSessionWithConfiguration:(nonnull NSURLSessionConfiguration *)sessionConfiguration;

@end

上面定义了一系列的属性和方法,接下来看一下.m文件的源码:

@implementation SDWebImageDownloadToken
@end

//遵守NSURLSessionTaskDelegate和NSURLSessionDataDelegate协议
@interface SDWebImageDownloader () <NSURLSessionTaskDelegate, NSURLSessionDataDelegate>

//定义一个NSOperationQueue的下载队列
@property (strong, nonatomic, nonnull) NSOperationQueue *downloadQueue;
//最近一次添加进队列的operation主要用于LIFO时设置依赖
@property (weak, nonatomic, nullable) NSOperation *lastAddedOperation;
//operationClass默认是SDWebImageDownloaderOperation
@property (assign, nonatomic, nullable) Class operationClass;
//可变字典,key是图片的URL,value是对应的下载任务Operation
@property (strong, nonatomic, nonnull) NSMutableDictionary<NSURL *, SDWebImageDownloaderOperation *> *URLOperations;
//<NSString*, NSString*>类型的字典,存储http首部
@property (strong, nonatomic, nullable) SDHTTPHeadersMutableDictionary *HTTPHeaders;
//一个GCD的队列
@property (SDDispatchQueueSetterSementics, nonatomic, nullable) dispatch_queue_t barrierQueue;

//NSURLSession对象
@property (strong, nonatomic) NSURLSession *session;

@end

@implementation SDWebImageDownloader

//类方法,类加载的时候执行
+ (void)initialize {
    
    //如果导入了SDNetworkActivityIndicator文件,就会展示一个小菊花
    if (NSClassFromString(@"SDNetworkActivityIndicator")) {

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
        id activityIndicator = [NSClassFromString(@"SDNetworkActivityIndicator") performSelector:NSSelectorFromString(@"sharedActivityIndicator")];
#pragma clang diagnostic pop

        //删除通知后重新添加通知,防止重复添加出现异常
        [[NSNotificationCenter defaultCenter] removeObserver:activityIndicator name:SDWebImageDownloadStartNotification object:nil];
        [[NSNotificationCenter defaultCenter] removeObserver:activityIndicator name:SDWebImageDownloadStopNotification object:nil];

        [[NSNotificationCenter defaultCenter] addObserver:activityIndicator
                                                 selector:NSSelectorFromString(@"startActivity")
                                                     name:SDWebImageDownloadStartNotification object:nil];
        [[NSNotificationCenter defaultCenter] addObserver:activityIndicator
                                                 selector:NSSelectorFromString(@"stopActivity")
                                                     name:SDWebImageDownloadStopNotification object:nil];
    }
}

//类方法,返回单例对象
+ (nonnull instancetype)sharedDownloader {
    static dispatch_once_t once;
    static id instance;
    dispatch_once(&once, ^{
        instance = [self new];
    });
    return instance;
}

//初始化方法调用下面的初始化方法,NSURLSession运行在默认模式下
- (nonnull instancetype)init {
    return [self initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
}

//初始化方法
- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)sessionConfiguration {
    if ((self = [super init])) {
        //默认使用SDWebImageDownloaderOperation作为下载任务Operation
        _operationClass = [SDWebImageDownloaderOperation class];
        _shouldDecompressImages = YES;
        //默认下载顺序FIFO
        _executionOrder = SDWebImageDownloaderFIFOExecutionOrder;
        //创建NSOperationQueue并设置最大并发数为6,即同时最多可以下载6张图片
        _downloadQueue = [NSOperationQueue new];
        _downloadQueue.maxConcurrentOperationCount = 6;
        //设置名称
        _downloadQueue.name = @"com.hackemist.SDWebImageDownloader";
        //设置下载webp格式图片的http首部
        _URLOperations = [NSMutableDictionary new];
#ifdef SD_WEBP
        _HTTPHeaders = [@{@"Accept": @"image/webp,image/*;q=0.8"} mutableCopy];
#else
        _HTTPHeaders = [@{@"Accept": @"image/*;q=0.8"} mutableCopy];
#endif
        //创建一个GCD并发队列
        _barrierQueue = dispatch_queue_create("com.hackemist.SDWebImageDownloaderBarrierQueue", DISPATCH_QUEUE_CONCURRENT);
        //默认超时时间15s
        _downloadTimeout = 15.0;
        //创建一个sessionConfiguration运行默认的NSURLSession对象
        [self createNewSessionWithConfiguration:sessionConfiguration];
    }
    return self;
}

//创建指定运行模式的NSURLSession对象,可能已经创建过了
- (void)createNewSessionWithConfiguration:(NSURLSessionConfiguration *)sessionConfiguration {
    //可能已经创建过,所以需要取消前一个session的下载任务并打破引用循环
    [self cancelAllDownloads];

    if (self.session) {
        [self.session invalidateAndCancel];
    }

    sessionConfiguration.timeoutIntervalForRequest = self.downloadTimeout;

    self.session = [NSURLSession sessionWithConfiguration:sessionConfiguration
                                                 delegate:self
                                            delegateQueue:nil];
}
//在析构函数中调用session的invalidateAndCancel方法取消下载任务并打破引用循环
- (void)dealloc {
    [self.session invalidateAndCancel];
    self.session = nil;
    //NSOperationQueue取消所有的下载操作
    [self.downloadQueue cancelAllOperations];
    //释放GCD队列
    SDDispatchQueueRelease(_barrierQueue);
}

上面的各种初始化、析构函数也都很简单,不再赘述了。

//为http首部设置键值对
- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field {
    if (value) {
        self.HTTPHeaders[field] = value;
    } else {
        [self.HTTPHeaders removeObjectForKey:field];
    }
}

//获取http首部的值
- (nullable NSString *)valueForHTTPHeaderField:(nullable NSString *)field {
    return self.HTTPHeaders[field];
}

//设置最大同时下载图片的数量,即NSOperationQueue最大并发数
- (void)setMaxConcurrentDownloads:(NSInteger)maxConcurrentDownloads {
    _downloadQueue.maxConcurrentOperationCount = maxConcurrentDownloads;
}

//当前正在下载图片数量,即NSOperationQueue中正在执行的operation数量
- (NSUInteger)currentDownloadCount {
    return _downloadQueue.operationCount;
}

//获取最大同时下载图片的数量
- (NSInteger)maxConcurrentDownloads {
    return _downloadQueue.maxConcurrentOperationCount;
}

//获取NSURLSession的运行模式配置
- (NSURLSessionConfiguration *)sessionConfiguration {
    return self.session.configuration;
}

//设置operation的Class类对象
- (void)setOperationClass:(nullable Class)operationClass {
    if (operationClass && [operationClass isSubclassOfClass:[NSOperation class]] && [operationClass conformsToProtocol:@protocol(SDWebImageDownloaderOperationInterface)]) {
        _operationClass = operationClass;
    } else {
        _operationClass = [SDWebImageDownloaderOperation class];
    }
}

上面的方法都是一些settergetter

//下载图片的方法
- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url
                                                   options:(SDWebImageDownloaderOptions)options
                                                  progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
                                                 completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock {
    __weak SDWebImageDownloader *wself = self;
    //直接调用另一个方法,后面大片的block代码目的就是为了创建一个SDWebImageDownloaderOperation类的对象
    return [self addProgressCallback:progressBlock completedBlock:completedBlock forURL:url createCallback:^SDWebImageDownloaderOperation *{
        //block中为了防止引用循环和空指针,先weak后strong
        __strong __typeof (wself) sself = wself;
        //设置超时时间
        NSTimeInterval timeoutInterval = sself.downloadTimeout;
        if (timeoutInterval == 0.0) {
            timeoutInterval = 15.0;
        }

        //设置缓存策略
        NSURLRequestCachePolicy cachePolicy = options & SDWebImageDownloaderUseNSURLCache ? NSURLRequestUseProtocolCachePolicy : NSURLRequestReloadIgnoringLocalCacheData;
        //创建一个可变的request镀锡
        NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url
                                                                    cachePolicy:cachePolicy
                                                                timeoutInterval:timeoutInterval];
        //设置cookie的处理策略
        request.HTTPShouldHandleCookies = (options & SDWebImageDownloaderHandleCookies);
        request.HTTPShouldUsePipelining = YES;
        //过滤http首部
        if (sself.headersFilter) {
            request.allHTTPHeaderFields = sself.headersFilter(url, [sself.HTTPHeaders copy]);
        }
        else {
            request.allHTTPHeaderFields = sself.HTTPHeaders;
        }
        //创建一个SDWebImageDownloaderOperation类的对象
        //传入request、session和下载选项配置options
        SDWebImageDownloaderOperation *operation = [[sself.operationClass alloc] initWithRequest:request inSession:sself.session options:options];
        //设置是否压缩图片
        operation.shouldDecompressImages = sself.shouldDecompressImages;
        //设置认证凭证和https相关
        if (sself.urlCredential) {
            operation.credential = sself.urlCredential;
        } else if (sself.username && sself.password) {
            operation.credential = [NSURLCredential credentialWithUser:sself.username password:sself.password persistence:NSURLCredentialPersistenceForSession];
        }
        //设置下载优先级
        if (options & SDWebImageDownloaderHighPriority) {
            operation.queuePriority = NSOperationQueuePriorityHigh;
        } else if (options & SDWebImageDownloaderLowPriority) {
            operation.queuePriority = NSOperationQueuePriorityLow;
        }
        //向队列中添加创建的下载任务,之后这个operation就会被线程调度来执行其start方法
        [sself.downloadQueue addOperation:operation];
        //如果是LIFO就设置一个依赖
        if (sself.executionOrder == SDWebImageDownloaderLIFOExecutionOrder) {
            // Emulate LIFO execution order by systematically adding new operations as last operation's dependency
            [sself.lastAddedOperation addDependency:operation];
            sself.lastAddedOperation = operation;
        }
        //返回operation
        return operation;
    }];
}
//取消一个下载任务,需要传入上一个方法返回的token,其实具体的token是由下一个方法创建的
- (void)cancel:(nullable SDWebImageDownloadToken *)token {
    //异步执行,阻塞队列从而串行的删除任务,可以避免竞争条件的产生
    dispatch_barrier_async(self.barrierQueue, ^{
        //通过token的url获取到这个Operation
        SDWebImageDownloaderOperation *operation = self.URLOperations[token.url];
        //调用Operation自定义的cancel方法来取消任务,传入一个回调块字典的token
        BOOL canceled = [operation cancel:token.downloadOperationCancelToken];
        //如果取消了就从字典中移除掉这个键值对
        if (canceled) {
            [self.URLOperations removeObjectForKey:token.url];
        }
    });
}

/*
前面download方法调用的方法,返回一个token
createCallback就是download方法写的,用于创建一个SDWebImageDownloaderOperation
*/
- (nullable SDWebImageDownloadToken *)addProgressCallback:(SDWebImageDownloaderProgressBlock)progressBlock
                                           completedBlock:(SDWebImageDownloaderCompletedBlock)completedBlock
                                                   forURL:(nullable NSURL *)url
                                           createCallback:(SDWebImageDownloaderOperation *(^)(void))createCallback {
    //URL为nil就调用下载完成回调块,返回nil
    if (url == nil) {
        if (completedBlock != nil) {
            completedBlock(nil, nil, nil, NO);
        }
        return nil;
    }
    //定义一个token变量
    __block SDWebImageDownloadToken *token = nil;
    //同步方法,阻塞当前线程也阻塞队列,防止产生竞争条件
    dispatch_barrier_sync(self.barrierQueue, ^{
        //通过URL获取Operation
        SDWebImageDownloaderOperation *operation = self.URLOperations[url];
        
        if (!operation) {
            //如果URL对应的Operation不存在就调用,createCallback块创建一个
            operation = createCallback();
            //添加进字典中
            self.URLOperations[url] = operation;

            __weak SDWebImageDownloaderOperation *woperation = operation;
            //设置Operation下载完成的回调块
            operation.completionBlock = ^{
                //同步方法阻塞当前线程阻塞队列
                dispatch_barrier_sync(self.barrierQueue, ^{
                    //先weak后strong
                    SDWebImageDownloaderOperation *soperation = woperation;
                    if (!soperation) return;
                    //下载完成就从字典中删除
                    if (self.URLOperations[url] == soperation) {
                        [self.URLOperations removeObjectForKey:url];
                    };
                });
            };
        }
        //取消下载任务时的token,第一个值就是url,第二个值就是回调块字典
        id downloadOperationCancelToken = [operation addHandlersForProgress:progressBlock completed:completedBlock];

        token = [SDWebImageDownloadToken new];
        token.url = url;
        token.downloadOperationCancelToken = downloadOperationCancelToken;
    });

    return token;
}

上面的方法也比较容易懂,不再赘述了。

//设置是否挂起下载队列
- (void)setSuspended:(BOOL)suspended {
    self.downloadQueue.suspended = suspended;
}

//取消所有的下载任务
- (void)cancelAllDownloads {
    [self.downloadQueue cancelAllOperations];
}

#pragma mark Helper methods
//通过NSURLSessionTask找到NSOPerationQueue里的任务
- (SDWebImageDownloaderOperation *)operationWithTask:(NSURLSessionTask *)task {
    SDWebImageDownloaderOperation *returnOperation = nil;
    for (SDWebImageDownloaderOperation *operation in self.downloadQueue.operations) {
        if (operation.dataTask.taskIdentifier == task.taskIdentifier) {
            returnOperation = operation;
            break;
        }
    }
    return returnOperation;
}

#pragma mark NSURLSessionDataDelegate
//下面这些代理方法,都是先通过NSURLSessionTask找到对应的SDWebImageDownloaderOperation
//然后调用Operation的代理方法,
- (void)URLSession:(NSURLSession *)session
          dataTask:(NSURLSessionDataTask *)dataTask
didReceiveResponse:(NSURLResponse *)response
 completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler {

    // Identify the operation that runs this task and pass it the delegate method
    SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:dataTask];

    [dataOperation URLSession:session dataTask:dataTask didReceiveResponse:response completionHandler:completionHandler];
}

- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data {

    // Identify the operation that runs this task and pass it the delegate method
    SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:dataTask];

    [dataOperation URLSession:session dataTask:dataTask didReceiveData:data];
}

- (void)URLSession:(NSURLSession *)session
          dataTask:(NSURLSessionDataTask *)dataTask
 willCacheResponse:(NSCachedURLResponse *)proposedResponse
 completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler {

    // Identify the operation that runs this task and pass it the delegate method
    SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:dataTask];

    [dataOperation URLSession:session dataTask:dataTask willCacheResponse:proposedResponse completionHandler:completionHandler];
}

#pragma mark NSURLSessionTaskDelegate

- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {
    // Identify the operation that runs this task and pass it the delegate method
    SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:task];

    [dataOperation URLSession:session task:task didCompleteWithError:error];
}

- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest * _Nullable))completionHandler {
    
    completionHandler(request);
}

- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {

    // Identify the operation that runs this task and pass it the delegate method
    SDWebImageDownloaderOperation *dataOperation = [self operationWithTask:task];

    [dataOperation URLSession:session task:task didReceiveChallenge:challenge completionHandler:completionHandler];
}

@end

这里的代理方法运用比较值得学习吧,SDWebImageDownloaderOperation需要传入一个NSURLSession对象,但是这个对象不一定可用,如果不可用SDWebImageDownloaderOperation就会自己创建一个NSURLSession对象,但如果它可用,那SDWebImageDownloaderOperation就不能接收回调方法,所以,本类在回调方法中直接调用SDWebImageDownloaderOperation的回调方法。

经过两篇文章的源码讲解,SDWebImage关于图片下载的部分也就全部讲解完了,主要使用了自定义NSOperation子类,并在这个自定义NSOperation子类中通过一个可用的NSURLSession来创建一个执行服务器交互数据的NSURLSessionDataTask的下载任务,并由其全权负责下载工作,接着使用NSOperationQueue实现多线程的多图片下载。源码中值得我们学习的地方有很多,比如,在设计第三方库时要设计全面的通知,为了防止竞争条件可以使用一个串行队列或是barrier方法来执行一些可能会产生多线程异常的代码,还有很多设计代码的细节需要我们自行体会。

备注

由于作者水平有限,难免出现纰漏,如有问题还请不吝赐教。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 202,406评论 5 475
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 84,976评论 2 379
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 149,302评论 0 335
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,366评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,372评论 5 363
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,457评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,872评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,521评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,717评论 1 295
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,523评论 2 319
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,590评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,299评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,859评论 3 306
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,883评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,127评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,760评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,290评论 2 342

推荐阅读更多精彩内容