Skip to content

Commit 03a88aa

Browse files
committed
#1035 小程序发送模板接口去掉所有颜色相关的color参数
1 parent 0287fb5 commit 03a88aa

File tree

5 files changed

+7
-26
lines changed

5 files changed

+7
-26
lines changed

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaTemplateData.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/**
77
* <pre>
8-
*
8+
* 参考文档 https://developers.weixin.qq.com/miniprogram/dev/api-backend/templateMessage.send.html
99
* Created by Binary Wang on 2018/9/23.
1010
* </pre>
1111
*
@@ -29,4 +29,5 @@ public WxMaTemplateData(String name, String value, String color) {
2929
this.color = color;
3030
}
3131

32+
3233
}

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaTemplateMessage.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
/**
1515
* 模板消息.
16-
* 参考 https://mp.weixin.qq.com/debug/wxadoc/dev/api/notice.html#接口说明 模板消息部分
16+
* 参考 https://developers.weixin.qq.com/miniprogram/dev/api-backend/templateMessage.send.html
1717
*
1818
* @author <a href="https://github.com/binarywang">Binary Wang</a>
1919
*/
@@ -75,16 +75,6 @@ public class WxMaTemplateMessage implements Serializable {
7575
*/
7676
private List<WxMaTemplateData> data;
7777

78-
/**
79-
* 模板内容字体的颜色,不填默认黑色.
80-
* <pre>
81-
* 参数:color
82-
* 是否必填: 否
83-
* 描述: 模板内容字体的颜色,不填默认黑色
84-
* </pre>
85-
*/
86-
private String color;
87-
8878
/**
8979
* 模板需要放大的关键词,不填则默认无放大.
9080
* <pre>

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/util/json/WxMaTemplateMessageGsonAdapter.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ public JsonElement serialize(WxMaTemplateMessage message, Type typeOfSrc, JsonSe
2727
messageJson.addProperty("form_id", message.getFormId());
2828
}
2929

30-
if (message.getColor() != null) {
31-
messageJson.addProperty("color", message.getColor());
32-
}
33-
3430
if (message.getEmphasisKeyword() != null) {
3531
messageJson.addProperty("emphasis_keyword", message.getEmphasisKeyword());
3632
}
@@ -45,9 +41,6 @@ public JsonElement serialize(WxMaTemplateMessage message, Type typeOfSrc, JsonSe
4541
for (WxMaTemplateData datum : message.getData()) {
4642
JsonObject dataJson = new JsonObject();
4743
dataJson.addProperty("value", datum.getValue());
48-
if (datum.getColor() != null) {
49-
dataJson.addProperty("color", datum.getColor());
50-
}
5144
data.add(datum.getName(), dataJson);
5245
}
5346

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/util/json/WxMaUniformMessageGsonAdapter.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ public JsonElement serialize(WxMaUniformMessage message, Type typeOfSrc, JsonSer
7979
for (WxMaTemplateData templateData : message.getData()) {
8080
JsonObject dataJson = new JsonObject();
8181
dataJson.addProperty("value", templateData.getValue());
82-
if (templateData.getColor() != null) {
83-
dataJson.addProperty("color", templateData.getColor());
84-
}
8582
data.add(templateData.getName(), dataJson);
8683
}
8784
}

weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaMsgServiceImplTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ public void testSendTemplateMsg() throws WxErrorException {
4848
.formId("FORMID")
4949
.page("index")
5050
.data(Lists.newArrayList(
51-
new WxMaTemplateData("keyword1", "339208499", "#173177"),
52-
new WxMaTemplateData("keyword2", dateFormat.format(new Date()), "#173177"),
53-
new WxMaTemplateData("keyword3", "粤海喜来登酒店", "#173177"),
54-
new WxMaTemplateData("keyword4", "广州市天河区天河路208号", "#173177")))
51+
new WxMaTemplateData("keyword1", "339208499"),
52+
new WxMaTemplateData("keyword2", dateFormat.format(new Date())),
53+
new WxMaTemplateData("keyword3", "粤海喜来登酒店"),
54+
new WxMaTemplateData("keyword4", "广州市天河区天河路208号")))
5555
.templateId(config.getTemplateId())
5656
.emphasisKeyword("keyword1.DATA")
5757
.build();

0 commit comments

Comments
 (0)