-
Notifications
You must be signed in to change notification settings - Fork 995
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from rememberber/develop
Develop
- Loading branch information
Showing
32 changed files
with
1,238 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/main/java/com/fangxuele/tool/push/bean/account/TxYun3AccountConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.fangxuele.tool.push.bean.account; | ||
|
||
import lombok.Data; | ||
|
||
/** | ||
* 腾讯云3.0账号配置 | ||
*/ | ||
@Data | ||
public class TxYun3AccountConfig { | ||
private String secretId; | ||
private String secretKey; | ||
private String endPoint; | ||
private String region; | ||
private String sign; | ||
private String sdkAppId; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/main/java/com/fangxuele/tool/push/logic/msgmaker/TxYun3MsgMaker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.fangxuele.tool.push.logic.msgmaker; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
import com.fangxuele.tool.push.bean.TemplateData; | ||
import com.fangxuele.tool.push.domain.TMsg; | ||
import com.fangxuele.tool.push.domain.TMsgSms; | ||
import com.fangxuele.tool.push.util.TemplateUtil; | ||
import lombok.Getter; | ||
import org.apache.velocity.VelocityContext; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* <pre> | ||
* 腾讯云3.0模板短信加工器 | ||
* </pre> | ||
* | ||
* @author <a href="https://github.com/rememberber">Zhou Bo</a> | ||
* @since 2023/9/4. | ||
*/ | ||
@Getter | ||
public class TxYun3MsgMaker extends BaseMsgMaker implements IMsgMaker { | ||
|
||
private String templateId; | ||
|
||
private List<String> paramList; | ||
|
||
public TxYun3MsgMaker(TMsg tMsg) { | ||
TMsgSms tMsgSms = JSON.parseObject(tMsg.getContent(), TMsgSms.class); | ||
this.templateId = tMsgSms.getTemplateId(); | ||
paramList = new ArrayList<>(); | ||
for (TemplateData templateData : tMsgSms.getTemplateDataList()) { | ||
paramList.add(templateData.getValue()); | ||
} | ||
} | ||
|
||
/** | ||
* 组织腾讯云短信消息 | ||
* | ||
* @param msgData 消息信息 | ||
* @return String[] | ||
*/ | ||
@Override | ||
public String[] makeMsg(String[] msgData) { | ||
|
||
VelocityContext velocityContext = getVelocityContext(msgData); | ||
for (int i = 0; i < paramList.size(); i++) { | ||
paramList.set(i, TemplateUtil.evaluate(paramList.get(i), velocityContext)); | ||
} | ||
String[] paramArray = new String[paramList.size()]; | ||
return paramList.toArray(paramArray); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.