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
bb7f62fa
Commit
bb7f62fa
authored
Dec 19, 2017
by
houweibin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整
parent
baacd509
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
KWMNewProductVC.m
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
+17
-10
No files found.
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
View file @
bb7f62fa
...
...
@@ -118,6 +118,7 @@
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
];
...
...
@@ -542,6 +543,7 @@
}
}
//这个api获取的商品只能用于展示,不能出售,商品詳情的admin api与商品列表的admin api字段不同,转化为BuyProduct后,一些字段可能是缺失的。
-
(
void
)
requestAdminProductDetail
{
NSNumber
*
productId
=
self
.
product
?
self
.
product
.
identifier
:
self
.
productId
;
if
(
!
productId
){
...
...
@@ -549,34 +551,39 @@
}
[
self
showLoading
];
__weak
KWMNewProductVC
*
weakSelf
=
self
;
void
(
^
failure
)(
NSURLSessionDataTask
*
,
NSError
*
)
=
^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
){
[
weakSelf
hideLoading
];
[
weakSelf
showError
:
erro
r
];
}
;
void
(
^
success
)(
NSURLSessionDataTask
*
,
KWMProductResult
*
)
=
^
(
NSURLSessionDataTask
*
task
,
KWMProductResult
*
result
)
{
NSString
*
apiPath
=
[[
NSString
alloc
]
initWithFormat
:
@"https://%@/admin/products/%@.json"
,
Shopify_SHOP_DOMAIN
,
productId
.
stringValue
];
AFHTTPSessionManager
*
sessionManager
=
[
AFHTTPSessionManager
manage
r
];
[
sessionManager
.
requestSerializer
setValue
:
@"Basic YWRlMDgzZGU2YWJjYjljYjk0ODY5NDg1ZWUwZGQyNmE6MWYyYzVlM2I4N2YyZGJlMTkwZGEzMzU4NmMyMmY3YzQ="
forHTTPHeaderField
:
@"Authorization"
]
;
[
sessionManager
GET
:
apiPath
parameters
:
nil
progress
:
nil
success
:^
(
NSURLSessionDataTask
*
_Nonnull
task
,
id
_Nullable
responseObject
)
{
[
weakSelf
hideLoading
];
BUYProduct
*
product
=
nil
;
if
(
result
&&
result
.
productDict
){
if
(
responseObject
){
NSDictionary
*
dataDictionary
=
responseObject
[
@"product"
];
if
(
dataDictionary
){
@try
{
BUYModelManager
*
modelManager
=
[[
BUYModelManager
alloc
]
init
];
product
=
(
BUYProduct
*
)[
modelManager
buy_objectWithEntityName
:[
BUYProduct
entityName
]
JSONDictionary
:
result
.
productDict
];
product
=
(
BUYProduct
*
)[
modelManager
buy_objectWithEntityName
:[
BUYProduct
entityName
]
JSONDictionary
:
dataDictionary
];
}
@catch
(
NSException
*
exception
){
NSLog
(
@"exception Name: %@"
,
exception
.
name
);
NSLog
(
@"exception Reason: %@"
,
exception
.
reason
);
}
}
}
if
(
product
){
weakSelf
.
product
=
product
;
weakSelf
.
productId
=
product
.
identifier
;
//
weakSelf.productId = product.identifier;
[
weakSelf
initBottomViewHidden
];
weakSelf
.
midDetailView
.
product
=
product
;
[
weakSelf
.
detailView1
setData
:
product
];
[
weakSelf
requestBrandProducts
:
1
];
[
weakSelf
requestCategoryProducts
:
1
];
}
};
[
self
.
api
getAdminProduct
:
nil
productId
:
productId
success
:
success
failure
:
failure
];
}
failure
:^
(
NSURLSessionDataTask
*
_Nullable
task
,
NSError
*
_Nonnull
error
)
{
[
weakSelf
hideLoading
];
[
weakSelf
showError
:
error
];
}];
}
...
...
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