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
206e71f1
Commit
206e71f1
authored
Jun 01, 2017
by
lee
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.oschina.net:kollway-kollway/newcemarose
parents
a203d081
5d254302
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
14 deletions
+23
-14
KWMCartResult.m
iCemarose/Class/Api/Cemarose/KWMCartResult.m
+1
-1
KWMImageUtil.h
iCemarose/Class/Util/KWMImageUtil.h
+4
-1
KWMImageUtil.m
iCemarose/Class/Util/KWMImageUtil.m
+17
-11
Info.plist
iCemarose/Info.plist
+1
-1
No files found.
iCemarose/Class/Api/Cemarose/KWMCartResult.m
View file @
206e71f1
...
...
@@ -44,7 +44,7 @@
shopCartModel
.
product_id
=
item
[
@"product_id"
];
shopCartModel
.
quantity
=
[
item
[
@"quantity"
]
integerValue
];
shopCartModel
.
price
=
[
item
[
@"discounted_price"
]
floatValue
]
/
100
;
shopCartModel
.
imageStr
=
[
KWMImageUtil
getProductImageUrl
:
item
[
@"product_id
"
]
ImageSize
:
NormalImage
];
shopCartModel
.
imageStr
=
[
KWMImageUtil
getProductImageUrl
ByOriginalUrl
:
item
[
@"image
"
]
ImageSize
:
NormalImage
];
shopCartModel
.
shopCartDict
=
item
;
[
datas
addObject
:
shopCartModel
];
}
...
...
iCemarose/Class/Util/KWMImageUtil.h
View file @
206e71f1
...
...
@@ -51,7 +51,10 @@
+
(
NSString
*
)
getProductImageUrl
:(
id
)
product
ImageSize
:(
NSInteger
)
ImageSize
;
//获取商品第(position+1)张图片
+
(
NSString
*
)
getProductImageUrlByPosition
:(
NSNumber
*
)
productId
ImageSize
:(
NSInteger
)
ImageSize
Position
:(
NSInteger
)
Position
;
+
(
NSString
*
)
getProductImageUrlByPosition
:(
id
)
product
ImageSize
:(
NSInteger
)
ImageSize
Position
:(
NSInteger
)
Position
;
//通过商品OriginalUrl(原图片url)获取新图片url
+
(
NSString
*
)
getProductImageUrlByOriginalUrl
:(
NSString
*
)
originalImgUrl
ImageSize
:(
NSInteger
)
ImageSize
;
...
...
iCemarose/Class/Util/KWMImageUtil.m
View file @
206e71f1
...
...
@@ -194,21 +194,30 @@
imageArray
=
[
self
getOriginalImages2
:
product
];
}
NSMutableArray
*
newImageArray
=
[[
NSMutableArray
alloc
]
init
];
//https://cdn.shopify.com/s/files/1/1089/5284/products/5413_1.jpg?v==1459708223 转换为
//https://o42yton8r.qnssl.com/s/files/1/1089/5284/products/5413_1.jpg?imageView2/1/w/300/h/300/v==1459708223
if
(
imageArray
&&
imageArray
.
count
>
0
){
for
(
NSString
*
imageUrl
in
imageArray
){
NSRange
startRange
=
[
imageUrl
rangeOfString
:
@"?"
];
NSString
*
newImageUrl
=
[
self
getProductImageUrlByOriginalUrl
:
imageUrl
ImageSize
:
ImageSize
];
[
newImageArray
addObject
:
newImageUrl
];
}
}
return
newImageArray
;
}
+
(
NSString
*
)
getProductImageUrlByOriginalUrl
:
(
NSString
*
)
originalImgUrl
ImageSize
:
(
NSInteger
)
ImageSize
{
NSMutableString
*
newImageUrl
=
[[
NSMutableString
alloc
]
initWithString
:
@""
];;
//https://cdn.shopify.com/s/files/1/1089/5284/products/5413_1.jpg?v==1459708223 转换为
//https://o42yton8r.qnssl.com/s/files/1/1089/5284/products/5413_1.jpg?imageView2/1/w/300/h/300/v==1459708223
if
(
originalImgUrl
){
NSRange
startRange
=
[
originalImgUrl
rangeOfString
:
@"?"
];
if
(
startRange
.
location
!=
NSNotFound
)
{
NSMutableString
*
newImageUrl
=
[[
NSMutableString
alloc
]
initWithString
:
image
Url
];
newImageUrl
=
[[
NSMutableString
alloc
]
initWithString
:
originalImg
Url
];
NSArray
<
NSString
*>
*
imageWH
=
[
self
getImageWH
:
ImageSize
];
NSString
*
size
=
[
NSString
stringWithFormat
:
@"imageView2/1/w/%@/h/%@/"
,
imageWH
[
0
],
imageWH
[
1
]];
[
newImageUrl
insertString
:
size
atIndex
:
startRange
.
location
+
1
];
[
newImageArray
addObject
:
newImageUrl
];
}
}
}
return
newImageArray
;
return
[
NSString
stringWithFormat
:
@"%@"
,
newImageUrl
];;
}
+
(
NSArray
*
)
getImageWH
:
(
NSInteger
)
ImageSize
{
...
...
@@ -239,13 +248,10 @@
imageUrl
=
imageArray
.
firstObject
;
}
}
if
([
product
isKindOfClass
:[
BUYProduct
class
]]){
BUYProduct
*
aaa
=
(
BUYProduct
*
)
product
;
}
return
imageUrl
;
}
+
(
NSString
*
)
getProductImageUrlByPosition
:
(
id
)
product
ImageSize
:
(
NSInteger
)
ImageSize
Position
:
(
NSInteger
)
Position
{
NSString
*
imageUrl
=
@""
;
if
(
product
){
...
...
iCemarose/Info.plist
View file @
206e71f1
...
...
@@ -32,7 +32,7 @@
<
/
d
i
c
t
>
<
/
a
rr
a
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
20170
42409
<
/string
>
<
string
>
20170
53117
<
/string
>
<
k
e
y
>
LSApplicationQueriesSchemes
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
weixin
<
/string
>
...
...
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