每日菜谱导入前增加预览效果

This commit is contained in:
zjf committed 2026-09-04 13:46:24 +08:00
1 parent 1271a2d743
commit da07e0f454
29 files changed
+2607 -21

No files matched your search

@@ -0,0 +1,46 @@
package com.bsd.pjcloud.thirdparty.api.feign;
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.feign.annotation.NoToken;
import com.bsd.pjcloud.thirdparty.vo.wxopen.WxOpenPushMessageVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 微信开放平台消息推送内部能力,业务服务按需调用。
*/
@FeignClient(contextId = "remoteWxOpenMessagePushService", value = ServiceNameConstants.THIRDPARTY_SERVICE)
public interface RemoteWxOpenMessagePushService {
/**
* 读取最新缓存的 component_verify_ticket。
*/
@NoToken
@GetMapping("/wx-open-remoter/component-verify-ticket")
R<String> getComponentVerifyTicket();
/**
* 加密业务回包为微信安全模式 XML(需自行作为 HTTP 响应体返回给微信)。
*
* @param plainXml 回包明文 XML
* @param timestamp 时间戳,可空则服务端生成
* @param nonce 随机串,可空则服务端生成
*/
@NoToken
@PostMapping("/wx-open-remoter/encrypt-reply")
R<String> encryptReply(@RequestBody String plainXml,
@RequestParam(value = "timestamp", required = false) String timestamp,
@RequestParam(value = "nonce", required = false) String nonce);
/**
* 供联调或内部重放:按已解密消息结构手动派发给本地 Handler(不落微信回包协议)。
*/
@NoToken
@PostMapping("/wx-open-remoter/dispatch")
R<String> dispatch(@RequestBody WxOpenPushMessageVO message);
}
@@ -0,0 +1,31 @@
package com.bsd.pjcloud.thirdparty.constant.wxopen;
import com.bsd.pjcloud.common.core.constant.CacheConstants;
/**
* 微信开放平台第三方消息推送常量。
*/
public interface WxOpenMessagePushConstants {
/** Redis 中缓存的 component_verify_ticket,全局共享。 */
String COMPONENT_VERIFY_TICKET_KEY = CacheConstants.GLOBALLY + "wx:open:component_verify_ticket";
/** ticket 缓存时长(秒);微信约每 10 分钟刷新,有效期 12 小时,这里按 11 小时保存。 */
long COMPONENT_VERIFY_TICKET_TTL_SECONDS = 11 * 60 * 60L;
/** 授权事件:推送 component_verify_ticket。 */
String INFO_TYPE_COMPONENT_VERIFY_TICKET = "component_verify_ticket";
/** 授权事件:授权成功。 */
String INFO_TYPE_AUTHORIZED = "authorized";
/** 授权事件:更新授权。 */
String INFO_TYPE_UPDATE_AUTHORIZED = "updateauthorized";
/** 授权事件:取消授权。 */
String INFO_TYPE_UNAUTHORIZED = "unauthorized";
/** 微信要求的成功回包。 */
String SUCCESS = "success";
}
@@ -0,0 +1,69 @@
package com.bsd.pjcloud.thirdparty.vo.wxopen;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 微信开放平台消息推送解密后的业务视图,供业务侧消费。
*/
@Data
public class WxOpenPushMessageVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 推送通道:auth=授权事件接收;message=消息与事件接收。
*/
private String channel;
/**
* 代接收消息的授权方 AppId;授权事件通道可能为空。
*/
private String authorizerAppId;
/**
* 第三方平台 AppId(解密校验后的值)。
*/
private String componentAppId;
/**
* 授权事件 InfoType,如 component_verify_ticket / authorized。
*/
private String infoType;
/**
* 普通消息 MsgType,如 event / text。
*/
private String msgType;
/**
* 事件类型 Event。
*/
private String event;
/**
* component_verify_ticket 原文。
*/
private String componentVerifyTicket;
/**
* 授权码,授权成功/更新授权时存在。
*/
private String authorizationCode;
/**
* 解密后的完整明文 XML。
*/
private String plainXml;
/**
* 明文 XML 解析出的扁平字段,便于业务按需取值。
*/
private Map<String, String> fields = new LinkedHashMap<>();
}