Commit 3b55e678 authored by Sandy's avatar Sandy

封装七牛图片上传类 and bug fix

parent 923729f1
This diff is collapsed.
//
// JavenDetailReseller.h
//
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class JavenOwnerOrg, JavenLastModifyInfo, JavenCertificate, JavenPasswordControl, JavenIdCard, JavenShop, JavenCreateInfo, JavenLoginControl;
@interface JavenDetailReseller : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) id birthday;
@property (nonatomic, assign) id portrait;
@property (nonatomic, strong) JavenOwnerOrg *ownerOrg;
@property (nonatomic, strong) NSString *code;
@property (nonatomic, assign) id telephone;
@property (nonatomic, strong) NSString *mobilephone;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) JavenLastModifyInfo *lastModifyInfo;
@property (nonatomic, assign) id socialContact;
@property (nonatomic, strong) JavenCertificate *certificate;
@property (nonatomic, assign) double version;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *invitationCode;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, strong) NSString *domain;
@property (nonatomic, strong) JavenPasswordControl *passwordControl;
@property (nonatomic, strong) NSString *gender;
@property (nonatomic, strong) NSArray *roles;
@property (nonatomic, assign) id postalAddresses;
@property (nonatomic, strong) JavenIdCard *idCard;
@property (nonatomic, assign) id referrer;
@property (nonatomic, strong) JavenShop *shop;
@property (nonatomic, strong) JavenCreateInfo *createInfo;
@property (nonatomic, assign) double order;
@property (nonatomic, strong) JavenLoginControl *loginControl;
@property (nonatomic, strong) NSString *internalBaseClassDescription;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
This diff is collapsed.
//
// JavencommissionAccountModel.h
//
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class JavenReseller;
@interface JavencommissionAccountModel : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) double balance;
@property (nonatomic, assign) double monthlyOrderCount;
@property (nonatomic, assign) double monthlySales;
@property (nonatomic, strong) JavenReseller *reseller;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, assign) double accumulatedIncome;
@property (nonatomic, assign) double monthlyIncome;
@property (nonatomic, assign) double unconfirmedBalance;
@property (nonatomic, assign) double withdrawAmount;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// JavencommissionAccountModel.m
//
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "JavencommissionAccountModel.h"
#import "JavenReseller.h"
NSString *const kJavencommissionAccountModelBalance = @"balance";
NSString *const kJavencommissionAccountModelMonthlyOrderCount = @"monthlyOrderCount";
NSString *const kJavencommissionAccountModelMonthlySales = @"monthlySales";
NSString *const kJavencommissionAccountModelReseller = @"reseller";
NSString *const kJavencommissionAccountModelUuid = @"uuid";
NSString *const kJavencommissionAccountModelAccumulatedIncome = @"accumulatedIncome";
NSString *const kJavencommissionAccountModelMonthlyIncome = @"monthlyIncome";
NSString *const kJavencommissionAccountModelUnconfirmedBalance = @"unconfirmedBalance";
NSString *const kJavencommissionAccountModelWithdrawAmount = @"withdrawAmount";
@interface JavencommissionAccountModel ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation JavencommissionAccountModel
@synthesize balance = _balance;
@synthesize monthlyOrderCount = _monthlyOrderCount;
@synthesize monthlySales = _monthlySales;
@synthesize reseller = _reseller;
@synthesize uuid = _uuid;
@synthesize accumulatedIncome = _accumulatedIncome;
@synthesize monthlyIncome = _monthlyIncome;
@synthesize unconfirmedBalance = _unconfirmedBalance;
@synthesize withdrawAmount = _withdrawAmount;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.balance = [[self objectOrNilForKey:kJavencommissionAccountModelBalance fromDictionary:dict] doubleValue];
self.monthlyOrderCount = [[self objectOrNilForKey:kJavencommissionAccountModelMonthlyOrderCount fromDictionary:dict] doubleValue];
self.monthlySales = [[self objectOrNilForKey:kJavencommissionAccountModelMonthlySales fromDictionary:dict] doubleValue];
self.reseller = [JavenReseller modelObjectWithDictionary:[dict objectForKey:kJavencommissionAccountModelReseller]];
self.uuid = [self objectOrNilForKey:kJavencommissionAccountModelUuid fromDictionary:dict];
self.accumulatedIncome = [[self objectOrNilForKey:kJavencommissionAccountModelAccumulatedIncome fromDictionary:dict] doubleValue];
self.monthlyIncome = [[self objectOrNilForKey:kJavencommissionAccountModelMonthlyIncome fromDictionary:dict] doubleValue];
self.unconfirmedBalance = [[self objectOrNilForKey:kJavencommissionAccountModelUnconfirmedBalance fromDictionary:dict] doubleValue];
self.withdrawAmount = [[self objectOrNilForKey:kJavencommissionAccountModelWithdrawAmount fromDictionary:dict] doubleValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[NSNumber numberWithDouble:self.balance] forKey:kJavencommissionAccountModelBalance];
[mutableDict setValue:[NSNumber numberWithDouble:self.monthlyOrderCount] forKey:kJavencommissionAccountModelMonthlyOrderCount];
[mutableDict setValue:[NSNumber numberWithDouble:self.monthlySales] forKey:kJavencommissionAccountModelMonthlySales];
[mutableDict setValue:[self.reseller dictionaryRepresentation] forKey:kJavencommissionAccountModelReseller];
[mutableDict setValue:self.uuid forKey:kJavencommissionAccountModelUuid];
[mutableDict setValue:[NSNumber numberWithDouble:self.accumulatedIncome] forKey:kJavencommissionAccountModelAccumulatedIncome];
[mutableDict setValue:[NSNumber numberWithDouble:self.monthlyIncome] forKey:kJavencommissionAccountModelMonthlyIncome];
[mutableDict setValue:[NSNumber numberWithDouble:self.unconfirmedBalance] forKey:kJavencommissionAccountModelUnconfirmedBalance];
[mutableDict setValue:[NSNumber numberWithDouble:self.withdrawAmount] forKey:kJavencommissionAccountModelWithdrawAmount];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.balance = [aDecoder decodeDoubleForKey:kJavencommissionAccountModelBalance];
self.monthlyOrderCount = [aDecoder decodeDoubleForKey:kJavencommissionAccountModelMonthlyOrderCount];
self.monthlySales = [aDecoder decodeDoubleForKey:kJavencommissionAccountModelMonthlySales];
self.reseller = [aDecoder decodeObjectForKey:kJavencommissionAccountModelReseller];
self.uuid = [aDecoder decodeObjectForKey:kJavencommissionAccountModelUuid];
self.accumulatedIncome = [aDecoder decodeDoubleForKey:kJavencommissionAccountModelAccumulatedIncome];
self.monthlyIncome = [aDecoder decodeDoubleForKey:kJavencommissionAccountModelMonthlyIncome];
self.unconfirmedBalance = [aDecoder decodeDoubleForKey:kJavencommissionAccountModelUnconfirmedBalance];
self.withdrawAmount = [aDecoder decodeDoubleForKey:kJavencommissionAccountModelWithdrawAmount];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeDouble:_balance forKey:kJavencommissionAccountModelBalance];
[aCoder encodeDouble:_monthlyOrderCount forKey:kJavencommissionAccountModelMonthlyOrderCount];
[aCoder encodeDouble:_monthlySales forKey:kJavencommissionAccountModelMonthlySales];
[aCoder encodeObject:_reseller forKey:kJavencommissionAccountModelReseller];
[aCoder encodeObject:_uuid forKey:kJavencommissionAccountModelUuid];
[aCoder encodeDouble:_accumulatedIncome forKey:kJavencommissionAccountModelAccumulatedIncome];
[aCoder encodeDouble:_monthlyIncome forKey:kJavencommissionAccountModelMonthlyIncome];
[aCoder encodeDouble:_unconfirmedBalance forKey:kJavencommissionAccountModelUnconfirmedBalance];
[aCoder encodeDouble:_withdrawAmount forKey:kJavencommissionAccountModelWithdrawAmount];
}
- (id)copyWithZone:(NSZone *)zone
{
JavencommissionAccountModel *copy = [[JavencommissionAccountModel alloc] init];
if (copy) {
copy.balance = self.balance;
copy.monthlyOrderCount = self.monthlyOrderCount;
copy.monthlySales = self.monthlySales;
copy.reseller = [self.reseller copyWithZone:zone];
copy.uuid = [self.uuid copyWithZone:zone];
copy.accumulatedIncome = self.accumulatedIncome;
copy.monthlyIncome = self.monthlyIncome;
copy.unconfirmedBalance = self.unconfirmedBalance;
copy.withdrawAmount = self.withdrawAmount;
}
return copy;
}
@end
......@@ -19,10 +19,13 @@
@implementation HomeTopView
- (void)awakeFromNib {
self.imageViewUserIcon.layer.masksToBounds = YES;
self.imageViewUserIcon.layer.cornerRadius = self.imageViewUserIcon.width / 2;
}
- (void)updateTopViewInfo:(JavenShopModel *)shop {
[self.imageViewUserIcon sd_setImageWithURL:[NSURL URLWithString:@""] placeholderImage:[UIImage imageNamed:@"defaultUserIcon"]];
[self.imageViewUserIcon sd_setImageWithURL:[NSURL URLWithString:shop.pictures] placeholderImage:[UIImage imageNamed:@"defaultUserIcon"]];
self.labelName.text = shop.name;
self.labelSubTitle.text = shop.internalBaseClassDescription;
}
......
......@@ -41,11 +41,6 @@
<constraint firstAttribute="width" constant="70" id="pE8-uA-V23"/>
<constraint firstAttribute="height" constant="70" id="qp1-bf-4GL"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="35"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
......
......@@ -7,7 +7,9 @@
//
#import <UIKit/UIKit.h>
#import "JavencommissionAccountModel.h"
@interface MoneyView : UIView
- (void)setMoneyView:(JavencommissionAccountModel *)model;
@end
......@@ -7,14 +7,14 @@
//
#import "MoneyView.h"
#import "MBLabelWithFontAdapter.h"
@interface MoneyView ()
@property (weak, nonatomic) IBOutlet UILabel *labelMoney;
@property (weak, nonatomic) IBOutlet UILabel *labelMonthIncome;
@property (weak, nonatomic) IBOutlet UILabel *labelMonthSale;
@property (weak, nonatomic) IBOutlet UILabel *labelMonthOrder;
@property (weak, nonatomic) IBOutlet UIButton *buttonEye;//tag为0,则显示星号,tag为1,显示金额
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *labelMonthIncome;
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *labelMonthSale;
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *labelMonthOrder;
@property (weak, nonatomic) IBOutlet UIButton *buttonEye;//tag为1,则显示星号,tag为0,显示金额
@property (nonatomic, copy) NSString *realMoney;
@end
......@@ -45,7 +45,7 @@
[[NSUserDefaults standardUserDefaults] setObject:@"YES" forKey:@"hideMoney"];
}else{
self.labelMoney.text = @"23421";
self.labelMoney.text = self.realMoney;
sender.tag = 0;
[sender setImage:[UIImage imageNamed:@"eyeOpen"] forState:UIControlStateNormal];
[[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"hideMoney"];
......@@ -53,11 +53,19 @@
}
- (void)setMoneyView:(JavencommissionAccountModel *)model {
self.labelMonthIncome.text = [NSString stringWithFormat:@"%.2f",model.monthlyIncome];
self.labelMonthSale.text = [NSString stringWithFormat:@"%.2f",model.monthlySales];
self.labelMonthOrder.text = [NSString stringWithFormat:@"%.0f",model.monthlyOrderCount];
[self setMoneyNumber:[NSString stringWithFormat:@"%.2f", model.accumulatedIncome]];
}
//设置总收入金额
- (void)setMondeyNumber:(NSString *)number{
if (self.buttonEye.tag == 0) {
- (void)setMoneyNumber:(NSString *)number{
if (self.buttonEye.tag == 1) {
self.realMoney = number;
}else{
self.realMoney = number;
self.labelMoney.text = number;
}
}
......
......@@ -8,53 +8,53 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view autoresizesSubviews="NO" contentMode="scaleToFill" id="iN0-l3-epB" customClass="MoneyView">
<rect key="frame" x="0.0" y="0.0" width="375" height="199"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="199"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="moneyViewLine" translatesAutoresizingMaskIntoConstraints="NO" id="sno-XF-7wp">
<rect key="frame" x="0.0" y="107" width="375" height="92"/>
<rect key="frame" x="0.0" y="107" width="320" height="92"/>
<constraints>
<constraint firstAttribute="height" constant="92" id="dUG-RN-Lz2"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O8s-DL-Dmx">
<rect key="frame" x="301" y="123" width="17" height="32"/>
<fontDescription key="fontDescription" type="system" pointSize="26"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O8s-DL-Dmx" customClass="MBLabelWithFontAdapter">
<rect key="frame" x="256" y="126" width="15" height="29"/>
<fontDescription key="fontDescription" type="system" pointSize="24"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oE9-qL-eth">
<rect key="frame" x="58" y="123" width="17" height="32"/>
<fontDescription key="fontDescription" type="system" pointSize="26"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oE9-qL-eth" customClass="MBLabelWithFontAdapter">
<rect key="frame" x="49" y="126" width="15" height="29"/>
<fontDescription key="fontDescription" type="system" pointSize="24"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="本月收入" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bWL-2f-gh2">
<rect key="frame" x="10" y="163" width="112" height="21"/>
<rect key="frame" x="10" y="163" width="93" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="本月订单数" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hyn-Rr-wOv">
<rect key="frame" x="253" y="163" width="112" height="21"/>
<rect key="frame" x="217" y="163" width="93" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="本月销售额" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="k8x-ug-WTe">
<rect key="frame" x="132" y="163" width="111" height="21"/>
<rect key="frame" x="113" y="163" width="94" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MWa-IH-asH">
<rect key="frame" x="179" y="123" width="17" height="32"/>
<fontDescription key="fontDescription" type="system" pointSize="26"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MWa-IH-asH" customClass="MBLabelWithFontAdapter">
<rect key="frame" x="153" y="126" width="15" height="29"/>
<fontDescription key="fontDescription" type="system" pointSize="24"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="累计收入 (元)" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7rw-kV-aXx">
<rect key="frame" x="17" y="17" width="124" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="账户余额(元)" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7rw-kV-aXx">
<rect key="frame" x="17" y="17" width="119" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
......@@ -66,7 +66,7 @@
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rightIcon" translatesAutoresizingMaskIntoConstraints="NO" id="ODe-C6-DGN">
<rect key="frame" x="343" y="9" width="13" height="42"/>
<rect key="frame" x="288" y="9" width="13" height="42"/>
<constraints>
<constraint firstAttribute="width" constant="13" id="0Ui-lP-8GE"/>
<constraint firstAttribute="height" constant="42" id="JJZ-Jq-vcu"/>
......@@ -74,7 +74,7 @@
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6h9-Nv-UNf">
<rect key="frame" x="326" y="64" width="30" height="18"/>
<rect key="frame" x="271" y="64" width="30" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="a3k-ko-Eep"/>
<constraint firstAttribute="height" constant="18" id="cjT-dS-HRZ"/>
......
......@@ -18,13 +18,18 @@
#import "MyTeamViewController.h"
#import "CustomerManagementViewController.h"
#import "InvitePartnerViewController.h"
#import "JavenDetailReseller.h"
#import "JavencommissionAccountModel.h"
#define kHomeCollectionViewID @"HomeCollectionViewID"
#define kCollectionViewHeadHeight 350
@interface HomeCollectionViewController ()<UICollectionViewDataSource, UICollectionViewDelegate,SDCycleScrollViewDelegate>
@property (nonatomic, strong) NSMutableArray *arrImages;
@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, strong) MoneyView *viewMoney;
@property (nonatomic, strong) NSMutableArray *arrImages;
@property (nonatomic, strong) JavenDetailReseller *reseller;
@property (nonatomic, strong) JavencommissionAccountModel *accountModel;
@end
@implementation HomeCollectionViewController
......@@ -64,6 +69,7 @@
//中间的收入
MoneyView *viewMoney = [MoneyView viewWithNibName:@"MoneyView"];
self.viewMoney = viewMoney;
viewMoney.frame = CGRectMake(0, 0 - kCollectionViewHeadHeight, ScreenSize.width, 340);
[self.collectionView addSubview:viewMoney];
......@@ -97,6 +103,28 @@
// Do any additional setup after loading the view.
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
WS(weakSelf)
NSString *strGetResseller = [NSString stringWithFormat:@"commission/getAccount/%@", [UserInfo shareInstance].uuid];
[[HTTPCilent shareCilent] GET:strGetResseller parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
if ([responseObject[@"code"] isEqualToNumber:@0]) {
weakSelf.accountModel = [JavencommissionAccountModel modelObjectWithDictionary:responseObject[@"commissionAccount"]];
[weakSelf.viewMoney setMoneyView:weakSelf.accountModel];
}
CLog(@"d");
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (void)setMoneyView {
}
- (void)touchAddAction {
CLog(@"添加商品");
......@@ -166,7 +194,6 @@
StoreManagermentViewController *storeVC = [[StoreManagermentViewController alloc] initWithNibName:@"StoreManagermentViewController" bundle:[NSBundle mainBundle]];
storeVC.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:storeVC animated:YES];
}
......
......@@ -43,9 +43,12 @@
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (void)setUpView {
HomeTopView *viewHomeTop = [HomeTopView viewWithNibName:@"HomeTopView"];
self.viewHomeTop = viewHomeTop;
......
......@@ -15,6 +15,7 @@
#import "CommodityManagementViewController.h"
#import "UMSocial.h"
#import "UMSocialWechatHandler.h"
@interface StoreManagermentViewController ()<UINavigationControllerDelegate, UIImagePickerControllerDelegate, UMSocialUIDelegate>
@property (nonatomic, strong) SelectPhotoView *photoView;
@property (nonatomic, strong) CoverShadowView *shadowView;
......@@ -22,9 +23,11 @@
@property (weak, nonatomic) IBOutlet UIButton *buttonBac;
@property (weak, nonatomic) IBOutlet UILabel *labelName;
@property (weak, nonatomic) IBOutlet UILabel *labelDescription;
@property (weak, nonatomic) IBOutlet UIImageView *imgViewIcon;
@property (nonatomic, copy) NSString *urlStr;
@end
@implementation StoreManagermentViewController
......@@ -56,14 +59,23 @@
}
CLog(@"%p",weakSelf.shopModel);
weakSelf.labelName.text = weakSelf.shopModel.name;
weakSelf.labelDescription.text = weakSelf.shopModel.internalBaseClassDescription;
[weakSelf setUpViewWithModel:weakSelf.shopModel];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (void)setUpViewWithModel:(JavenShopModel *)model {
self.labelName.text = self.shopModel.name;
self.labelDescription.text = self.shopModel.internalBaseClassDescription;
[self.imgViewIcon sd_setImageWithURL:[NSURL URLWithString:self.shopModel.pictures] placeholderImage:[UIImage imageNamed:@"default_commodity_placeholder"]];
}
- (SelectPhotoView *)photoView {
if (!_photoView) {
_photoView = [SelectPhotoView viewWithNibName:@"SelectPhotoView"];
......@@ -102,6 +114,7 @@
} else {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
// picker.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
picker.videoQuality = UIImagePickerControllerQualityTypeLow;
......@@ -122,6 +135,60 @@
}
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
//得到图片
UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
MBProgressHUD *hud = [MBProgressHUD Javen_showMessage:@"修改中" onView:self.view];
//上传七牛
[[JavenQNManager shareInstance] upLoadImage:image isMD5Name:YES name:nil commpelete:^(NSString *key) {
NSDictionary *params = [self getParamsWithImageUrl:key];
//上传成功之后把URL传给aland服务器
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"shop/save" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
if ([responseObject[@"code"] isEqualToNumber:@0]) {
[hud hide:YES];
[MBProgressHUD Javen_showSuccess:@"修改成功!" onView:weakSelf.view delay:0.7 complete:^{
[weakSelf setUpdata];
}];
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}];
// 模态返回
[picker dismissViewControllerAnimated:YES completion:nil];
}
//生成上传图片URL的参数
- (NSDictionary *)getParamsWithImageUrl:(NSString *)imageUrl {
self.shopModel.pictures = [NSString stringWithFormat:@"http://7xtefo.com2.z0.glb.qiniucdn.com/%@", imageUrl];
UserInfo *user = [UserInfo shareInstance];
NSDictionary *dicShop = [self.shopModel dictionaryRepresentation];
NSDictionary *params = @{@"operCtx" : @{@"time" : [[NSDate date] timeStampNumber],
@"domain" : user.domain,
@"operator" : @{@"id" : user.uuid,
@"fullName" : user.name}},
@"shop" : dicShop};
return params;
}
/**
* 显示阴影和底部的弹框
......@@ -142,13 +209,14 @@
commodityVC.isShowNavigationBar = YES;
[self.navigationController pushViewController:commodityVC animated:YES];
}
- (IBAction)actionShare:(id)sender {
[[ShareInstance shareInstace] showWithTitle:@"Aland" content:@"快来看看我的小店吧! " url:self.urlStr image:[UIImage imageNamed:@"btn_share_shop"]];
}
//二维码界面
- (IBAction)QRCodeAction:(id)sender {
StoreQRCodeViewController *QRCodeVC = [[StoreQRCodeViewController alloc] initWithNibName:@"StoreQRCodeViewController" bundle:nil];
QRCodeVC.urlStr = self.urlStr;
......
......@@ -10,6 +10,7 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="StoreManagermentViewController">
<connections>
<outlet property="buttonBac" destination="Iih-6D-NVq" id="Qaj-ot-Ynu"/>
<outlet property="imgViewIcon" destination="PBT-3w-ecp" id="Osf-BS-6aw"/>
<outlet property="labelDescription" destination="asy-i8-hFm" id="Zdn-05-Att"/>
<outlet property="labelName" destination="R3l-SJ-mVe" id="N6s-z3-sA1"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
......
......@@ -33,9 +33,6 @@
UserInfo *user = [UserInfo shareInstance];
self.shopModel.name = self.textFieldName.text;
[JavenShopModel mj_setupReplacedKeyFromPropertyName:^NSDictionary *{
return @{@"operatorIdentifier":@"id"};
}];
NSDictionary *dicShop = [self.shopModel dictionaryRepresentation];
NSDictionary *params = @{@"operCtx" : @{@"time" : [[NSDate date] timeStampNumber],
......
......@@ -24,9 +24,7 @@
UserInfo *user = [UserInfo shareInstance];
self.shopModel.internalBaseClassDescription = self.textViewInstroduction.text;
[JavenShopModel mj_setupReplacedKeyFromPropertyName:^NSDictionary *{
return @{@"operatorIdentifier":@"id"};
}];
NSDictionary *dicShop = [self.shopModel dictionaryRepresentation];
NSDictionary *params = @{@"operCtx" : @{@"time" : [[NSDate date] timeStampNumber],
......
......@@ -28,6 +28,7 @@ char *NewBase64Encode(
- (NSString *)base64EncodedString;
- (NSData *)AES256EncryptWithKey:(NSString *)key;
- (NSData *)AES256DecryptWithKey:(NSString *)key;
- (NSString *)md5String;
@end
......
......@@ -423,6 +423,20 @@ static CFStringRef UTTypeForImageData(NSData *data) {
return nil;
}
- (NSString *)md5String {
const char *str = [self bytes];
unsigned char result[CC_MD5_DIGEST_LENGTH];
CC_MD5(str, (CC_LONG)self.length, result);
NSMutableString *hash = [NSMutableString string];
for (int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {
[hash appendFormat:@"%02X", result[i]];
}
return [hash lowercaseString];
}
- (BOOL)isImageType {
CFStringRef imgType = UTTypeForImageData(self);//CoreFoundation里面的CFStringRef和NSString*是可以直接转换的
return imgType ? YES : NO;
......
//
// NSNumber+Fommater.h
// ALand
//
// Created by Z on 16/5/3.
// Copyright © 2016年 Z. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSNumber (Fommater)
@end
//
// NSNumber+Fommater.m
// ALand
//
// Created by Z on 16/5/3.
// Copyright © 2016年 Z. All rights reserved.
//
#import "NSNumber+Fommater.h"
@implementation NSNumber (Fommater)
@end
......@@ -7,6 +7,7 @@
//
#import "NSString+Category.h"
#import <CommonCrypto/CommonDigest.h>
@implementation NSString (Category)
+ (NSString *)randomTestText {
......@@ -20,4 +21,6 @@
return result;
}
@end
//
// JavenQNManager.h
// ALand
//
// Created by Z on 16/5/3.
// Copyright © 2016年 Z. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JavenQNManager : NSObject
+ (instancetype)shareInstance;
- (void)upLoadImage:(UIImage *)image isMD5Name:(BOOL)isMD5Name name:(NSString *)imageName commpelete:(void(^)(NSString *key))commpelete;
@end
//
// JavenQNManager.m
// ALand
//
// Created by Z on 16/5/3.
// Copyright © 2016年 Z. All rights reserved.
//
#import "JavenQNManager.h"
#import <QiniuSDK.h>
#import "GTM_Base64.h"
#include <CommonCrypto/CommonCrypto.h>
#import "NSData+EncodeAdditions.h"
@interface JavenQNManager ()
@property (nonatomic, strong) QNUploadManager *upManager;
@property (nonatomic, strong) QNUploadOption *option;
@property (nonatomic, copy) NSString *token;
@end
@implementation JavenQNManager
+ (instancetype)shareInstance {
static JavenQNManager *manager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
manager = [[JavenQNManager alloc] init];
NSString *AK =@"mRX5pK-bCChgNMxeiC_VlRgSFLuz_WbLT3OyViuh";
NSString *SK = @"m8XQ8FjLiUY38pgDUzjHApdJ4YpgdlpmRT6FAwAg";
manager.token = [manager makeToken:AK secretKey:SK];
manager.option = [[QNUploadOption alloc] initWithMime:@"image/jpeg" progressHandler:nil params:nil checkCrc:NO cancellationSignal:nil];
manager.upManager =[[QNUploadManager alloc]init];
});
return manager;
}
- (void)upLoadImage:(UIImage *)image isMD5Name:(BOOL)isMD5Name name:(NSString *)imageName commpelete:(void(^)(NSString *key))commpelete {
NSData *data = UIImageJPEGRepresentation(image, 0.5);
NSString *name;
if (isMD5Name) {
name = [NSString stringWithFormat:@"%@.jpg", [data md5String]];
}else{
name = imageName;
}
[self.upManager putData:data key:name token:self.token
complete: ^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
NSLog(@"info = %@\n", info);
NSLog(@"key = %@\n",key);
NSLog(@"resp = %@\n", resp);
commpelete(key);
} option:self.option];
}
- (NSString *)makeToken:(NSString *)accessKey secretKey:(NSString *)secretKey
{
const char *secretKeyStr = [secretKey UTF8String];
NSString *policy = [self marshal];
NSData *policyData = [policy dataUsingEncoding:NSUTF8StringEncoding];
NSString *encodedPolicy = [GTM_Base64 stringByWebSafeEncodingData:policyData padded:TRUE];
const char *encodedPolicyStr = [encodedPolicy cStringUsingEncoding:NSUTF8StringEncoding];
char digestStr[CC_SHA1_DIGEST_LENGTH];
bzero(digestStr, 0);
CCHmac(kCCHmacAlgSHA1, secretKeyStr, strlen(secretKeyStr), encodedPolicyStr, strlen(encodedPolicyStr), digestStr);
NSString *encodedDigest = [GTM_Base64 stringByWebSafeEncodingBytes:digestStr length:CC_SHA1_DIGEST_LENGTH padded:TRUE];
NSString *token = [NSString stringWithFormat:@"%@:%@:%@", accessKey, encodedDigest, encodedPolicy];
return token;//得到了token
}
- (NSString *)marshal
{
time_t deadline;
time(&deadline);//返回当前系统时间
//@property (nonatomic , assign) int expires; 怎么定义随你...
deadline += 3600; // +3600秒,即默认token保存1小时.
NSNumber *deadlineNumber = [NSNumber numberWithLongLong:deadline];
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
//users是我开辟的公共空间名(即bucket),aaa是文件的key,
//按七牛“上传策略”的描述: <bucket>:<key>,表示只允许用户上传指定key的文件。在这种格式下文件默认允许“修改”,若已存在同名资源则会被覆盖。如果只希望上传指定key的文件,并且不允许修改,那么可以将下面的 insertOnly 属性值设为 1。
//所以如果参数只传users的话,下次上传key还是aaa的文件会提示存在同名文件,不能上传。
//传users:aaa的话,可以覆盖更新,但实测延迟较长,我上传同名新文件上去,下载下来的还是老文件。
[dic setObject:@"aland" forKey:@"scope"];//根据
[dic setObject:deadlineNumber forKey:@"deadline"];
NSString *json = [dic mj_JSONString];
return json;
}
@end
//
// JavenCertificate.h
//
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JavenCertificate : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) BOOL idValidated;
@property (nonatomic, strong) NSArray *bankCards;
@property (nonatomic, assign) id trueName;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// JavenCertificate.m
//
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "JavenCertificate.h"
NSString *const kJavenCertificateIdValidated = @"idValidated";
NSString *const kJavenCertificateBankCards = @"bankCards";
NSString *const kJavenCertificateTrueName = @"trueName";
@interface JavenCertificate ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation JavenCertificate
@synthesize idValidated = _idValidated;
@synthesize bankCards = _bankCards;
@synthesize trueName = _trueName;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.idValidated = [[self objectOrNilForKey:kJavenCertificateIdValidated fromDictionary:dict] boolValue];
self.bankCards = [self objectOrNilForKey:kJavenCertificateBankCards fromDictionary:dict];
self.trueName = [self objectOrNilForKey:kJavenCertificateTrueName fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[NSNumber numberWithBool:self.idValidated] forKey:kJavenCertificateIdValidated];
NSMutableArray *tempArrayForBankCards = [NSMutableArray array];
for (NSObject *subArrayObject in self.bankCards) {
if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
// This class is a model object
[tempArrayForBankCards addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
} else {
// Generic object
[tempArrayForBankCards addObject:subArrayObject];
}
}
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForBankCards] forKey:kJavenCertificateBankCards];
[mutableDict setValue:self.trueName forKey:kJavenCertificateTrueName];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.idValidated = [aDecoder decodeBoolForKey:kJavenCertificateIdValidated];
self.bankCards = [aDecoder decodeObjectForKey:kJavenCertificateBankCards];
self.trueName = [aDecoder decodeObjectForKey:kJavenCertificateTrueName];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeBool:_idValidated forKey:kJavenCertificateIdValidated];
[aCoder encodeObject:_bankCards forKey:kJavenCertificateBankCards];
[aCoder encodeObject:_trueName forKey:kJavenCertificateTrueName];
}
- (id)copyWithZone:(NSZone *)zone
{
JavenCertificate *copy = [[JavenCertificate alloc] init];
if (copy) {
copy.idValidated = self.idValidated;
copy.bankCards = [self.bankCards copyWithZone:zone];
copy.trueName = [self.trueName copyWithZone:zone];
}
return copy;
}
@end
//
// JavenCreateInfo.h
//
// Created by Z on 16/4/12
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
......@@ -12,7 +12,7 @@
@interface JavenCreateInfo : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) JavenOperator *operator;
@property (nonatomic, assign) double time;
@property (nonatomic, strong) NSString *time;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
......
//
// JavenCreateInfo.m
//
// Created by Z on 16/4/12
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
......@@ -38,7 +38,7 @@ NSString *const kJavenCreateInfoTime = @"time";
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.operator = [JavenOperator modelObjectWithDictionary:[dict objectForKey:kJavenCreateInfoOperator]];
self.time = [[self objectOrNilForKey:kJavenCreateInfoTime fromDictionary:dict] doubleValue];
self.time = [self objectOrNilForKey:kJavenCreateInfoTime fromDictionary:dict];
}
......@@ -50,7 +50,7 @@ NSString *const kJavenCreateInfoTime = @"time";
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[self.operator dictionaryRepresentation] forKey:kJavenCreateInfoOperator];
[mutableDict setValue:[NSNumber numberWithDouble:self.time] forKey:kJavenCreateInfoTime];
[mutableDict setValue:self.time forKey:kJavenCreateInfoTime];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
......@@ -75,7 +75,7 @@ NSString *const kJavenCreateInfoTime = @"time";
self = [super init];
self.operator = [aDecoder decodeObjectForKey:kJavenCreateInfoOperator];
self.time = [aDecoder decodeDoubleForKey:kJavenCreateInfoTime];
self.time = [aDecoder decodeObjectForKey:kJavenCreateInfoTime];
return self;
}
......@@ -83,7 +83,7 @@ NSString *const kJavenCreateInfoTime = @"time";
{
[aCoder encodeObject:_operator forKey:kJavenCreateInfoOperator];
[aCoder encodeDouble:_time forKey:kJavenCreateInfoTime];
[aCoder encodeObject:_time forKey:kJavenCreateInfoTime];
}
- (id)copyWithZone:(NSZone *)zone
......@@ -93,7 +93,7 @@ NSString *const kJavenCreateInfoTime = @"time";
if (copy) {
copy.operator = [self.operator copyWithZone:zone];
copy.time = self.time;
copy.time = [self.time copyWithZone:zone];
}
return copy;
......
//
// JavenIdCard.h
//
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JavenIdCard : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *idType;
@property (nonatomic, assign) id idNum;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// JavenIdCard.m
//
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "JavenIdCard.h"
NSString *const kJavenIdCardIdType = @"idType";
NSString *const kJavenIdCardIdNum = @"idNum";
@interface JavenIdCard ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation JavenIdCard
@synthesize idType = _idType;
@synthesize idNum = _idNum;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.idType = [self objectOrNilForKey:kJavenIdCardIdType fromDictionary:dict];
self.idNum = [self objectOrNilForKey:kJavenIdCardIdNum fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.idType forKey:kJavenIdCardIdType];
[mutableDict setValue:self.idNum forKey:kJavenIdCardIdNum];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.idType = [aDecoder decodeObjectForKey:kJavenIdCardIdType];
self.idNum = [aDecoder decodeObjectForKey:kJavenIdCardIdNum];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_idType forKey:kJavenIdCardIdType];
[aCoder encodeObject:_idNum forKey:kJavenIdCardIdNum];
}
- (id)copyWithZone:(NSZone *)zone
{
JavenIdCard *copy = [[JavenIdCard alloc] init];
if (copy) {
copy.idType = [self.idType copyWithZone:zone];
copy.idNum = [self.idNum copyWithZone:zone];
}
return copy;
}
@end
//
// JavenLastModifyInfo.h
//
// Created by Z on 16/4/12
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
......@@ -12,7 +12,7 @@
@interface JavenLastModifyInfo : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) JavenOperator *operator;
@property (nonatomic, assign) double time;
@property (nonatomic, strong) NSString *time;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
......
//
// JavenLastModifyInfo.m
//
// Created by Z on 16/4/12
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
......@@ -38,7 +38,7 @@ NSString *const kJavenLastModifyInfoTime = @"time";
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.operator = [JavenOperator modelObjectWithDictionary:[dict objectForKey:kJavenLastModifyInfoOperator]];
self.time = [[self objectOrNilForKey:kJavenLastModifyInfoTime fromDictionary:dict] doubleValue];
self.time = [self objectOrNilForKey:kJavenLastModifyInfoTime fromDictionary:dict];
}
......@@ -50,7 +50,7 @@ NSString *const kJavenLastModifyInfoTime = @"time";
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[self.operator dictionaryRepresentation] forKey:kJavenLastModifyInfoOperator];
[mutableDict setValue:[NSNumber numberWithDouble:self.time] forKey:kJavenLastModifyInfoTime];
[mutableDict setValue:self.time forKey:kJavenLastModifyInfoTime];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
......@@ -75,7 +75,7 @@ NSString *const kJavenLastModifyInfoTime = @"time";
self = [super init];
self.operator = [aDecoder decodeObjectForKey:kJavenLastModifyInfoOperator];
self.time = [aDecoder decodeDoubleForKey:kJavenLastModifyInfoTime];
self.time = [aDecoder decodeObjectForKey:kJavenLastModifyInfoTime];
return self;
}
......@@ -83,7 +83,7 @@ NSString *const kJavenLastModifyInfoTime = @"time";
{
[aCoder encodeObject:_operator forKey:kJavenLastModifyInfoOperator];
[aCoder encodeDouble:_time forKey:kJavenLastModifyInfoTime];
[aCoder encodeObject:_time forKey:kJavenLastModifyInfoTime];
}
- (id)copyWithZone:(NSZone *)zone
......@@ -93,7 +93,7 @@ NSString *const kJavenLastModifyInfoTime = @"time";
if (copy) {
copy.operator = [self.operator copyWithZone:zone];
copy.time = self.time;
copy.time = [self.time copyWithZone:zone];
}
return copy;
......
//
// JavenLoginControl.h
//
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JavenLoginControl : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *loginIp;
@property (nonatomic, strong) NSString *loginTime;
@property (nonatomic, assign) double failedTimes;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// JavenLoginControl.m
//
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "JavenLoginControl.h"
NSString *const kJavenLoginControlLoginIp = @"loginIp";
NSString *const kJavenLoginControlLoginTime = @"loginTime";
NSString *const kJavenLoginControlFailedTimes = @"failedTimes";
@interface JavenLoginControl ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation JavenLoginControl
@synthesize loginIp = _loginIp;
@synthesize loginTime = _loginTime;
@synthesize failedTimes = _failedTimes;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.loginIp = [self objectOrNilForKey:kJavenLoginControlLoginIp fromDictionary:dict];
self.loginTime = [self objectOrNilForKey:kJavenLoginControlLoginTime fromDictionary:dict];
self.failedTimes = [[self objectOrNilForKey:kJavenLoginControlFailedTimes fromDictionary:dict] doubleValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.loginIp forKey:kJavenLoginControlLoginIp];
[mutableDict setValue:self.loginTime forKey:kJavenLoginControlLoginTime];
[mutableDict setValue:[NSNumber numberWithDouble:self.failedTimes] forKey:kJavenLoginControlFailedTimes];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.loginIp = [aDecoder decodeObjectForKey:kJavenLoginControlLoginIp];
self.loginTime = [aDecoder decodeObjectForKey:kJavenLoginControlLoginTime];
self.failedTimes = [aDecoder decodeDoubleForKey:kJavenLoginControlFailedTimes];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_loginIp forKey:kJavenLoginControlLoginIp];
[aCoder encodeObject:_loginTime forKey:kJavenLoginControlLoginTime];
[aCoder encodeDouble:_failedTimes forKey:kJavenLoginControlFailedTimes];
}
- (id)copyWithZone:(NSZone *)zone
{
JavenLoginControl *copy = [[JavenLoginControl alloc] init];
if (copy) {
copy.loginIp = [self.loginIp copyWithZone:zone];
copy.loginTime = [self.loginTime copyWithZone:zone];
copy.failedTimes = self.failedTimes;
}
return copy;
}
@end
//
// JavenOwnerOrg.h
//
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JavenOwnerOrg : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) NSString *code;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// JavenOwnerOrg.m
//
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "JavenOwnerOrg.h"
NSString *const kJavenOwnerOrgName = @"name";
NSString *const kJavenOwnerOrgUuid = @"uuid";
NSString *const kJavenOwnerOrgCode = @"code";
@interface JavenOwnerOrg ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation JavenOwnerOrg
@synthesize name = _name;
@synthesize uuid = _uuid;
@synthesize code = _code;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.name = [self objectOrNilForKey:kJavenOwnerOrgName fromDictionary:dict];
self.uuid = [self objectOrNilForKey:kJavenOwnerOrgUuid fromDictionary:dict];
self.code = [self objectOrNilForKey:kJavenOwnerOrgCode fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.name forKey:kJavenOwnerOrgName];
[mutableDict setValue:self.uuid forKey:kJavenOwnerOrgUuid];
[mutableDict setValue:self.code forKey:kJavenOwnerOrgCode];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.name = [aDecoder decodeObjectForKey:kJavenOwnerOrgName];
self.uuid = [aDecoder decodeObjectForKey:kJavenOwnerOrgUuid];
self.code = [aDecoder decodeObjectForKey:kJavenOwnerOrgCode];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_name forKey:kJavenOwnerOrgName];
[aCoder encodeObject:_uuid forKey:kJavenOwnerOrgUuid];
[aCoder encodeObject:_code forKey:kJavenOwnerOrgCode];
}
- (id)copyWithZone:(NSZone *)zone
{
JavenOwnerOrg *copy = [[JavenOwnerOrg alloc] init];
if (copy) {
copy.name = [self.name copyWithZone:zone];
copy.uuid = [self.uuid copyWithZone:zone];
copy.code = [self.code copyWithZone:zone];
}
return copy;
}
@end
//
// JavenPasswordControl.h
//
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JavenPasswordControl : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *created;
@property (nonatomic, assign) id initPassword;
@property (nonatomic, assign) id expiry;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// JavenPasswordControl.m
//
// Created by Z on 16/5/3
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "JavenPasswordControl.h"
NSString *const kJavenPasswordControlCreated = @"created";
NSString *const kJavenPasswordControlInitPassword = @"initPassword";
NSString *const kJavenPasswordControlExpiry = @"expiry";
@interface JavenPasswordControl ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation JavenPasswordControl
@synthesize created = _created;
@synthesize initPassword = _initPassword;
@synthesize expiry = _expiry;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.created = [self objectOrNilForKey:kJavenPasswordControlCreated fromDictionary:dict];
self.initPassword = [self objectOrNilForKey:kJavenPasswordControlInitPassword fromDictionary:dict];
self.expiry = [self objectOrNilForKey:kJavenPasswordControlExpiry fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.created forKey:kJavenPasswordControlCreated];
[mutableDict setValue:self.initPassword forKey:kJavenPasswordControlInitPassword];
[mutableDict setValue:self.expiry forKey:kJavenPasswordControlExpiry];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.created = [aDecoder decodeObjectForKey:kJavenPasswordControlCreated];
self.initPassword = [aDecoder decodeObjectForKey:kJavenPasswordControlInitPassword];
self.expiry = [aDecoder decodeObjectForKey:kJavenPasswordControlExpiry];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_created forKey:kJavenPasswordControlCreated];
[aCoder encodeObject:_initPassword forKey:kJavenPasswordControlInitPassword];
[aCoder encodeObject:_expiry forKey:kJavenPasswordControlExpiry];
}
- (id)copyWithZone:(NSZone *)zone
{
JavenPasswordControl *copy = [[JavenPasswordControl alloc] init];
if (copy) {
copy.created = [self.created copyWithZone:zone];
copy.initPassword = [self.initPassword copyWithZone:zone];
copy.expiry = [self.expiry copyWithZone:zone];
}
return copy;
}
@end
......@@ -12,9 +12,9 @@
@interface JavenReseller : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *mobilephone;
@property (nonatomic, assign) id code;
@property (nonatomic, strong) NSString *code;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, assign) id portrait;
@property (nonatomic, strong) id portrait;
@property (nonatomic, strong) NSString *uuid;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
......
......@@ -17,6 +17,10 @@
#import "UIButton+Category.h"
#import "HTTPCilent.h"
#import "MJExtension.h"
#import "MBProgressHUD+Javen.h"
#import "ShareInstance.h"
#import "JavenCategory.h"
#import "NSNumber+Fommater.h"
#import "MBProgressHUD+Javen.h"
#import "JavenQNManager.h"
#endif /* IMPHeader_h */
......@@ -9,4 +9,4 @@ pod 'SDCycleScrollView', '~> 1.61'
pod 'AFNetworking', '~> 3.0.4'
pod 'MJExtension', '~> 3.0.10'
pod 'UMengSocial', '~> 5.0'
pod "Qiniu", :git => 'https://github.com/qiniu/objc-sdk.git', :branch => 'AFNetworking-3.x'
\ No newline at end of file
......@@ -17,9 +17,13 @@ PODS:
- FMDB (2.6):
- FMDB/standard (= 2.6)
- FMDB/standard (2.6)
- HappyDNS (0.2.3)
- IQKeyboardManager (4.0.0)
- MBProgressHUD (0.9.2)
- MJExtension (3.0.10)
- Qiniu (7.0.16):
- AFNetworking (~> 3)
- HappyDNS (~> 0.2)
- SDAutoLayout (1.31)
- SDCycleScrollView (1.61):
- SDWebImage (~> 3.7)
......@@ -35,18 +39,31 @@ DEPENDENCIES:
- IQKeyboardManager (~> 4.0.0)
- MBProgressHUD (~> 0.9.2)
- MJExtension (~> 3.0.10)
- Qiniu (from `https://github.com/qiniu/objc-sdk.git`, branch `AFNetworking-3.x`)
- SDAutoLayout (~> 1.31)
- SDCycleScrollView (~> 1.61)
- SDWebImage (~> 3.7.5)
- SSKeychain (~> 1.3.1)
- UMengSocial (~> 5.0)
EXTERNAL SOURCES:
Qiniu:
:branch: AFNetworking-3.x
:git: https://github.com/qiniu/objc-sdk.git
CHECKOUT OPTIONS:
Qiniu:
:commit: 11dd18609a257488c65a08e572288d33eefb46b1
:git: https://github.com/qiniu/objc-sdk.git
SPEC CHECKSUMS:
AFNetworking: a0075feb321559dc78d9d85b55d11caa19eabb93
FMDB: c1968bab3ab0aed38f66cb778ae1e7fa9a652b6e
HappyDNS: 6d85942e64c28b4fa61f8c76580398f52d6d1d11
IQKeyboardManager: b91928f7927ba55a5829b4dcf4b7a6736ac9fc22
MBProgressHUD: 1569cf7ace17a8bac47aabfbb8580a49690386d1
MJExtension: d86aacb740c87519d20e3cca55b6fa4be6cc7548
Qiniu: 340bc55a6478d89591754aa7d1fd8b5977863991
SDAutoLayout: 79b8977f863ba4722bb8f8f6f92981d0b8ae932a
SDCycleScrollView: a002d85b30cfa9d0ac74069cd3973ca19ff4f22f
SDWebImage: 69c6303e3348fba97e03f65d65d4fbc26740f461
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment