fix wechat mp session rotation and bootstrap reuse
This commit is contained in:
@@ -2259,6 +2259,21 @@ export function createUserAuth(pool, options = {}) {
|
||||
);
|
||||
};
|
||||
|
||||
const countWechatAgentSessionMessages = async ({
|
||||
appId,
|
||||
openid,
|
||||
agentSessionId,
|
||||
}) => {
|
||||
if (!appId || !openid || !agentSessionId) return 0;
|
||||
const [rows] = await pool.query(
|
||||
`SELECT COUNT(*) AS count
|
||||
FROM h5_wechat_mp_messages
|
||||
WHERE app_id = ? AND openid = ? AND agent_session_id = ?`,
|
||||
[appId, openid, agentSessionId],
|
||||
);
|
||||
return Number(rows?.[0]?.count ?? 0);
|
||||
};
|
||||
|
||||
const recordWechatMpMessage = async ({
|
||||
appId,
|
||||
openid,
|
||||
@@ -2845,6 +2860,7 @@ export function createUserAuth(pool, options = {}) {
|
||||
upsertWechatAgentRoute,
|
||||
clearWechatAgentRoute,
|
||||
touchWechatAgentRoute,
|
||||
countWechatAgentSessionMessages,
|
||||
recordWechatMpMessage,
|
||||
finishWechatMpMessage,
|
||||
insertWechatMpMessageDetail,
|
||||
|
||||
Reference in New Issue
Block a user