Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

根据通过方法,增加了不通过方法 #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.scutsu.market.services.wechat;

import lombok.Builder;
import lombok.Value;

import java.time.LocalDateTime;

@Value
@Builder
public class ReviewChangeRequestedMessage {
String title;
String comment;
String remark;
LocalDateTime submittedTime;
LocalDateTime reviewedTime;
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ public void sendReviewApproved(ReviewApprovedMessage message, @Nullable String f
send("review-approved", messageMap, formId, openId);
}

@Async
public void sendReviewChangeRequested(ReviewChangeRequestedMessage message, @Nullable String formId, String openId){
DateTimeFormatter formatter=DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM);
Map<String,String> messageMap=Map.of(
"titile",message.getTitle(),
"comment",message.getComment(),
"remark", Optional.ofNullable(message.getRemark()).orElse("很抱歉,你的商品未能通过审核,你可以根据审核结果修改商品信息后重新发起审核"),
"submitted-time",message.getSubmittedTime().format(formatter),
"reviewed-time",message.getReviewedTime().format(formatter)
);
send("review-change-requested",messageMap,formId,openId);
}

private void send(String templateName, Map<String, String> message, @Nullable String formId, String openId) {
if (!properties.getTemplates().containsKey(templateName)) {
log.warn("template {} not configured", templateName);
Expand Down