Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ios1x
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
ios1x
Commits
4141588f
Commit
4141588f
authored
Jul 21, 2017
by
lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
u filter small pic
parent
373bf31a
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
74 additions
and
3 deletions
+74
-3
KWMAPIManager.h
iCemarose/Class/Api/KWMAPIManager.h
+4
-0
KWMAPIManager.m
iCemarose/Class/Api/KWMAPIManager.m
+15
-0
BUYClient+FilterSoldout.m
iCemarose/Class/Classify/BUYClient+FilterSoldout.m
+4
-0
KWMUserDao.h
iCemarose/Class/Model/DAO/KWMUserDao.h
+7
-2
KWMUserDao.m
iCemarose/Class/Model/DAO/KWMUserDao.m
+40
-0
KWMMainVC.m
iCemarose/Class/UI/KWMMainVC.m
+1
-0
KWMNewHomeVC.m
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
+1
-0
KWMSelectedGoodsVC.m
iCemarose/Class/UI/Product/KWMSelectedGoodsVC.m
+1
-0
Info.plist
iCemarose/Info.plist
+1
-1
No files found.
iCemarose/Class/Api/KWMAPIManager.h
View file @
4141588f
...
...
@@ -37,6 +37,7 @@
#import "KWMOrderPaid.h"
#import "KWMWish.h"
#import "KWMHomeDataResult.h"
#import "KWMDictionaryResult.h"
...
...
@@ -59,6 +60,9 @@
+
(
KWMAPIManager
*
)
sharedManager
;
-
(
NSString
*
)
toAbsoluteUrl
:(
NSString
*
)
relativeUrl
;
-
(
NSURLSessionDataTask
*
)
adminUserSuccess
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
KWMDictionaryResult
*
result
))
success
failure
:(
void
(
^
)(
NSURLSessionDataTask
*
task
,
NSError
*
error
))
failure
;
/**
* 手机登录-获取短信API
* @param parameters {mobile=?手机号}
...
...
iCemarose/Class/Api/KWMAPIManager.m
View file @
4141588f
...
...
@@ -387,6 +387,21 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
}
}
-
(
NSURLSessionDataTask
*
)
adminUserSuccess
:
(
void
(
^
)(
NSURLSessionDataTask
*
,
KWMDictionaryResult
*
))
success
failure
:
(
void
(
^
)(
NSURLSessionDataTask
*
,
NSError
*
))
failure
{
NSNumber
*
customerId
=
[[[
KWMUserDao
shareDao
]
customer
]
identifier
];
if
(
!
customerId
)
{
return
nil
;
}
NSString
*
apiPath
=
[[
NSString
alloc
]
initWithFormat
:
@"https://%@/admin/customers/%@.json"
,
Shopify_SHOP_DOMAIN
,
customerId
];
return
[
self
startSessionTask
:
KWMHTTPMethodGET
apiPath
:
apiPath
parameters
:
nil
result
:
[
KWMDictionaryResult
class
]
model
:
nil
success
:
success
failure
:
failure
];
}
-
(
void
)
loginWebSuccess
:
(
void
(
^
)())
success
failure
:
(
void
(
^
)(
NSError
*
))
failure
{
KWMUserModel
*
user
=
[
KWMUserModel
shareUser
];
NSString
*
account
=
user
.
email
;
...
...
iCemarose/Class/Classify/BUYClient+FilterSoldout.m
View file @
4141588f
...
...
@@ -10,6 +10,7 @@
#import <Aspects/Aspects.h>
#import <RXCollections/RXCollection.h>
#import <Mobile-Buy-SDK/Buy/BUYProduct.h>
#import "KWMUserDao.h"
@implementation
BUYClient
(
FilterSoldout
)
...
...
@@ -18,6 +19,9 @@
NSInvocation
*
invocation
=
info
.
originalInvocation
;
id
completion
=
^
(
NSArray
<
BUYProduct
*>
*
_Nullable
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
_Nullable
error
){
NSArray
*
ps
=
[
products
rx_filterWithBlock
:
^
BOOL
(
BUYProduct
*
each
)
{
if
([
each
.
tags
containsObject
:
@"small pic"
])
{
return
[[[[
KWMUserDao
shareDao
]
customer
]
tags
]
containsString
:
@"Business"
]
||
[[[
KWMUserDao
shareDao
]
tags
]
containsObject
:
@"Staff"
];
}
return
each
.
availableValue
;
}];
block
(
ps
,
page
,
reachedEnd
,
error
);
...
...
iCemarose/Class/Model/DAO/KWMUserDao.h
View file @
4141588f
...
...
@@ -10,6 +10,8 @@
#import <Buy/Buy.h>
#import "KWMCustomsClearance.h"
#import <Mobile-Buy-SDK/Buy/BUYCustomer.h>
@class
KWMUser
;
@class
KWMRequestResult
;
...
...
@@ -23,16 +25,19 @@
@property
(
nonatomic
,
strong
)
KWMCustomsClearance
*
customsClearance
;
@property
(
nonatomic
,
strong
)
BUYCustomer
*
customer
;
@property
(
nonatomic
,
strong
)
NSArray
*
tags
;
+
(
KWMUserDao
*
)
shareDao
;
-
(
BOOL
)
checkSession
;
-
(
KWMUser
*
)
loginUser
;
-
(
BOOL
)
isLogin
;
-
(
void
)
logout
;
-
(
void
)
saveUser
:(
KWMUser
*
)
user
;
-
(
void
)
saveExchangeRate
:(
NSNumber
*
)
exchangeRate
;
-
(
NSDecimalNumber
*
)
exchangeRate
;
-
(
void
)
requestTags
;
-
(
void
(
^
)(
NSURLSessionDataTask
*
,
KWMRequestResult
*
))
getLoginSuccessCallback
:(
void
(
^
)(
NSURLSessionDataTask
*
,
KWMRequestResult
*
))
callback
;
...
...
iCemarose/Class/Model/DAO/KWMUserDao.m
View file @
4141588f
...
...
@@ -15,6 +15,7 @@
//#import "JPUSHService.h"
#import "PSPDFAlertView.h"
#import "KWMStringUtil.h"
//#import <Mobile-Buy-SDK/Buy/BUYClient.h>
#define SESSID @"PHPSESSID"
static
NSString
*
kwmKeySessionId
=
@"sessionId"
;
...
...
@@ -26,6 +27,7 @@ static NSString *kwmKeySavedAccountPassword = @"savedAccountPassword";
@interface
KWMUserDao
()
@property
(
nonatomic
,
strong
)
BUYClient
*
client
;
@end
...
...
@@ -45,6 +47,7 @@ static NSString *kwmKeySavedAccountPassword = @"savedAccountPassword";
@synthesize
customsClearance
=
_customsClearance
;
@synthesize
currencyCode
=
_currencyCode
;
+
(
KWMUserDao
*
)
shareDao
{
static
KWMUserDao
*
_userDao
=
nil
;
static
dispatch_once_t
oncePredicate
;
...
...
@@ -165,6 +168,43 @@ static NSString *kwmKeySavedAccountPassword = @"savedAccountPassword";
[
defaults
removeObjectForKey
:
kwmKeyUser
];
}
-
(
BUYClient
*
)
client
{
if
(
_client
==
nil
){
_client
=
[[
BUYClient
alloc
]
initWithShopDomain
:
Shopify_SHOP_DOMAIN
apiKey
:
Shopify_API_KEY
appId
:
Shopify_APP_ID
];
}
_client
.
pageSize
=
20
;
NSDictionary
*
tokenDic
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"token"
];
NSString
*
path
=
NSHomeDirectory
();
//主目录
NSLog
(
@"NSHomeDirectory:%@"
,
path
);
if
(
tokenDic
!=
nil
)
{
BUYCustomerToken
*
token
=
[
BUYCustomerToken
customerTokenWithJSONDictionary
:[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"token"
]];
if
(
token
!=
nil
)
{
_client
.
customerToken
=
token
;
}
}
return
_client
;
}
-
(
BUYCustomer
*
)
customer
{
if
(
!
_customer
)
{
NSDictionary
*
customerDict
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"customer"
];
_customer
=
[[
BUYCustomer
alloc
]
initWithModelManager
:
self
.
client
.
modelManager
JSONDictionary
:
customerDict
];
}
return
_customer
;
}
-
(
void
)
requestTags
{
[[
KWMAPIManager
sharedManager
]
adminUserSuccess
:
^
(
NSURLSessionDataTask
*
task
,
KWMDictionaryResult
*
result
)
{
NSString
*
tags
=
result
.
data
[
@"customer"
][
@"tags"
];
self
.
tags
=
[
tags
componentsSeparatedByString
:
@", "
];
}
failure
:
^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
NSLog
(
@"%@"
,
error
);
}];
}
-
(
NSDictionary
*
)
checkOutCache
{
NSString
*
filePath
=
[
self
getCheckoutCachePath
];
// 解档
...
...
iCemarose/Class/UI/KWMMainVC.m
View file @
4141588f
...
...
@@ -52,6 +52,7 @@
[
defaults
synchronize
];
}
[[
KWMAPIManager
sharedManager
]
loginWebSuccess
:
nil
failure
:
nil
];
[[
KWMUserDao
shareDao
]
requestTags
];
}
-
(
void
)
initSplash
{
...
...
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
View file @
4141588f
...
...
@@ -87,6 +87,7 @@ typedef enum{
self
.
titleView
.
count
=
count
;
[
self
.
titleView
resumeView
];
}
}
-
(
void
)
viewDidDisappear
:
(
BOOL
)
animated
{
...
...
iCemarose/Class/UI/Product/KWMSelectedGoodsVC.m
View file @
4141588f
...
...
@@ -225,6 +225,7 @@ static NSString *idStr = @"KWMBrandCaramelCell";
[
tableView
registerNib
:[
UINib
nibWithNibName
:
idStr
bundle
:
nil
]
forCellReuseIdentifier
:
idStr
];
brandCaramelCell
=
[
tableView
dequeueReusableCellWithIdentifier
:
idStr
];
}
brandCaramelCell
.
isShowBrandTitle
=
YES
;
brandCaramelCell
.
delegate
=
self
;
brandCaramelCell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
NSInteger
position
=
indexPath
.
row
*
2
;
...
...
iCemarose/Info.plist
View file @
4141588f
...
...
@@ -56,7 +56,7 @@
<
/
d
i
c
t
>
<
/
a
rr
a
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
201707211
1
<
/string
>
<
string
>
201707211
6
<
/string
>
<
k
e
y
>
ITSAppUsesNonExemptEncryption
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
LSApplicationQueriesSchemes
<
/k
e
y
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment