You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
942 B
Objective-C
47 lines
942 B
Objective-C
//
|
|
// TXCUrl.m
|
|
// SuperPlayer
|
|
//
|
|
// Created by annidyfeng on 2018/9/17.
|
|
// Copyright © 2018年 annidy. All rights reserved.
|
|
//
|
|
|
|
#import "TXCUrl.h"
|
|
|
|
@implementation TXCUrl {
|
|
NSURL *_url;
|
|
}
|
|
|
|
- (instancetype)initWithString:(NSString *)url
|
|
{
|
|
self = [super init];
|
|
|
|
_url = [NSURL URLWithString:url];
|
|
|
|
return self;
|
|
}
|
|
|
|
- (NSInteger)bizid
|
|
{
|
|
NSString *bizId = nil;
|
|
for (NSString *param in [_url.query componentsSeparatedByString:@"&"]) {
|
|
NSArray *elts = [param componentsSeparatedByString:@"="];
|
|
if([elts count] < 2) continue;
|
|
if ([[elts firstObject] isEqualToString:@"bizid"]) {
|
|
bizId = [elts lastObject];
|
|
break;
|
|
}
|
|
}
|
|
if (bizId == nil) {
|
|
bizId = [[_url host] componentsSeparatedByString:@"."].firstObject;
|
|
}
|
|
|
|
NSInteger bizIdNum = [bizId integerValue];
|
|
if (bizIdNum <= 0) {
|
|
bizIdNum = -1;
|
|
}
|
|
return bizIdNum;
|
|
}
|
|
|
|
@end
|