'提交代码'

dev-discount
= 4 years ago
parent 40fec6e678
commit 7e339af9f0
  1. 8
      hai-cweb/src/main/java/com/cweb/controller/SmsContentController.java
  2. 3
      hai-service/src/main/java/com/hai/common/utils/HttpsUtils.java

@ -50,8 +50,7 @@ public class SmsContentController {
list.add(phone);
map.put("signature", "嗨森逛");
String param = "88200409698&to" + phone + "&templateId=f42261f78d54488391f1d1ac4bd5bd3f&statusCallback=[" + phone +"]&signature=嗨森逛";
String param = "88200409698&to="+phone+"&templateId=f42261f78d54488391f1d1ac4bd5bd3f&templateParas=[\"" + 123456 +"\"]";
//JSON.toJSONString(map);
Map<String,Object> body = new LinkedHashMap<>();
body.put("from", param);
@ -59,8 +58,9 @@ public class SmsContentController {
String nonce = UUID.randomUUID().toString();
String created = DateUtil.date2String(new Date(), "yyyy-MM-dd'T'HH:mm:ss'Z'");
String passwordDigest = Base64Util.encode(encodeBySHA256(nonce + created + "9CWFv4NlaRX49n43VPA6eucZ8xeQ"));
System.out.println(encodeBySHA256(nonce + created + "9CWFv4NlaRX49n43VPA6eucZ8xeQ"));
System.out.println(Base64Util.encode(encodeBySHA256(nonce + created + "9CWFv4NlaRX49n43VPA6eucZ8xeQ")));
String passwordDigest = Base64Util.encode(encodeBySHA256(nonce + created + "9CWFv4NlaRX49n43VPA6eucZ8xeQ")) + "==";
// 9CWFv4NlaRX49n43VPA6eucZ8xeQ
Map<String,Object> header = new LinkedHashMap<>();

@ -3,6 +3,7 @@ package com.hai.common.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.pay.util.IOUtil;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@ -315,7 +316,7 @@ public class HttpsUtils {
for (Map.Entry<String, Object> entry : header.entrySet()) {
httpPost.setHeader(entry.getKey(), entry.getValue().toString());
}
StringEntity stringEntity = new StringEntity(JSON.toJSONString(body), "UTF-8");// 解决中文乱码问题
StringEntity stringEntity = new StringEntity(IOUtil.urlEncode("from=" +body.get("from").toString(), "UTF-8"));// 解决中文乱码问题
stringEntity.setContentEncoding("UTF-8");
stringEntity.setContentType("application/x-www-form-urlencoded");
httpPost.setEntity(stringEntity);

Loading…
Cancel
Save