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