Skip to content

Commit

Permalink
Merge pull request #56 from rememberber/develop
Browse files Browse the repository at this point in the history
调整小程序模板消息formId策略
  • Loading branch information
rememberber authored May 16, 2018
2 parents 7632b94 + 6293c5f commit dcb6c80
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public static void preview() throws Exception {
for (String[] msgData : msgDataList) {
wxMaMessageTemplate = makeMaTemplateMessage(msgData);
wxMaMessageTemplate.setToUser(msgData[0].trim());
wxMaMessageTemplate.setFormId(msgData[1].trim());
// !!!发送小程序模板消息!!!
wxMaService.getMsgService().sendTemplateMsg(wxMaMessageTemplate);
}
Expand Down Expand Up @@ -283,10 +284,8 @@ synchronized public static WxMaTemplateMessage makeMaTemplateMessage(String[] ms
// 拼模板
WxMaTemplateMessage wxMessageTemplate = WxMaTemplateMessage.builder().build();
wxMessageTemplate.setTemplateId(MainWindow.mainWindow.getMsgTemplateIdTextField().getText().trim());
wxMessageTemplate.setFormId(MainWindow.mainWindow.getMsgTemplateFormIdTextField().getText().trim());
wxMessageTemplate.setPage(MainWindow.mainWindow.getMsgTemplateUrlTextField().getText().trim());
wxMessageTemplate.setColor(MainWindow.mainWindow.getMsgTemplateColorTextField().getText().trim());
wxMessageTemplate.setEmphasisKeyword(MainWindow.mainWindow.getMsgTemplateKeyWordTextField().getText().trim());
wxMessageTemplate.setEmphasisKeyword(MainWindow.mainWindow.getMsgTemplateKeyWordTextField().getText().trim() + ".DATA");

if (MainWindow.mainWindow.getTemplateMsgDataTable().getModel().getRowCount() == 0) {
Init.initTemplateDataTable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void run() {
openId = msgData[0];
wxMaTemplateMessage = PushManage.makeMaTemplateMessage(msgData);
wxMaTemplateMessage.setToUser(openId);
wxMaTemplateMessage.setFormId(msgData[1]);
// 空跑控制
if (!MainWindow.mainWindow.getDryRunCheckBox().isSelected()) {
wxMaService.getMsgService().sendTemplateMsg(wxMaTemplateMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ConstantsUI {
* 软件名称,版本
*/
public final static String APP_NAME = "WePush";
public final static String APP_VERSION = "v_2.1.0_180509";
public final static String APP_VERSION = "v_2.2.0_180516";

/**
* 主窗口图标
Expand Down
24 changes: 2 additions & 22 deletions src/main/java/com/fangxuele/tool/wechat/push/ui/Init.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ public static void initMsgTab(String selectedMsgName) {
MainWindow.mainWindow.setMsgKefuUrlTextField("");
MainWindow.mainWindow.setMsgTemplateMiniAppidTextField("");
MainWindow.mainWindow.setMsgTemplateMiniPagePathTextField("");
MainWindow.mainWindow.setMsgTemplateFormIdTextField("");
MainWindow.mainWindow.setMsgTemplateColorTextField("");
MainWindow.mainWindow.setMsgTemplateKeyWordTextField("");

String msgName;
Expand Down Expand Up @@ -256,10 +254,8 @@ public static void initMsgTab(String selectedMsgName) {
MainWindow.mainWindow.setMsgKefuPicUrlTextField(msgDataArray[6]);
MainWindow.mainWindow.setMsgKefuDescTextField(msgDataArray[7]);
MainWindow.mainWindow.setMsgKefuUrlTextField(msgDataArray[8]);
if (msgDataArray.length > 11) {
MainWindow.mainWindow.setMsgTemplateFormIdTextField(msgDataArray[11]);
MainWindow.mainWindow.setMsgTemplateColorTextField(msgDataArray[12]);
MainWindow.mainWindow.setMsgTemplateKeyWordTextField(msgDataArray[13]);
if (msgDataArray.length > 10) {
MainWindow.mainWindow.setMsgTemplateKeyWordTextField(msgDataArray[11]);
}
if (msgDataArray.length > 9) {
MainWindow.mainWindow.setMsgTemplateMiniAppidTextField(msgDataArray[9]);
Expand Down Expand Up @@ -319,11 +315,7 @@ public static void switchMsgType(String msgType) {
MainWindow.mainWindow.getTemplateMiniProgramOptionalLabel2().setVisible(true);
MainWindow.mainWindow.getTemplateMsgColorLabel().setVisible(true);
MainWindow.mainWindow.getTemplateDataColorTextField().setVisible(true);
MainWindow.mainWindow.getMsgTemplateFormIdTextField().setVisible(false);
MainWindow.mainWindow.getMsgTemplateColorTextField().setVisible(false);
MainWindow.mainWindow.getMsgTemplateKeyWordTextField().setVisible(false);
MainWindow.mainWindow.getTemplateFormIdLabel().setVisible(false);
MainWindow.mainWindow.getTemplateColorLabel().setVisible(false);
MainWindow.mainWindow.getTemplateKeyWordLabel().setVisible(false);
MainWindow.mainWindow.getPreviewMemberLabel().setText("预览消息用户openid(以半角分号分隔)");

Expand All @@ -341,11 +333,7 @@ public static void switchMsgType(String msgType) {
MainWindow.mainWindow.getTemplateMiniProgramOptionalLabel2().setVisible(false);
MainWindow.mainWindow.getTemplateMsgColorLabel().setVisible(true);
MainWindow.mainWindow.getTemplateDataColorTextField().setVisible(true);
MainWindow.mainWindow.getMsgTemplateFormIdTextField().setVisible(true);
MainWindow.mainWindow.getMsgTemplateColorTextField().setVisible(true);
MainWindow.mainWindow.getMsgTemplateKeyWordTextField().setVisible(true);
MainWindow.mainWindow.getTemplateFormIdLabel().setVisible(true);
MainWindow.mainWindow.getTemplateColorLabel().setVisible(true);
MainWindow.mainWindow.getTemplateKeyWordLabel().setVisible(true);
MainWindow.mainWindow.getPreviewMemberLabel().setText("预览消息用户openid(以半角分号分隔)");

Expand All @@ -367,11 +355,7 @@ public static void switchMsgType(String msgType) {
MainWindow.mainWindow.getTemplateMiniProgramOptionalLabel2().setVisible(true);
MainWindow.mainWindow.getTemplateMsgColorLabel().setVisible(true);
MainWindow.mainWindow.getTemplateDataColorTextField().setVisible(true);
MainWindow.mainWindow.getMsgTemplateFormIdTextField().setVisible(false);
MainWindow.mainWindow.getMsgTemplateColorTextField().setVisible(false);
MainWindow.mainWindow.getMsgTemplateKeyWordTextField().setVisible(false);
MainWindow.mainWindow.getTemplateFormIdLabel().setVisible(false);
MainWindow.mainWindow.getTemplateColorLabel().setVisible(false);
MainWindow.mainWindow.getTemplateKeyWordLabel().setVisible(false);
MainWindow.mainWindow.getPreviewMemberLabel().setText("预览消息用户openid(以半角分号分隔)");
break;
Expand All @@ -390,11 +374,7 @@ public static void switchMsgType(String msgType) {
MainWindow.mainWindow.getTemplateMiniProgramOptionalLabel2().setVisible(false);
MainWindow.mainWindow.getTemplateMsgColorLabel().setVisible(false);
MainWindow.mainWindow.getTemplateDataColorTextField().setVisible(false);
MainWindow.mainWindow.getMsgTemplateFormIdTextField().setVisible(false);
MainWindow.mainWindow.getMsgTemplateColorTextField().setVisible(false);
MainWindow.mainWindow.getMsgTemplateKeyWordTextField().setVisible(false);
MainWindow.mainWindow.getTemplateFormIdLabel().setVisible(false);
MainWindow.mainWindow.getTemplateColorLabel().setVisible(false);
MainWindow.mainWindow.getTemplateKeyWordLabel().setVisible(false);
MainWindow.mainWindow.getPreviewMemberLabel().setText("预览消息用户手机号(以半角分号分隔)");
break;
Expand Down
62 changes: 14 additions & 48 deletions src/main/java/com/fangxuele/tool/wechat/push/ui/MainWindow.form
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
</component>
</children>
</grid>
<grid id="b0ec9" binding="templateMsgPanel" layout-manager="GridLayoutManager" row-count="8" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="b0ec9" binding="templateMsgPanel" layout-manager="GridLayoutManager" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
Expand Down Expand Up @@ -300,7 +300,7 @@
</component>
<component id="19629" class="javax.swing.JLabel" binding="templateUrlLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="11d29"/>
Expand All @@ -309,7 +309,7 @@
</component>
<component id="11d29" class="javax.swing.JTextField" binding="msgTemplateUrlTextField">
<constraints>
<grid row="2" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="7" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="1" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="7" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
Expand All @@ -318,7 +318,7 @@
<grid id="4d00f" binding="templateMsgDataPanel" layout-manager="GridLayoutManager" row-count="2" column-count="7" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="0" bottom="0" right="0"/>
<constraints>
<grid row="7" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="5" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="etched" title="模板消息数据配置(可使用&quot;$ENTER$&quot;作为换行符)" title-position="1"/>
Expand Down Expand Up @@ -405,7 +405,7 @@
</grid>
<component id="1a727" class="javax.swing.JLabel" binding="templateMiniProgramAppidLabel">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="5d5e9"/>
Expand All @@ -414,7 +414,7 @@
</component>
<component id="5d5e9" class="javax.swing.JTextField" binding="msgTemplateMiniAppidTextField">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
Expand All @@ -424,7 +424,7 @@
</component>
<component id="9a69a" class="javax.swing.JLabel" binding="templateMiniProgramPagePathLabel">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="559c5"/>
Expand All @@ -433,7 +433,7 @@
</component>
<component id="559c5" class="javax.swing.JTextField" binding="msgTemplateMiniPagePathTextField">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
Expand All @@ -443,40 +443,23 @@
</component>
<component id="bb7a9" class="javax.swing.JLabel" binding="templateMiniProgramOptionalLabel1">
<constraints>
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="(选填)"/>
</properties>
</component>
<component id="b9a20" class="javax.swing.JLabel" binding="templateMiniProgramOptionalLabel2">
<constraints>
<grid row="6" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="(选填)"/>
</properties>
</component>
<component id="da3a1" class="javax.swing.JLabel" binding="templateColorLabel">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="11d29"/>
<text value="字体颜色"/>
</properties>
</component>
<component id="98da8" class="javax.swing.JTextField" binding="msgTemplateColorTextField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="7" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="1e2ab" class="javax.swing.JLabel" binding="templateKeyWordLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="11d29"/>
Expand All @@ -485,24 +468,7 @@
</component>
<component id="5fb1f" class="javax.swing.JTextField" binding="msgTemplateKeyWordTextField">
<constraints>
<grid row="4" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="7" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="183c7" class="javax.swing.JLabel" binding="templateFormIdLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="11d29"/>
<text value="FormId"/>
</properties>
</component>
<component id="49d5e" class="javax.swing.JTextField" binding="msgTemplateFormIdTextField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="7" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="2" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="7" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
Expand Down Expand Up @@ -2424,15 +2390,15 @@
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="如果WePush能给您带来一些便利,或者有任何想法可以让WePush变的更好"/>
<text value="如果WePush能给您带来一些便利"/>
</properties>
</component>
<component id="631d1" class="javax.swing.JLabel">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="欢迎将您的产品和想法邮件告诉我:rememberber@163.com"/>
<text value="欢迎将您的产品邮件告诉我:rememberber@163.com"/>
</properties>
</component>
</children>
Expand Down
Loading

0 comments on commit dcb6c80

Please sign in to comment.