使wechatQrCode的动态行为更加精准
This commit is contained in:
parent
61ad1f3fe1
commit
12eb0ed6c5
|
|
@ -9,7 +9,7 @@ const uuid_1 = require("oak-domain/lib/utils/uuid");
|
|||
const lodash_1 = require("lodash");
|
||||
const triggers = [
|
||||
{
|
||||
name: '选择userEntityGrant时,动态生成需要的数据',
|
||||
name: '选择wechatQrCode时,动态生成需要的数据',
|
||||
entity: 'wechatQrCode',
|
||||
action: 'select',
|
||||
when: 'after',
|
||||
|
|
@ -21,9 +21,8 @@ const triggers = [
|
|||
const config2 = config;
|
||||
const { appId, appSecret } = config2;
|
||||
for (const code of result) {
|
||||
const { type, expired, url, id } = code;
|
||||
console.log('code', code);
|
||||
if (type === 'wechatMpWxaCode') {
|
||||
const { type, expired, id } = code;
|
||||
if (type === 'wechatMpWxaCode' && code.hasOwnProperty('buffer')) {
|
||||
// 小程序码去实时获取(暂时不考虑缓存)
|
||||
const wechatInstance = oak_external_sdk_1.WechatSDK.getInstance(appId, appSecret, 'wechatMp');
|
||||
const buffer = await wechatInstance.getMpUnlimitWxaCode({
|
||||
|
|
@ -35,8 +34,9 @@ const triggers = [
|
|||
(0, lodash_1.assign)(code, {
|
||||
buffer: str,
|
||||
});
|
||||
count++;
|
||||
}
|
||||
else if (expired) {
|
||||
else if (expired && code.hasOwnProperty('url')) {
|
||||
// 如果过期了,在这里生成新的临时码并修改值(公众号)
|
||||
throw new Error('not implemented yet');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { assign } from 'lodash';
|
|||
|
||||
const triggers: Trigger<EntityDict, 'wechatQrCode', GeneralRuntimeContext<EntityDict>>[] = [
|
||||
{
|
||||
name: '选择userEntityGrant时,动态生成需要的数据',
|
||||
name: '选择wechatQrCode时,动态生成需要的数据',
|
||||
entity: 'wechatQrCode',
|
||||
action: 'select',
|
||||
when: 'after',
|
||||
|
|
@ -23,9 +23,8 @@ const triggers: Trigger<EntityDict, 'wechatQrCode', GeneralRuntimeContext<Entity
|
|||
const config2 = config as WechatMpConfig;
|
||||
const { appId, appSecret } = config2;
|
||||
for (const code of result) {
|
||||
const { type, expired, url, id } = code;
|
||||
console.log('code', code);
|
||||
if (type === 'wechatMpWxaCode') {
|
||||
const { type, expired, id } = code;
|
||||
if (type === 'wechatMpWxaCode' && code.hasOwnProperty('buffer')) {
|
||||
// 小程序码去实时获取(暂时不考虑缓存)
|
||||
const wechatInstance = WechatSDK.getInstance(appId, appSecret, 'wechatMp');
|
||||
const buffer = await wechatInstance.getMpUnlimitWxaCode({
|
||||
|
|
@ -37,8 +36,9 @@ const triggers: Trigger<EntityDict, 'wechatQrCode', GeneralRuntimeContext<Entity
|
|||
assign(code, {
|
||||
buffer: str,
|
||||
});
|
||||
count ++;
|
||||
}
|
||||
else if (expired) {
|
||||
else if (expired && code.hasOwnProperty('url')) {
|
||||
// 如果过期了,在这里生成新的临时码并修改值(公众号)
|
||||
throw new Error('not implemented yet');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue