Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-general-business into dev
This commit is contained in:
commit
66fd05cb26
|
|
@ -104,13 +104,14 @@ export async function createSession(params, context) {
|
|||
origin: 'wechat',
|
||||
type: 'image',
|
||||
tag1: 'image',
|
||||
objectId: generateNewIdAsync(),
|
||||
objectId: await generateNewIdAsync(),
|
||||
sort: 1000,
|
||||
uploadState: 'success',
|
||||
extra1: data.MediaId,
|
||||
extra2: {
|
||||
isPermanent: false,
|
||||
},
|
||||
filename: data.MediaId,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
@ -128,10 +129,11 @@ export async function createSession(params, context) {
|
|||
origin: 'wechat',
|
||||
type: 'video',
|
||||
tag1: 'video',
|
||||
objectId: generateNewIdAsync(),
|
||||
objectId: await generateNewIdAsync(),
|
||||
sort: 1000,
|
||||
uploadState: 'success',
|
||||
extra1: data.MediaId,
|
||||
filename: data.MediaId,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
@ -149,10 +151,11 @@ export async function createSession(params, context) {
|
|||
origin: 'wechat',
|
||||
type: 'audio',
|
||||
tag1: 'audio',
|
||||
objectId: generateNewIdAsync(),
|
||||
objectId: await generateNewIdAsync(),
|
||||
sort: 1000,
|
||||
uploadState: 'success',
|
||||
extra1: data.MediaId,
|
||||
filename: data.MediaId,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -459,7 +459,7 @@ async function setSubscribedEventKey(openId, eventKey, context) {
|
|||
}
|
||||
}
|
||||
}
|
||||
function onWeChatPublicEvent(data, context) {
|
||||
async function onWeChatPublicEvent(data, context) {
|
||||
const { ToUserName, FromUserName, CreateTime, MsgType, Event, EventKey, } = data;
|
||||
const appId = context.getApplicationId();
|
||||
let evt;
|
||||
|
|
@ -542,6 +542,7 @@ function onWeChatPublicEvent(data, context) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
createSession({ data, type: 'wechatPublic', entity: 'application', entityId: appId }, context);
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log(evt);
|
||||
}
|
||||
|
|
@ -550,8 +551,14 @@ function onWeChatPublicEvent(data, context) {
|
|||
contentType: 'application/xml',
|
||||
};
|
||||
}
|
||||
function onWeChatMpEvent(data, context) {
|
||||
const content = createSession({ data, type: 'wechatMp' }, context);
|
||||
async function onWeChatMpEvent(data, context) {
|
||||
const appId = context.getApplicationId();
|
||||
createSession({
|
||||
data,
|
||||
type: 'wechatMp',
|
||||
entity: 'application',
|
||||
entityId: appId,
|
||||
}, context);
|
||||
return {
|
||||
content: 'success'
|
||||
};
|
||||
|
|
@ -571,7 +578,7 @@ const endpoints = {
|
|||
}
|
||||
await context.setApplication(appId);
|
||||
const { xml: data } = X2Js.xml2js(body);
|
||||
const { content, contentType } = onWeChatPublicEvent(data, context);
|
||||
const { content, contentType } = await onWeChatPublicEvent(data, context);
|
||||
return content;
|
||||
},
|
||||
},
|
||||
|
|
@ -633,12 +640,12 @@ const endpoints = {
|
|||
throw new Error(`请配置:“微信小程序-服务器配置”`);
|
||||
}
|
||||
if (server?.dataFormat === 'json') {
|
||||
const { content } = onWeChatMpEvent(body, context);
|
||||
const { content } = await onWeChatMpEvent(body, context);
|
||||
return content;
|
||||
}
|
||||
else {
|
||||
const { xml: data } = X2Js.xml2js(body);
|
||||
const { content } = onWeChatMpEvent(data, context);
|
||||
const { content } = await onWeChatMpEvent(data, context);
|
||||
return content;
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -107,13 +107,14 @@ async function createSession(params, context) {
|
|||
origin: 'wechat',
|
||||
type: 'image',
|
||||
tag1: 'image',
|
||||
objectId: (0, uuid_1.generateNewIdAsync)(),
|
||||
objectId: await (0, uuid_1.generateNewIdAsync)(),
|
||||
sort: 1000,
|
||||
uploadState: 'success',
|
||||
extra1: data.MediaId,
|
||||
extra2: {
|
||||
isPermanent: false,
|
||||
},
|
||||
filename: data.MediaId,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
@ -131,10 +132,11 @@ async function createSession(params, context) {
|
|||
origin: 'wechat',
|
||||
type: 'video',
|
||||
tag1: 'video',
|
||||
objectId: (0, uuid_1.generateNewIdAsync)(),
|
||||
objectId: await (0, uuid_1.generateNewIdAsync)(),
|
||||
sort: 1000,
|
||||
uploadState: 'success',
|
||||
extra1: data.MediaId,
|
||||
filename: data.MediaId,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
@ -152,10 +154,11 @@ async function createSession(params, context) {
|
|||
origin: 'wechat',
|
||||
type: 'audio',
|
||||
tag1: 'audio',
|
||||
objectId: (0, uuid_1.generateNewIdAsync)(),
|
||||
objectId: await (0, uuid_1.generateNewIdAsync)(),
|
||||
sort: 1000,
|
||||
uploadState: 'success',
|
||||
extra1: data.MediaId,
|
||||
filename: data.MediaId,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ async function setSubscribedEventKey(openId, eventKey, context) {
|
|||
}
|
||||
}
|
||||
}
|
||||
function onWeChatPublicEvent(data, context) {
|
||||
async function onWeChatPublicEvent(data, context) {
|
||||
const { ToUserName, FromUserName, CreateTime, MsgType, Event, EventKey, } = data;
|
||||
const appId = context.getApplicationId();
|
||||
let evt;
|
||||
|
|
@ -547,6 +547,7 @@ function onWeChatPublicEvent(data, context) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
(0, session_1.createSession)({ data, type: 'wechatPublic', entity: 'application', entityId: appId }, context);
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log(evt);
|
||||
}
|
||||
|
|
@ -555,8 +556,14 @@ function onWeChatPublicEvent(data, context) {
|
|||
contentType: 'application/xml',
|
||||
};
|
||||
}
|
||||
function onWeChatMpEvent(data, context) {
|
||||
const content = (0, session_1.createSession)({ data, type: 'wechatMp' }, context);
|
||||
async function onWeChatMpEvent(data, context) {
|
||||
const applicationId = context.getApplicationId();
|
||||
(0, session_1.createSession)({
|
||||
data,
|
||||
type: 'wechatMp',
|
||||
entity: 'application',
|
||||
entityId: applicationId,
|
||||
}, context);
|
||||
return {
|
||||
content: 'success'
|
||||
};
|
||||
|
|
@ -576,7 +583,7 @@ const endpoints = {
|
|||
}
|
||||
await context.setApplication(appId);
|
||||
const { xml: data } = X2Js.xml2js(body);
|
||||
const { content, contentType } = onWeChatPublicEvent(data, context);
|
||||
const { content, contentType } = await onWeChatPublicEvent(data, context);
|
||||
return content;
|
||||
},
|
||||
},
|
||||
|
|
@ -638,12 +645,12 @@ const endpoints = {
|
|||
throw new Error(`请配置:“微信小程序-服务器配置”`);
|
||||
}
|
||||
if (server?.dataFormat === 'json') {
|
||||
const { content } = onWeChatMpEvent(body, context);
|
||||
const { content } = await onWeChatMpEvent(body, context);
|
||||
return content;
|
||||
}
|
||||
else {
|
||||
const { xml: data } = X2Js.xml2js(body);
|
||||
const { content } = onWeChatMpEvent(data, context);
|
||||
const { content } = await onWeChatMpEvent(data, context);
|
||||
return content;
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -148,13 +148,14 @@ export async function createSession<
|
|||
origin: 'wechat',
|
||||
type: 'image',
|
||||
tag1: 'image',
|
||||
objectId: generateNewIdAsync(), // 这个域用来标识唯一性
|
||||
objectId: await generateNewIdAsync(), // 这个域用来标识唯一性
|
||||
sort: 1000,
|
||||
uploadState: 'success',
|
||||
extra1: data.MediaId,
|
||||
extra2: {
|
||||
isPermanent: false,
|
||||
},
|
||||
filename: data.MediaId,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
@ -171,10 +172,11 @@ export async function createSession<
|
|||
origin: 'wechat',
|
||||
type: 'video',
|
||||
tag1: 'video',
|
||||
objectId: generateNewIdAsync(), // 这个域用来标识唯一性
|
||||
objectId: await generateNewIdAsync(), // 这个域用来标识唯一性
|
||||
sort: 1000,
|
||||
uploadState: 'success',
|
||||
extra1: data.MediaId,
|
||||
filename: data.MediaId,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
@ -191,10 +193,11 @@ export async function createSession<
|
|||
origin: 'wechat',
|
||||
type: 'audio',
|
||||
tag1: 'audio',
|
||||
objectId: generateNewIdAsync(), // 这个域用来标识唯一性
|
||||
objectId: await generateNewIdAsync(), // 这个域用来标识唯一性
|
||||
sort: 1000,
|
||||
uploadState: 'success',
|
||||
extra1: data.MediaId,
|
||||
filename: data.MediaId,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -609,7 +609,7 @@ async function setSubscribedEventKey(
|
|||
}
|
||||
}
|
||||
|
||||
function onWeChatPublicEvent(data: WechatPublicEventData, context: BRC) {
|
||||
async function onWeChatPublicEvent(data: WechatPublicEventData, context: BRC) {
|
||||
const {
|
||||
ToUserName,
|
||||
FromUserName,
|
||||
|
|
@ -714,6 +714,12 @@ function onWeChatPublicEvent(data: WechatPublicEventData, context: BRC) {
|
|||
}
|
||||
}
|
||||
|
||||
createSession(
|
||||
{ data, type: 'wechatPublic', entity: 'application', entityId: appId },
|
||||
context
|
||||
);
|
||||
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log(evt);
|
||||
}
|
||||
|
|
@ -723,8 +729,17 @@ function onWeChatPublicEvent(data: WechatPublicEventData, context: BRC) {
|
|||
};
|
||||
}
|
||||
|
||||
function onWeChatMpEvent(data: WechatMpEventData, context: BRC) {
|
||||
const content = createSession({ data, type: 'wechatMp' }, context)
|
||||
async function onWeChatMpEvent(data: WechatMpEventData, context: BRC) {
|
||||
const appId = context.getApplicationId();
|
||||
createSession(
|
||||
{
|
||||
data,
|
||||
type: 'wechatMp',
|
||||
entity: 'application',
|
||||
entityId: appId,
|
||||
},
|
||||
context
|
||||
);
|
||||
return {
|
||||
content: 'success'
|
||||
}
|
||||
|
|
@ -747,7 +762,7 @@ const endpoints: Record<string, Endpoint<EntityDict, BRC>> = {
|
|||
const { xml: data } = X2Js.xml2js<{
|
||||
xml: WechatPublicEventData;
|
||||
}>(body);
|
||||
const { content, contentType } = onWeChatPublicEvent(
|
||||
const { content, contentType } = await onWeChatPublicEvent(
|
||||
data,
|
||||
context
|
||||
);
|
||||
|
|
@ -821,13 +836,13 @@ const endpoints: Record<string, Endpoint<EntityDict, BRC>> = {
|
|||
throw new Error(`请配置:“微信小程序-服务器配置”`);
|
||||
}
|
||||
if (server?.dataFormat === 'json') {
|
||||
const { content } = onWeChatMpEvent(body, context);
|
||||
const { content } = await onWeChatMpEvent(body, context);
|
||||
return content;
|
||||
} else {
|
||||
const { xml: data } = X2Js.xml2js<{
|
||||
xml: WechatMpEventData;
|
||||
}>(body);
|
||||
const { content } = onWeChatMpEvent(data, context);
|
||||
const { content } = await onWeChatMpEvent(data, context);
|
||||
return content;
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue