Commit f86eab4e authored by 曲欣亮's avatar 曲欣亮

重构

parent a4ef7b0c
...@@ -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 BaiduMD5 {
// 首先初始化一个字符数组,用来存放每个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' };
......
...@@ -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.BaiduMD5;
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 = BaiduMD5.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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment