Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sobot_module_Dev
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
sobot_android
Sobot_module_Dev
Commits
dade7313
Commit
dade7313
authored
Apr 26, 2023
by
zhengnw@sobot.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net 请求可以传超时时间
parent
6760a74e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
16 deletions
+37
-16
MainActivity.java
app/src/main/java/com/sobot/moduletest/MainActivity.java
+1
-1
build.gradle
sobot_common/build.gradle
+4
-4
sobot-common-publish-mavencentral.gradle
sobot_common/sobot-common-publish-mavencentral.gradle
+1
-1
build.gradle
sobot_network/build.gradle
+2
-2
sobot-network-publish-mavencentral.gradle
sobot_network/sobot-network-publish-mavencentral.gradle
+1
-1
SobotHttpUtils.java
.../main/java/com/sobot/network/apiUtils/SobotHttpUtils.java
+10
-0
HttpBaseUtils.java
...k/src/main/java/com/sobot/network/http/HttpBaseUtils.java
+18
-7
No files found.
app/src/main/java/com/sobot/moduletest/MainActivity.java
View file @
dade7313
...
...
@@ -133,7 +133,7 @@ public class MainActivity extends SobotBaseActivity {
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
headers
.
put
(
"version"
,
"2.9.7"
);
headers
.
put
(
"from"
,
"2"
);
SobotHttpUtils
.
doPost
(
MainActivity
.
this
,
"https://api.sobot.com/chat-sdk/sdk/user/v2/robotGuide.action"
,
map
,
headers
,
new
HttpBaseUtils
.
StringCallBack
()
{
SobotHttpUtils
.
doPost
(
MainActivity
.
this
,
"https://api.sobot.com/chat-sdk/sdk/user/v2/robotGuide.action"
,
5000
,
map
,
headers
,
new
HttpBaseUtils
.
StringCallBack
()
{
@Override
public
void
onResponse
(
String
result
)
{
}
...
...
sobot_common/build.gradle
View file @
dade7313
...
...
@@ -11,7 +11,7 @@ android {
//这里就是打jar包
task
makeJar
(
type:
Copy
)
{
//删除旧的jar包
delete
'build/libs/sobot_common_1.2.
6
.jar'
delete
'build/libs/sobot_common_1.2.
7
.jar'
//原地址
from
(
'build/intermediates/packaged-classes/release/'
)
//导出jar包的地址
...
...
@@ -19,7 +19,7 @@ android {
//包含的jar包
include
(
'classes.jar'
)
//重命名jar包为mysdk
rename
(
'classes.jar'
,
'sobot_common_1.2.
6
.jar'
)
rename
(
'classes.jar'
,
'sobot_common_1.2.
7
.jar'
)
}
makeJar
.
dependsOn
(
build
)
}
...
...
@@ -34,12 +34,12 @@ dependencies {
api
'com.sobot.library:utils:1.1.1'
api
'com.sobot.library:picture:1.1.4'
api
'com.sobot.library:net:1.1.
8
'
api
'com.sobot.library:net:1.1.
9
'
api
'com.sobot.library:gson:1.1.1'
// api 'com.sobot.library:utils:1.1.1'
// api 'com.sobot.library:picture_x:1.1.4'
// api 'com.sobot.library:net:1.1.
8
'
// api 'com.sobot.library:net:1.1.
9
'
// api 'com.sobot.library:gson:1.1.1'
}
...
...
sobot_common/sobot-common-publish-mavencentral.gradle
View file @
dade7313
...
...
@@ -13,7 +13,7 @@ ext {
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'sobotcommon'
//项目名
// PUBLISH_ARTIFACT_ID = 'sobotcommon_x' //项目名
PUBLISH_VERSION
=
'1.2.
7
'
//版本号
PUBLISH_VERSION
=
'1.2.
8
'
//版本号
}
...
...
sobot_network/build.gradle
View file @
dade7313
...
...
@@ -11,7 +11,7 @@ android {
//这里就是打jar包
task
makeJar
(
type:
Copy
)
{
//删除旧的jar包
delete
'build/libs/sobot_net_1.1.
7
.jar'
delete
'build/libs/sobot_net_1.1.
9
.jar'
//原地址
from
(
'build/intermediates/packaged-classes/release/'
)
//导出jar包的地址
...
...
@@ -19,7 +19,7 @@ android {
//包含的jar包
include
(
'classes.jar'
)
//重命名jar包为mysdk
rename
(
'classes.jar'
,
'sobot_net_1.1.
7
.jar'
)
rename
(
'classes.jar'
,
'sobot_net_1.1.
9
.jar'
)
}
makeJar
.
dependsOn
(
build
)
}
...
...
sobot_network/sobot-network-publish-mavencentral.gradle
View file @
dade7313
...
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext
{
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'net'
//项目名
PUBLISH_VERSION
=
'1.1.
8
'
//版本号
PUBLISH_VERSION
=
'1.1.
9
'
//版本号
}
...
...
sobot_network/src/main/java/com/sobot/network/apiUtils/SobotHttpUtils.java
View file @
dade7313
...
...
@@ -32,6 +32,11 @@ public class SobotHttpUtils {
HttpBaseUtils
.
getInstance
().
doPost
(
cancelTag
,
url
,
paramsMap
,
headerMap
,
call
);
}
public
static
void
doPost
(
Object
cancelTag
,
String
url
,
long
timeOut
,
Map
<
String
,
Object
>
paramsMap
,
Map
<
String
,
String
>
headerMap
,
HttpBaseUtils
.
StringCallBack
call
)
{
HttpBaseUtils
.
getInstance
().
doPost
(
cancelTag
,
url
,
timeOut
,
paramsMap
,
headerMap
,
call
);
}
public
static
void
doPostByJsonString
(
Object
cancelTag
,
String
url
,
Map
<
String
,
Object
>
paramsMap
,
Map
<
String
,
String
>
headerMap
,
HttpBaseUtils
.
StringCallBack
call
)
{
HttpBaseUtils
.
getInstance
().
doPostByJsonString
(
cancelTag
,
url
,
paramsMap
,
headerMap
,
call
);
...
...
@@ -47,6 +52,11 @@ public class SobotHttpUtils {
HttpBaseUtils
.
getInstance
().
doGet
(
cancelTag
,
url
,
paramsMap
,
headerMap
,
call
);
}
public
static
void
doGet
(
Object
cancelTag
,
String
url
,
long
timeOut
,
Map
<
String
,
Object
>
paramsMap
,
Map
<
String
,
String
>
headerMap
,
HttpBaseUtils
.
StringCallBack
call
)
{
HttpBaseUtils
.
getInstance
().
doGet
(
cancelTag
,
url
,
timeOut
,
paramsMap
,
headerMap
,
call
);
}
//同步请求
public
static
Response
doPostSync
(
Object
cancelTag
,
String
url
,
Map
<
String
,
Object
>
paramsMap
,
Map
<
String
,
String
>
headerMap
)
throws
IOException
{
return
HttpBaseUtils
.
getInstance
().
doPostSync
(
cancelTag
,
url
,
paramsMap
,
headerMap
);
...
...
sobot_network/src/main/java/com/sobot/network/http/HttpBaseUtils.java
View file @
dade7313
...
...
@@ -43,6 +43,12 @@ public class HttpBaseUtils {
public
void
doPost
(
Object
cancelTag
,
final
String
url_str
,
Map
<
String
,
Object
>
paramMap
,
Map
<
String
,
String
>
headerMap
,
final
StringCallBack
callback
)
{
doPost
(
cancelTag
,
url_str
,
8
*
1000
,
paramMap
,
headerMap
,
callback
);
}
public
void
doPost
(
Object
cancelTag
,
final
String
url_str
,
long
timeOut
,
Map
<
String
,
Object
>
paramMap
,
Map
<
String
,
String
>
headerMap
,
final
StringCallBack
callback
)
{
SobotNetLogUtils
.
i
(
"请求URL: --> "
+
url_str
);
SobotNetLogUtils
.
i
(
"请求参数: --> "
+
paramMap
);
SobotNetLogUtils
.
i
(
"请求头参数: --> "
+
headerMap
);
...
...
@@ -57,9 +63,9 @@ public class HttpBaseUtils {
.
headers
(
headerMap
)
.
params
(
paramMap
)
.
build
()
.
readTimeOut
(
8
*
1000
)
.
writeTimeOut
(
8
*
1000
)
.
connTimeOut
(
8
*
1000
).
execute
(
new
StringCallback
()
{
.
readTimeOut
(
timeOut
)
.
writeTimeOut
(
timeOut
)
.
connTimeOut
(
timeOut
).
execute
(
new
StringCallback
()
{
@Override
public
void
onResponse
(
String
response
)
{
...
...
@@ -158,10 +164,15 @@ public class HttpBaseUtils {
}
}
public
void
doGet
(
Object
cancelTag
,
final
String
url_str
,
final
Map
<
String
,
Object
>
paramMap
,
Map
<
String
,
String
>
headerMap
,
final
StringCallBack
callback
)
{
doGet
(
cancelTag
,
url_str
,
8
*
1000
,
paramMap
,
headerMap
,
callback
);
}
public
void
doGet
(
Object
cancelTag
,
final
String
url_str
,
long
timeOut
,
final
Map
<
String
,
Object
>
paramMap
,
Map
<
String
,
String
>
headerMap
,
final
StringCallBack
callback
)
{
SobotNetLogUtils
.
i
(
"请求URL: --> "
+
url_str
);
SobotNetLogUtils
.
i
(
"请求参数: --> "
+
paramMap
);
SobotNetLogUtils
.
i
(
"请求头参数: --> "
+
headerMap
);
...
...
@@ -176,9 +187,9 @@ public class HttpBaseUtils {
.
params
(
paramMap
)
.
headers
(
headerMap
)
.
build
()
.
readTimeOut
(
8
*
1000
)
.
writeTimeOut
(
8
*
1000
)
.
connTimeOut
(
8
*
1000
).
execute
(
new
StringCallback
()
{
.
readTimeOut
(
timeOut
)
.
writeTimeOut
(
timeOut
)
.
connTimeOut
(
timeOut
).
execute
(
new
StringCallback
()
{
@Override
public
void
onResponse
(
String
response
)
{
...
...
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