remove mark
This commit is contained in:
@@ -5,7 +5,7 @@ import { useContextKey } from '@kevisual/context';
|
||||
import { Redis } from 'ioredis';
|
||||
import http from 'node:http';
|
||||
import { Wx, WxMsgEvent, parseWxMessage } from './wx/index.ts';
|
||||
import { config } from './modules/config.ts';
|
||||
import { contextConfig as config } from './modules/config.ts';
|
||||
import { loginByTicket } from './wx/login-by-ticket.ts';
|
||||
export const simpleRouter: SimpleRouter = await useContextKey('router');
|
||||
export const redis: Redis = await useContextKey('redis');
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
import { useConfig } from "@kevisual/context";
|
||||
import { useConfig as useContextConfig } from "@kevisual/context";
|
||||
|
||||
type Config = {
|
||||
WX_MP_APP_ID: string;
|
||||
WX_MP_APP_SECRET: string;
|
||||
}
|
||||
export const config = useConfig<Config>();
|
||||
export const contextConfig = useContextConfig<Config>();
|
||||
|
||||
import { useConfig } from '@kevisual/use-config';
|
||||
|
||||
export const config = useConfig()
|
||||
|
||||
console.log('配置项:', config);
|
||||
9
wxmsg/src/queue.ts
Normal file
9
wxmsg/src/queue.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Queue } from 'bullmq';
|
||||
|
||||
export const wxmsgQueue = new Queue('wxmsg', {
|
||||
connection: {
|
||||
host: process.env.REDIS_HOST || 'kevisual.cn',
|
||||
port: parseInt(process.env.REDIS_PORT || '6379'),
|
||||
password: process.env.REDIS_PASSWORD,
|
||||
}
|
||||
});
|
||||
@@ -1,6 +1,8 @@
|
||||
import { getAccessToken } from './get-access-token.ts';
|
||||
import { Redis } from 'ioredis';
|
||||
import { WxCustomServiceMsg, WxMsgText } from './type/custom-service.ts';
|
||||
import { Queue } from 'bullmq';
|
||||
import { useContextKey } from "@kevisual/context";
|
||||
|
||||
export * from './type/custom-service.ts';
|
||||
export * from './type/send.ts';
|
||||
@@ -46,18 +48,14 @@ export class Wx {
|
||||
console.log('Analyzed message:', { touser, msgType });
|
||||
return;
|
||||
}
|
||||
const txtMsg = msg as WxMsgText;
|
||||
const content = txtMsg.content;
|
||||
|
||||
console.log('Analyzing user message:', { touser, msgType, content });
|
||||
const sendData = {
|
||||
touser,
|
||||
msgtype: 'text',
|
||||
text: {
|
||||
content: 'Hello World',
|
||||
},
|
||||
const wxmsgQueue = useContextKey<Queue>('wxmsgQueue');
|
||||
if (!wxmsgQueue) {
|
||||
throw new Error('wxmsgQueue is not available in context.');
|
||||
}
|
||||
this.sendUserMessage(sendData);
|
||||
wxmsgQueue.add('analyzeUserMsg', {
|
||||
touser,
|
||||
msg,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 发送客服消息
|
||||
|
||||
Reference in New Issue
Block a user