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
38be4224
Commit
38be4224
authored
Dec 19, 2017
by
houweibin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
换成商品列表的admin api,以获取完整的BuyProduct数据
parent
bb7f62fa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
11 deletions
+17
-11
KWMBrandCaramelVC.m
iCemarose/Class/UI/Brand/KWMBrandCaramelVC.m
+1
-1
KWMNewProductVC.m
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
+14
-10
Header-Prefix.h
iCemarose/Header-Prefix.h
+2
-0
No files found.
iCemarose/Class/UI/Brand/KWMBrandCaramelVC.m
View file @
38be4224
...
@@ -404,7 +404,7 @@ static NSString *idStr = @"KWMBrandCaramelCell";
...
@@ -404,7 +404,7 @@ static NSString *idStr = @"KWMBrandCaramelCell";
//初始化排序及筛选tag
//初始化排序及筛选tag
NSString
*
apiPath
=
[[
NSString
alloc
]
initWithFormat
:
@"https://%@/admin/product_listings.json"
,
Shopify_SHOP_DOMAIN
];
NSString
*
apiPath
=
[[
NSString
alloc
]
initWithFormat
:
@"https://%@/admin/product_listings.json"
,
Shopify_SHOP_DOMAIN
];
AFHTTPSessionManager
*
sessionManager
=
[
AFHTTPSessionManager
manager
];
AFHTTPSessionManager
*
sessionManager
=
[
AFHTTPSessionManager
manager
];
[
sessionManager
.
requestSerializer
setValue
:
@"Basic YWRlMDgzZGU2YWJjYjljYjk0ODY5NDg1ZWUwZGQyNmE6MWYyYzVlM2I4N2YyZGJlMTkwZGEzMzU4NmMyMmY3YzQ="
forHTTPHeaderField
:
@"Authorization"
];
[
sessionManager
.
requestSerializer
setValue
:
Moncler_Vendor_Auth
forHTTPHeaderField
:
@"Authorization"
];
[
sessionManager
GET
:
apiPath
parameters
:
parameters
progress
:
nil
success
:^
(
NSURLSessionDataTask
*
_Nonnull
task
,
id
_Nullable
responseObject
)
{
[
sessionManager
GET
:
apiPath
parameters
:
parameters
progress
:
nil
success
:^
(
NSURLSessionDataTask
*
_Nonnull
task
,
id
_Nullable
responseObject
)
{
NSArray
*
result
=
nil
;
NSArray
*
result
=
nil
;
[
weakSelf
hideLoading
];
[
weakSelf
hideLoading
];
...
...
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
View file @
38be4224
...
@@ -118,7 +118,6 @@
...
@@ -118,7 +118,6 @@
NSString
*
productVendor
=
self
.
vendor
?
[
self
.
vendor
lowercaseString
]
:
@""
;
NSString
*
productVendor
=
self
.
vendor
?
[
self
.
vendor
lowercaseString
]
:
@""
;
BOOL
isMoncler
=
[
productVendor
isEqualToString
:
@"moncler"
];
BOOL
isMoncler
=
[
productVendor
isEqualToString
:
@"moncler"
];
if
(
isMoncler
&&
self
.
productId
){
if
(
isMoncler
&&
self
.
productId
){
//这个api获取的商品只能用于展示,不能出售,商品詳情的admin api与商品列表的admin api字段不同,转化为BuyProduct后,一些字段可能是缺失的。
[
self
requestAdminProductDetail
];
[
self
requestAdminProductDetail
];
}
else
{
}
else
{
[
self
requestProductDetail
];
[
self
requestProductDetail
];
...
@@ -543,7 +542,6 @@
...
@@ -543,7 +542,6 @@
}
}
}
}
//这个api获取的商品只能用于展示,不能出售,商品詳情的admin api与商品列表的admin api字段不同,转化为BuyProduct后,一些字段可能是缺失的。
-
(
void
)
requestAdminProductDetail
{
-
(
void
)
requestAdminProductDetail
{
NSNumber
*
productId
=
self
.
product
?
self
.
product
.
identifier
:
self
.
productId
;
NSNumber
*
productId
=
self
.
product
?
self
.
product
.
identifier
:
self
.
productId
;
if
(
!
productId
){
if
(
!
productId
){
...
@@ -552,18 +550,24 @@
...
@@ -552,18 +550,24 @@
[
self
showLoading
];
[
self
showLoading
];
__weak
KWMNewProductVC
*
weakSelf
=
self
;
__weak
KWMNewProductVC
*
weakSelf
=
self
;
NSString
*
apiPath
=
[[
NSString
alloc
]
initWithFormat
:
@"https://%@/admin/product
s/%@.json"
,
Shopify_SHOP_DOMAIN
,
productId
.
stringValue
];
NSString
*
apiPath
=
[[
NSString
alloc
]
initWithFormat
:
@"https://%@/admin/product
_listings.json"
,
Shopify_SHOP_DOMAIN
];
AFHTTPSessionManager
*
sessionManager
=
[
AFHTTPSessionManager
manager
];
AFHTTPSessionManager
*
sessionManager
=
[
AFHTTPSessionManager
manager
];
[
sessionManager
.
requestSerializer
setValue
:
@"Basic YWRlMDgzZGU2YWJjYjljYjk0ODY5NDg1ZWUwZGQyNmE6MWYyYzVlM2I4N2YyZGJlMTkwZGEzMzU4NmMyMmY3YzQ="
forHTTPHeaderField
:
@"Authorization"
];
[
sessionManager
.
requestSerializer
setValue
:
Moncler_Vendor_Auth
forHTTPHeaderField
:
@"Authorization"
];
[
sessionManager
GET
:
apiPath
parameters
:
nil
progress
:
nil
success
:^
(
NSURLSessionDataTask
*
_Nonnull
task
,
id
_Nullable
responseObject
)
{
NSMutableDictionary
*
params
=
@{
@"product_ids"
:
productId
}.
mutableCopy
;
[
sessionManager
GET
:
apiPath
parameters
:
params
progress
:
nil
success
:^
(
NSURLSessionDataTask
*
_Nonnull
task
,
id
_Nullable
responseObject
)
{
[
weakSelf
hideLoading
];
[
weakSelf
hideLoading
];
BUYProduct
*
product
=
nil
;
BUYProduct
*
product
=
nil
;
if
(
responseObject
){
if
(
responseObject
){
NSDictionary
*
dataDictionary
=
responseObject
[
@"product
"
];
id
jsonDictionary
=
responseObject
[
@"product_listings
"
];
if
(
data
Dictionary
){
if
(
json
Dictionary
){
@try
{
@try
{
BUYModelManager
*
modelManager
=
[[
BUYModelManager
alloc
]
init
];
NSArray
*
array
=
(
NSArray
*
)
jsonDictionary
;
product
=
(
BUYProduct
*
)[
modelManager
buy_objectWithEntityName
:[
BUYProduct
entityName
]
JSONDictionary
:
dataDictionary
];
if
(
array
&&
array
.
count
>
0
){
BUYModelManager
*
modelManager
=
[[
BUYModelManager
alloc
]
init
];
product
=
(
BUYProduct
*
)[
modelManager
buy_objectWithEntityName
:[
BUYProduct
entityName
]
JSONDictionary
:
array
.
firstObject
];
}
}
}
@catch
(
NSException
*
exception
){
@catch
(
NSException
*
exception
){
NSLog
(
@"exception Name: %@"
,
exception
.
name
);
NSLog
(
@"exception Name: %@"
,
exception
.
name
);
...
@@ -573,7 +577,7 @@
...
@@ -573,7 +577,7 @@
}
}
if
(
product
){
if
(
product
){
weakSelf
.
product
=
product
;
weakSelf
.
product
=
product
;
//
weakSelf.productId = product.identifier;
weakSelf
.
productId
=
product
.
identifier
;
[
weakSelf
initBottomViewHidden
];
[
weakSelf
initBottomViewHidden
];
weakSelf
.
midDetailView
.
product
=
product
;
weakSelf
.
midDetailView
.
product
=
product
;
[
weakSelf
.
detailView1
setData
:
product
];
[
weakSelf
.
detailView1
setData
:
product
];
...
...
iCemarose/Header-Prefix.h
View file @
38be4224
...
@@ -60,6 +60,8 @@
...
@@ -60,6 +60,8 @@
#define Order_API_Auth @"Basic YzJmNmZhZTk3NzQxZWE2ZGI0Y2FkN2FlOGY3MGZlZjM=="
#define Order_API_Auth @"Basic YzJmNmZhZTk3NzQxZWE2ZGI0Y2FkN2FlOGY3MGZlZjM=="
#define Moncler_Vendor_Auth @"Basic YWRlMDgzZGU2YWJjYjljYjk0ODY5NDg1ZWUwZGQyNmE6MWYyYzVlM2I4N2YyZGJlMTkwZGEzMzU4NmMyMmY3YzQ="
//正式的微信key
//正式的微信key
#define WechatAppKey @"wx355a497b2a2dd6d5"
#define WechatAppKey @"wx355a497b2a2dd6d5"
...
...
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