Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
member-api
Project
Project
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
曲欣亮
member-api
Commits
f86eab4e
Commit
f86eab4e
authored
Aug 30, 2018
by
曲欣亮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构
parent
a4ef7b0c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
BaiduMD5.java
src/main/java/com/egolm/lang/config/BaiduMD5.java
+1
-1
TranslateServiceImpl.java
...ava/com/egolm/lang/service/impl/TranslateServiceImpl.java
+2
-2
No files found.
src/main/java/com/egolm/lang/config/MD5.java
→
src/main/java/com/egolm/lang/config/
Baidu
MD5.java
View file @
f86eab4e
...
@@ -14,7 +14,7 @@ import java.security.NoSuchAlgorithmException;
...
@@ -14,7 +14,7 @@ import java.security.NoSuchAlgorithmException;
* @author wangjingtao
* @author wangjingtao
*
*
*/
*/
public
class
MD5
{
public
class
Baidu
MD5
{
// 首先初始化一个字符数组,用来存放每个16进制字符
// 首先初始化一个字符数组,用来存放每个16进制字符
private
static
final
char
[]
hexDigits
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
private
static
final
char
[]
hexDigits
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
};
'e'
,
'f'
};
...
...
src/main/java/com/egolm/lang/service/impl/TranslateServiceImpl.java
View file @
f86eab4e
...
@@ -10,7 +10,7 @@ import org.springframework.stereotype.Service;
...
@@ -10,7 +10,7 @@ import org.springframework.stereotype.Service;
import
com.egolm.common.GsonUtil
;
import
com.egolm.common.GsonUtil
;
import
com.egolm.common.HttpUtil
;
import
com.egolm.common.HttpUtil
;
import
com.egolm.lang.config.MD5
;
import
com.egolm.lang.config.
Baidu
MD5
;
import
com.egolm.lang.service.TranslateService
;
import
com.egolm.lang.service.TranslateService
;
@Service
@Service
...
@@ -31,7 +31,7 @@ public class TranslateServiceImpl implements TranslateService {
...
@@ -31,7 +31,7 @@ public class TranslateServiceImpl implements TranslateService {
String
query
=
sDocument
;
String
query
=
sDocument
;
Long
salt
=
System
.
currentTimeMillis
();
Long
salt
=
System
.
currentTimeMillis
();
String
text
=
appid
+
query
+
salt
+
secret
;
String
text
=
appid
+
query
+
salt
+
secret
;
String
sign
=
MD5
.
md5
(
text
);
String
sign
=
Baidu
MD5
.
md5
(
text
);
Map
<
String
,
Object
>
parameters
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
parameters
=
new
HashMap
<
String
,
Object
>();
parameters
.
put
(
"q"
,
query
);
parameters
.
put
(
"q"
,
query
);
parameters
.
put
(
"from"
,
from
);
parameters
.
put
(
"from"
,
from
);
...
...
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