12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- //
- // FKJSInterface.m
- // FirstLink
- //
- // Created by ascii on 15/10/28.
- // Copyright © 2015年 FirstLink. All rights reserved.
- //
- #import "FKJSInterface.h"
- @implementation FKJSInterface
- #pragma mark - parse
- + (BOOL)isForceLogin:(NSDictionary *)dict {
- if ([dict isKindOfClass:[NSDictionary class]]) {
- NSString *isForceLogin = [NSString stringWithFormat:@"%@", dict[@"force_login"]];
- if ([isForceLogin isEqualToString:@"1"]) {
- return YES;
- }
- }
- return NO;
- }
- + (NSDictionary *)dictForUser:(User *)user {
- return @{@"code" : [FKUserManager isUserLogin] ? @"1" : @"0",
- @"id" : [FLStringHelper replaceNilWithEmpty:user.userID],
- @"nickname" : [FLStringHelper replaceNilWithEmpty:user.nickName],
- @"head_pic" : [FLStringHelper replaceNilWithEmpty:user.headurl],
- @"phone" : [FLStringHelper replaceNilWithEmpty:user.mobile],
- @"level" : [FLStringHelper replaceNilWithEmpty:user.level],
- @"status" : [FLStringHelper replaceNilWithEmpty:user.status],
- @"token" : [FLStringHelper replaceNilWithEmpty:user.token],
- };
- }
- + (FKWeixinItem *)parseWeixinItem:(NSDictionary *)dict {
- if ([dict isKindOfClass:[NSDictionary class]]) {
- FKWeixinItem *item = [[FKWeixinItem alloc] init];
- [item mts_setValuesForKeysWithDictionary:dict];
- return item;
- }
- return nil;
- }
- + (NSURL *)parseURL:(NSDictionary *)dict {
- if ([dict isKindOfClass:[NSDictionary class]]) {
- NSURL *url = [NSURL URLWithString:dict[@"url"]];
- if ([url.scheme rangeOfString:@"HTTP" options:NSCaseInsensitiveSearch].length > 0) {
- return url;
- }
- }
- return nil;
- }
- #pragma mark - send
- @end
|