Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
ac90e314
Commit
ac90e314
authored
Nov 15, 2023
by
王祖波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发送朋友圈图片优化
parent
1e87f977
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
MaterialServiceImpl.java
...oban/manage/service/service/impl/MaterialServiceImpl.java
+20
-6
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/MaterialServiceImpl.java
View file @
ac90e314
...
@@ -243,9 +243,10 @@ public class MaterialServiceImpl implements MaterialService {
...
@@ -243,9 +243,10 @@ public class MaterialServiceImpl implements MaterialService {
Integer
width
=
jsonObject
.
getInteger
(
"width"
);
Integer
width
=
jsonObject
.
getInteger
(
"width"
);
Integer
height
=
jsonObject
.
getInteger
(
"height"
);
Integer
height
=
jsonObject
.
getInteger
(
"height"
);
Integer
size
=
jsonObject
.
getInteger
(
"size"
);
Integer
size
=
jsonObject
.
getInteger
(
"size"
);
//朋友圈类型图片,长边不超过10800像素,短边不超过1080像素
//图片宽高超过限制 或 大小大于2m 处理图片
//图片宽高超过限制 或 大小大于2m 处理图片
if
(
size
/
1000
>
2000
||
width
>
1
440
||
height
>
108
0
)
{
if
(
size
/
1000
>
2000
||
width
>
1
080
||
height
>
1080
0
)
{
url
+=
"?imageView2/2/w/1
440/h/108
0"
;
url
+=
"?imageView2/2/w/1
080/h/1080
0"
;
}
}
logger
.
info
(
"url={}"
,
url
);
logger
.
info
(
"url={}"
,
url
);
}
}
...
@@ -270,10 +271,23 @@ public class MaterialServiceImpl implements MaterialService {
...
@@ -270,10 +271,23 @@ public class MaterialServiceImpl implements MaterialService {
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
String
imageInfoUrl
=
"https://platform-1251519181.cos.ap-shanghai.myqcloud.com/image/jhdm/common-fbcae3533d414bf8baac917df600b20e.png?imageInfo"
;
String
url
=
"https://platform-1251519181.cos.ap-shanghai.myqcloud.com/image/jhdm/common-fbcae3533d414bf8baac917df600b20e.png"
;
Map
<
String
,
Object
>
httpByGet
=
HttpClient
.
getHttpByGet
(
imageInfoUrl
);
Map
<
String
,
Object
>
map
=
HttpClient
.
getHttpByGet
(
url
+
"?imageInfo"
);
Object
response
=
httpByGet
.
get
(
"response"
);
String
response
=
(
String
)
map
.
get
(
"response"
);
System
.
out
.
println
(
JSON
.
toJSONString
(
httpByGet
));
if
(
StringUtils
.
isBlank
(
response
))
{
throw
new
RuntimeException
();
}
JSONObject
jsonObject
=
null
;
jsonObject
=
JSONObject
.
parseObject
(
response
);
Integer
width
=
jsonObject
.
getInteger
(
"width"
);
Integer
height
=
jsonObject
.
getInteger
(
"height"
);
Integer
size
=
jsonObject
.
getInteger
(
"size"
);
//图片宽高超过限制 或 大小大于2m 处理图片
if
(
size
/
1000
>
2000
||
width
>
1440
||
height
>
1080
)
{
url
+=
"?imageView2/2/w/1440/h/1080"
;
}
logger
.
info
(
"url={}"
,
url
);
System
.
out
.
println
(
JSON
.
toJSONString
(
url
));
}
}
public
List
<
String
>
getImageMediaId
(
String
wxEnterpriseId
,
List
<
ContentMaterialDTO
>
imageList
,
int
mediaType
)
{
public
List
<
String
>
getImageMediaId
(
String
wxEnterpriseId
,
List
<
ContentMaterialDTO
>
imageList
,
int
mediaType
)
{
...
...
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