Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-qywx-self
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
gic-qywx-self
Commits
c506be8c
Commit
c506be8c
authored
May 06, 2023
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自建
parent
a1d25fe1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletions
+26
-1
QywxController.java
src/main/java/com/gic/qywx/self/QywxController.java
+25
-0
application.yml
src/main/resources/application.yml
+1
-1
No files found.
src/main/java/com/gic/qywx/self/QywxController.java
View file @
c506be8c
package
com
.
gic
.
qywx
.
self
;
package
com
.
gic
.
qywx
.
self
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.http.entity.ContentType
;
import
org.apache.http.entity.ContentType
;
import
org.apache.http.entity.mime.content.ByteArrayBody
;
import
org.apache.http.entity.mime.content.ByteArrayBody
;
import
org.apache.http.entity.mime.content.ContentBody
;
import
org.apache.http.entity.mime.content.ContentBody
;
...
@@ -11,6 +18,8 @@ import org.slf4j.LoggerFactory;
...
@@ -11,6 +18,8 @@ import org.slf4j.LoggerFactory;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
@RestController
@RestController
@RequestMapping
(
"/qywx"
)
@RequestMapping
(
"/qywx"
)
...
@@ -49,4 +58,20 @@ public class QywxController {
...
@@ -49,4 +58,20 @@ public class QywxController {
return
map
;
return
map
;
}
}
@RequestMapping
(
"self-upload-data"
)
public
Object
selfImage
(
String
url
,
String
fileName
,
HttpServletRequest
request
)
throws
IOException
{
logger
.
info
(
"自建upload-data,url={}"
,
url
);
MultipartHttpServletRequest
multiRequest
=
(
MultipartHttpServletRequest
)
request
;
List
<
MultipartFile
>
list
=
multiRequest
.
getMultiFileMap
().
get
(
"media"
);
MultipartFile
mf
=
list
.
get
(
0
);
byte
[]
data
=
mf
.
getBytes
();
Map
<
String
,
ContentBody
>
paramsMap
=
new
HashMap
<
String
,
ContentBody
>();
paramsMap
.
put
(
"media"
,
new
ByteArrayBody
(
data
,
ContentType
.
DEFAULT_BINARY
,
fileName
));
Map
<
String
,
Object
>
map
=
HttpClient
.
getWinxinResByFile
(
url
,
paramsMap
);
return
map
;
}
}
}
src/main/resources/application.yml
View file @
c506be8c
server
:
server
:
port
:
8
601
port
:
8
960
servlet
:
servlet
:
context-path
:
/api-qywx-self
context-path
:
/api-qywx-self
tomcat
:
tomcat
:
...
...
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