Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SmartBox
Project
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
苗权威
SmartBox
Commits
bfcc6e65
Commit
bfcc6e65
authored
Apr 06, 2021
by
李进峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
cd474350
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
2 deletions
+70
-2
OkHttp3Utils.java
...main/java/ai/qiwu/com/xiaoduhome/common/OkHttp3Utils.java
+28
-0
AudioSingleBotController.java
...u/com/xiaoduhome/controller/AudioSingleBotController.java
+40
-0
SpiritController.java
...a/ai/qiwu/com/xiaoduhome/controller/SpiritController.java
+2
-2
SingleBotService.java
...java/ai/qiwu/com/xiaoduhome/service/SingleBotService.java
+0
-0
No files found.
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/OkHttp3Utils.java
View file @
bfcc6e65
...
@@ -112,6 +112,34 @@ public class OkHttp3Utils {
...
@@ -112,6 +112,34 @@ public class OkHttp3Utils {
return
null
;
return
null
;
}
}
public
static
String
singleChat
(
String
url
,
String
requestJsonStr
,
Map
<
String
,
String
>
headers
,
String
uid
)
throws
IOException
{
log
.
info
(
"#####->singleChat->url:{}, requestJsonStr:{}, uid:{}"
,
url
,
requestJsonStr
,
uid
);
Request
.
Builder
builder
=
new
Request
.
Builder
();
Request
request
=
builder
.
url
(
url
).
build
();
HttpUrl
.
Builder
urlBuild
=
request
.
url
().
newBuilder
();
Headers
.
Builder
headBuilder
=
request
.
headers
().
newBuilder
();
Iterator
<
Map
.
Entry
<
String
,
String
>>
headIterator
=
headers
.
entrySet
().
iterator
();
headIterator
.
forEachRemaining
(
e
->
headBuilder
.
add
(
e
.
getKey
(),
e
.
getValue
()));
urlBuild
.
addQueryParameter
(
"uid"
,
uid
);
builder
.
url
(
urlBuild
.
build
()).
headers
(
headBuilder
.
build
())
.
post
(
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
requestJsonStr
));
Response
response
=
client
.
newCall
(
builder
.
build
()).
execute
();
try
(
ResponseBody
body
=
response
.
body
())
{
return
body
.
string
();
}
catch
(
SocketTimeoutException
e
)
{
log
.
error
(
"捕获到SocketTimeoutException:{}"
,
e
.
toString
());
client
.
dispatcher
().
cancelAll
();
client
.
connectionPool
().
evictAll
();
}
catch
(
Exception
e
)
{
log
.
error
(
"doPostJsonStrForCentralWithUidParam error:"
+
e
);
}
return
null
;
}
public
static
String
doPostJsonStrForCentralWithUidParam
(
String
url
,
String
requestJsonStr
,
Map
<
String
,
String
>
headers
,
public
static
String
doPostJsonStrForCentralWithUidParam
(
String
url
,
String
requestJsonStr
,
Map
<
String
,
String
>
headers
,
String
uid
)
throws
IOException
{
String
uid
)
throws
IOException
{
Request
.
Builder
builder
=
new
Request
.
Builder
();
Request
.
Builder
builder
=
new
Request
.
Builder
();
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/AudioSingleBotController.java
0 → 100644
View file @
bfcc6e65
package
ai
.
qiwu
.
com
.
xiaoduhome
.
controller
;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.commons.lang.exception.ExceptionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
ai.qiwu.com.xiaoduhome.service.SingleBotService
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
@RestController
@RequestMapping
(
""
)
@Slf4j
@RequiredArgsConstructor
(
onConstructor_
={
@Autowired
})
public
class
AudioSingleBotController
{
private
final
StringRedisTemplate
stringRedisTemplate
;
@PostMapping
(
"/xiaodu/single/bot"
)
public
String
xiaodu
(
HttpServletRequest
request
)
{
String
botAccount
=
request
.
getParameter
(
"botAccount"
);
String
serverCode
=
request
.
getParameter
(
"serverCode"
);
if
(
StringUtils
.
isAnyBlank
(
botAccount
,
serverCode
))
{
return
"参数错误!"
;
}
try
{
SingleBotService
service
=
new
SingleBotService
(
botAccount
,
serverCode
,
request
,
stringRedisTemplate
);
service
.
enableVerify
();
String
str
=
service
.
run
();
return
str
;
}
catch
(
Exception
e
)
{
log
.
info
(
"AudioSingleBotController->xiaodu->e:{}"
,
ExceptionUtils
.
getStackTrace
(
e
));
}
return
null
;
}
}
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/SpiritController.java
View file @
bfcc6e65
...
@@ -84,7 +84,7 @@ public class SpiritController {
...
@@ -84,7 +84,7 @@ public class SpiritController {
@PostMapping
(
value
=
"/encryption"
)
// 智能小说加密版
@PostMapping
(
value
=
"/encryption"
)
// 智能小说加密版
public
ResultModel
<
TaskResult
>
story
(
@RequestBody
String
taskQuery
)
{
public
ResultModel
<
TaskResult
>
story
(
@RequestBody
String
taskQuery
)
{
//
log.info("天猫请求信息:{}",taskQuery);
log
.
info
(
"天猫请求信息:{}"
,
taskQuery
);
TaskResult
result
;
TaskResult
result
;
try
{
try
{
SecurityWrapperTaskQuery
wrapperTaskQuery
=
MetaFormat
.
parseToWrapperQuery
(
taskQuery
);
SecurityWrapperTaskQuery
wrapperTaskQuery
=
MetaFormat
.
parseToWrapperQuery
(
taskQuery
);
...
@@ -100,7 +100,7 @@ public class SpiritController {
...
@@ -100,7 +100,7 @@ public class SpiritController {
ResultModel
<
TaskResult
>
resultModel
=
new
ResultModel
<>();
ResultModel
<
TaskResult
>
resultModel
=
new
ResultModel
<>();
resultModel
.
setReturnCode
(
"0"
);
resultModel
.
setReturnCode
(
"0"
);
resultModel
.
setReturnValue
(
result
);
resultModel
.
setReturnValue
(
result
);
//
log.info("天猫响应信息:"+ JSON.toJSONString(resultModel));
log
.
info
(
"天猫响应信息:"
+
JSON
.
toJSONString
(
resultModel
));
return
resultModel
;
return
resultModel
;
}
}
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/SingleBotService.java
0 → 100644
View file @
bfcc6e65
This diff is collapsed.
Click to expand it.
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