build的一些修正

This commit is contained in:
Xu Chang 2023-04-05 14:22:20 +08:00
parent b0aa05c33b
commit 43bdaeb51b
45 changed files with 229 additions and 76 deletions

View File

@ -5,31 +5,37 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
detail: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
areaId: {
notNull: true,
type: "ref",
ref: "area"
},
phone: {
notNull: true,
type: "varchar",
params: {
length: 12
}
},
name: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
default: {
notNull: true,
type: "boolean"
},
remark: {
notNull: true,
type: "text"
}
},

View File

@ -5,23 +5,28 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
name: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
description: {
notNull: true,
type: "text"
},
type: {
notNull: true,
type: "enum",
enumeration: ["web", "wechatMp", "wechatPublic"]
},
systemId: {
notNull: true,
type: "ref",
ref: "system"
},
config: {
notNull: true,
type: "object"
},
style: {

View File

@ -5,16 +5,19 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
name: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
level: {
notNull: true,
type: "enum",
enumeration: ["province", "city", "district", "street", "country"]
},
depth: {
notNull: true,
type: "int",
params: {
width: 4
@ -25,12 +28,14 @@ exports.desc = {
ref: "area"
},
code: {
notNull: true,
type: "varchar",
params: {
length: 12
}
},
center: {
notNull: true,
type: "geometry"
}
},

View File

@ -5,9 +5,9 @@ var IActionDef = {
stm: {
online: ['offline', 'online'],
offline: ['online', 'offline'],
disabled: [['online', 'offline'], 'disabled']
disabled: [['online', 'offline'], 'disabled'],
},
is: 'offline'
is: 'offline',
};
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "online", "offline", "disabled"];
exports.ActionDefDict = {

View File

@ -17,12 +17,14 @@ exports.desc = {
}
},
title: {
notNull: true,
type: "varchar",
params: {
length: 128
}
},
author: {
notNull: true,
type: "varchar",
params: {
length: 32
@ -38,6 +40,7 @@ exports.desc = {
type: "text"
},
sign: {
notNull: true,
type: "varchar",
params: {
length: 32

View File

@ -5,9 +5,9 @@ var IActionDef = {
stm: {
send: ['unsent', 'sending'],
success: ['sending', 'sent'],
fail: ['sending', 'failure']
fail: ['sending', 'failure'],
},
is: 'unsent'
is: 'unsent',
};
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "send", "success", "fail"];
exports.ActionDefDict = {

View File

@ -5,30 +5,36 @@ var Action_1 = require("./Action");
exports.desc = {
attributes: {
mobile: {
notNull: true,
type: "varchar",
params: {
length: 11
}
},
code: {
notNull: true,
type: "varchar",
params: {
length: 4
}
},
visitorId: {
notNull: true,
type: "text"
},
reason: {
type: "text"
},
env: {
notNull: true,
type: "object"
},
expired: {
notNull: true,
type: "boolean"
},
expiresAt: {
notNull: true,
type: "datetime"
},
iState: {
@ -44,17 +50,17 @@ exports.desc = {
attributes: [
{
name: 'mobile',
direction: 'ASC'
direction: 'ASC',
},
{
name: 'code',
direction: 'ASC'
direction: 'ASC',
},
{
name: '$$createAt$$',
direction: 'DESC'
direction: 'DESC',
}
]
],
}
]
};

View File

@ -5,22 +5,26 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
url: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
apiPath: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
protocol: {
notNull: true,
type: "enum",
enumeration: ["http", "https"]
},
port: {
notNull: true,
type: "int",
params: {
width: 2,
@ -28,6 +32,7 @@ exports.desc = {
}
},
systemId: {
notNull: true,
type: "ref",
ref: "system"
}

View File

@ -5,12 +5,14 @@ var Action_1 = require("./Action");
exports.desc = {
attributes: {
email: {
notNull: true,
type: "varchar",
params: {
length: 16
}
},
userId: {
notNull: true,
type: "ref",
ref: "user"
},
@ -27,13 +29,13 @@ exports.desc = {
attributes: [
{
name: 'email',
direction: 'ASC'
direction: 'ASC',
},
{
name: 'ableState',
direction: 'ASC'
direction: 'ASC',
}
]
],
}
]
};

View File

@ -5,47 +5,56 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
origin: {
notNull: true,
type: "enum",
enumeration: ["qiniu", "unknown"]
},
type: {
notNull: true,
type: "enum",
enumeration: ["image", "video", "audio", "file"]
},
bucket: {
notNull: true,
type: "varchar",
params: {
length: 16
}
},
objectId: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
tag1: {
notNull: true,
type: "varchar",
params: {
length: 16
}
},
tag2: {
notNull: true,
type: "varchar",
params: {
length: 16
}
},
filename: {
notNull: true,
type: "varchar",
params: {
length: 256
}
},
md5: {
notNull: true,
type: "text"
},
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
@ -53,6 +62,7 @@ exports.desc = {
ref: ["article", "user"]
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64
@ -62,6 +72,7 @@ exports.desc = {
type: "text"
},
extension: {
notNull: true,
type: "varchar",
params: {
length: 16
@ -82,6 +93,7 @@ exports.desc = {
}
},
fileType: {
notNull: true,
type: "varchar",
params: {
length: 128

View File

@ -5,64 +5,75 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
title: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
streamTitle: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
liveonly: {
notNull: true,
type: "enum",
enumeration: ["online", "offline"]
},
hub: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
streamKey: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
rtmpPushUrl: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
rtmpPlayUrl: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
pcPushUrl: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
expireAt: {
notNull: true,
type: "datetime"
}
},

View File

@ -5,14 +5,14 @@ exports.actions = ["count", "stat", "download", "select", "aggregate", "create",
var IActionDef = {
stm: {
succeed: ['sending', 'success'],
fail: ['sending', 'failure']
}
fail: ['sending', 'failure'],
},
};
var VisitActionDef = {
stm: {
visit: ['unvisited', 'visited']
visit: ['unvisited', 'visited'],
},
is: 'unvisited'
is: 'unvisited',
};
exports.ActionDefDict = {
iState: IActionDef,

View File

@ -5,28 +5,33 @@ var Action_1 = require("./Action");
exports.desc = {
attributes: {
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
userId: {
notNull: true,
type: "ref",
ref: "user"
},
type: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
weight: {
notNull: true,
type: "enum",
enumeration: ["high", "medium", "low"]
},
@ -34,12 +39,14 @@ exports.desc = {
type: "object"
},
title: {
notNull: true,
type: "varchar",
params: {
length: 256
}
},
content: {
notNull: true,
type: "text"
},
data: {

View File

@ -5,10 +5,12 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
messageId: {
notNull: true,
type: "ref",
ref: "message"
},
systemId: {
notNull: true,
type: "ref",
ref: "system"
}

View File

@ -5,6 +5,7 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
type: {
notNull: true,
type: "varchar",
params: {
length: 64

View File

@ -5,18 +5,21 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
type: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
templateId: {
notNull: true,
type: "varchar",
params: {
length: 128
}
},
applicationId: {
notNull: true,
type: "ref",
ref: "application"
}

View File

@ -5,12 +5,14 @@ var Action_1 = require("./Action");
exports.desc = {
attributes: {
mobile: {
notNull: true,
type: "varchar",
params: {
length: 16
}
},
userId: {
notNull: true,
type: "ref",
ref: "user"
},
@ -27,13 +29,13 @@ exports.desc = {
attributes: [
{
name: 'mobile',
direction: 'ASC'
direction: 'ASC',
},
{
name: 'ableState',
direction: 'ASC'
direction: 'ASC',
}
]
],
}
]
};

View File

@ -4,9 +4,9 @@ exports.ActionDefDict = exports.actions = void 0;
var IActionDef = {
stm: {
apply: ['active', 'applied'],
abandon: ['active', 'abandoned']
abandon: ['active', 'abandoned'],
},
is: 'active'
is: 'active',
};
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "apply", "abandon"];
exports.ActionDefDict = {

View File

@ -5,30 +5,35 @@ var Action_1 = require("./Action");
exports.desc = {
attributes: {
targetEntity: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
action: {
notNull: true,
type: "varchar",
params: {
length: 16
}
},
data: {
notNull: true,
type: "object"
},
filter: {
@ -50,9 +55,9 @@ exports.desc = {
attributes: [
{
name: 'iState',
direction: 'ASC'
direction: 'ASC',
}
]
],
}
]
};

View File

@ -5,10 +5,12 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
modiId: {
notNull: true,
type: "ref",
ref: "modi"
},
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
@ -16,6 +18,7 @@ exports.desc = {
ref: ["user", "userEntityGrant", "userSystem", "userWechatPublicTag", "wechatPublicTag", "wechatQrCode", "wechatUser"]
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64

View File

@ -5,9 +5,9 @@ exports.actions = ["count", "stat", "download", "select", "aggregate", "create",
var IActionDef = {
stm: {
succeed: ['sending', 'success'],
fail: ['sending', 'failure']
fail: ['sending', 'failure'],
},
is: 'sending'
is: 'sending',
};
exports.ActionDefDict = {
iState: IActionDef

View File

@ -5,6 +5,7 @@ var Action_1 = require("./Action");
exports.desc = {
attributes: {
channel: {
notNull: true,
type: "enum",
enumeration: ["wechatPublic", "jPush", "jim", "wechatMp", "sms"]
},
@ -13,16 +14,20 @@ exports.desc = {
ref: "application"
},
data: {
notNull: true,
type: "object"
},
messageSystemId: {
notNull: true,
type: "ref",
ref: "messageSystem"
},
data1: {
notNull: true,
type: "object"
},
data2: {
notNull: true,
type: "object"
},
templateId: {

View File

@ -5,12 +5,14 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
action: {
notNull: true,
type: "varchar",
params: {
length: 16
}
},
data: {
notNull: true,
type: "object"
},
filter: {
@ -24,6 +26,7 @@ exports.desc = {
ref: "user"
},
targetEntity: {
notNull: true,
type: "varchar",
params: {
length: 32

View File

@ -5,10 +5,12 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
operId: {
notNull: true,
type: "ref",
ref: "oper"
},
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
@ -16,6 +18,7 @@ exports.desc = {
ref: ["user", "userEntityGrant", "userSystem", "userWechatPublicTag", "wechatPublicTag", "wechatQrCode", "wechatUser"]
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64

View File

@ -5,15 +5,18 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
name: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
description: {
notNull: true,
type: "text"
},
config: {
notNull: true,
type: "object"
},
style: {

View File

@ -5,6 +5,7 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
name: {
notNull: true,
type: "varchar",
params: {
length: 64

View File

@ -5,30 +5,36 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
name: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
description: {
notNull: true,
type: "text"
},
config: {
notNull: true,
type: "object"
},
offset: {
notNull: true,
type: "int",
params: {
width: 4,
@ -44,20 +50,20 @@ exports.desc = {
name: 'index_name',
attributes: [
{
name: 'name'
name: 'name',
},
]
],
},
{
name: 'index_entity',
attributes: [
{
name: 'entity'
name: 'entity',
},
{
name: 'entityId'
name: 'entityId',
}
]
],
}
]
};

View File

@ -5,22 +5,27 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
name: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
description: {
notNull: true,
type: "text"
},
config: {
notNull: true,
type: "object"
},
platformId: {
notNull: true,
type: "ref",
ref: "platform"
},
folder: {
notNull: true,
type: "varchar",
params: {
length: 16

View File

@ -9,6 +9,7 @@ exports.desc = {
ref: "application"
},
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
@ -16,6 +17,7 @@ exports.desc = {
ref: ["email", "mobile", "wechatUser"]
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64
@ -30,6 +32,7 @@ exports.desc = {
ref: "user"
},
env: {
notNull: true,
type: "object"
},
ableState: {

View File

@ -5,9 +5,9 @@ var IdActionDef = {
stm: {
verify: ['unverified', 'verifying'],
accept: [['unverified', 'verifying'], 'verified'],
reject: [['verifying', 'verified'], 'unverified']
reject: [['verifying', 'verified'], 'unverified'],
},
is: 'unverified'
is: 'unverified',
};
var UserActionDef = {
stm: {
@ -15,8 +15,8 @@ var UserActionDef = {
disable: [['normal', 'shadow'], 'disabled'],
enable: ['disabled', 'normal'],
mergeTo: [['normal', 'shadow'], 'merged'],
mergeFrom: ['normal', 'normal']
}
mergeFrom: ['normal', 'normal'],
},
};
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "grant", "revoke", "activate", "disable", "enable", "mergeTo", "mergeFrom", "verify", "accept", "reject"];
exports.ActionDefDict = {

View File

@ -61,33 +61,33 @@ exports.desc = {
attributes: [
{
name: 'birth',
direction: 'ASC'
direction: 'ASC',
},
]
],
},
{
name: 'index_fulltext',
attributes: [
{
name: 'name'
name: 'name',
},
{
name: 'nickname'
name: 'nickname',
}
],
config: {
type: 'fulltext',
parser: 'ngram'
parser: 'ngram',
}
},
{
name: 'index_userState_refId',
attributes: [
{
name: 'userState'
name: 'userState',
},
{
name: "refId"
name: "refId",
}
]
}

View File

@ -5,6 +5,7 @@ var Action_1 = require("./Action");
exports.desc = {
attributes: {
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
@ -12,22 +13,26 @@ exports.desc = {
ref: ["role"]
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
relation: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
type: {
notNull: true,
type: "enum",
enumeration: ["grant", "transfer"]
},
number: {
notNull: true,
type: "int",
params: {
width: 2,
@ -35,6 +40,7 @@ exports.desc = {
}
},
confirmed: {
notNull: true,
type: "int",
params: {
width: 2,
@ -45,6 +51,7 @@ exports.desc = {
type: "text"
},
granterId: {
notNull: true,
type: "ref",
ref: "user"
},
@ -53,6 +60,7 @@ exports.desc = {
ref: "user"
},
qrCodeType: {
notNull: true,
type: "enum",
enumeration: ["wechatMpDomainUrl", "wechatMpWxaCode", "wechatPublic", "wechatPublicForMp", "webForWechatPublic"]
},
@ -73,23 +81,23 @@ exports.desc = {
name: 'index_entity_entityId',
attributes: [
{
name: 'entity'
name: 'entity',
},
{
name: 'entityId'
name: 'entityId',
},
]
],
},
{
name: 'index_uuid',
attributes: [
{
name: 'expired'
name: 'expired',
},
{
name: 'expiresAt'
name: 'expiresAt',
}
]
],
}
]
};

View File

@ -5,14 +5,17 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
userId: {
notNull: true,
type: "ref",
ref: "user"
},
roleId: {
notNull: true,
type: "ref",
ref: "role"
},
relation: {
notNull: true,
type: "enum",
enumeration: ["owner"]
}

View File

@ -5,10 +5,12 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
userId: {
notNull: true,
type: "ref",
ref: "user"
},
systemId: {
notNull: true,
type: "ref",
ref: "system"
}

View File

@ -5,17 +5,21 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
wechatPublicTagId: {
notNull: true,
type: "ref",
ref: "wechatPublicTag"
},
userId: {
notNull: true,
type: "ref",
ref: "user"
},
sync: {
notNull: true,
type: "boolean"
},
syncAt: {
notNull: true,
type: "datetime"
}
},

View File

@ -5,16 +5,19 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
text: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
applicationId: {
notNull: true,
type: "ref",
ref: "application"
},
wechatId: {
notNull: true,
type: "int",
params: {
width: 4,
@ -22,9 +25,11 @@ exports.desc = {
}
},
sync: {
notNull: true,
type: "boolean"
},
syncAt: {
notNull: true,
type: "datetime"
}
},
@ -35,15 +40,15 @@ exports.desc = {
name: 'index_text_application',
attributes: [
{
name: 'text'
name: 'text',
},
{
name: "applicationId"
name: "applicationId",
},
],
config: {
unique: true
}
unique: true,
},
}
]
};

View File

@ -5,6 +5,7 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
@ -12,16 +13,19 @@ exports.desc = {
ref: ["user", "userEntityGrant"]
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
type: {
notNull: true,
type: "enum",
enumeration: ["wechatMpDomainUrl", "wechatMpWxaCode", "wechatPublic", "wechatPublicForMp", "webForWechatPublic"]
},
allowShare: {
notNull: true,
type: "boolean"
},
tag: {
@ -52,16 +56,19 @@ exports.desc = {
}
},
permanent: {
notNull: true,
type: "boolean"
},
buffer: {
type: "text"
},
applicationId: {
notNull: true,
type: "ref",
ref: "application"
},
props: {
notNull: true,
type: "object"
}
},
@ -72,34 +79,34 @@ exports.desc = {
name: 'index_entity_entityId_tag',
attributes: [
{
name: 'entity'
name: 'entity',
},
{
name: 'entityId'
name: 'entityId',
},
{
name: 'tag'
name: 'tag',
}
]
],
},
{
name: 'index_expired_expiresAt',
attributes: [
{
name: 'expired'
name: 'expired',
},
{
name: 'expiresAt'
name: 'expiresAt',
},
]
],
},
{
name: 'index_url',
attributes: [
{
name: 'url'
name: 'url',
},
]
],
}
]
};

View File

@ -5,6 +5,7 @@ var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
origin: {
notNull: true,
type: "enum",
enumeration: ["mp", "public", "web"]
},
@ -64,6 +65,7 @@ exports.desc = {
ref: "user"
},
applicationId: {
notNull: true,
type: "ref",
ref: "application"
},

View File

@ -4,9 +4,15 @@ exports.createComponent = void 0;
var tslib_1 = require("tslib");
var page_web_1 = require("oak-frontend-base/lib/page.web");
function createComponent(option, features) {
var lifetimes = option.lifetimes, rest = tslib_1.__rest(option, ["lifetimes"]);
var lifetimes = option.lifetimes, methods = option.methods, rest = tslib_1.__rest(option, ["lifetimes", "methods"]);
var _a = lifetimes || {}, attached = _a.attached, restLifeTimes = tslib_1.__rest(_a, ["attached"]);
return (0, page_web_1.createComponent)(tslib_1.__assign({ lifetimes: tslib_1.__assign({ attached: function () {
return (0, page_web_1.createComponent)(tslib_1.__assign({ methods: tslib_1.__assign({ subscribeMpMessage: function (messageTypes, haveToAccept, tip) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
throw new Error('小程序环境专有函数在web下不成立');
});
});
} }, methods), lifetimes: tslib_1.__assign({ attached: function () {
var _this = this;
this.subscribed.push(this.features.token.subscribe(function () { return _this.refresh(); }));
attached && attached.call(this);

View File

@ -26,12 +26,12 @@ exports.default = OakComponent({
eventLoggedIn: String,
backUrl: String, //回调url
},
formData: function (_a) {
formData: function () {
var _this = this;
var _b, _c;
var features = _a.features;
var _a, _b;
var features = this.features;
var application = features.application.getApplication();
var appId = (_c = (_b = application === null || application === void 0 ? void 0 : application.config) === null || _b === void 0 ? void 0 : _b.wechat) === null || _c === void 0 ? void 0 : _c.appId;
var appId = (_b = (_a = application === null || application === void 0 ? void 0 : application.config) === null || _a === void 0 ? void 0 : _a.wechat) === null || _b === void 0 ? void 0 : _b.appId;
var loginAgreed = features.localStorage.load(LOGIN_AGREED);
var loginMode = features.localStorage.load(LOGIN_MODE) || 2;
var lastSendAt = features.localStorage.load(SEND_KEY);

View File

@ -652,11 +652,11 @@ async function tryRefreshWechatPublicUserInfo<ED extends EntityDict, Cxt extends
let { accessToken, refreshToken, atExpiredAt, rtExpiredAt, scope, openId, user } = wechatUser;
const now = Date.now();
assert(scope!.toLowerCase().includes('userinfo'));
if (rtExpiredAt! < now) {
if (rtExpiredAt as number < now) {
// refreshToken过期直接返回未登录异常使用户去重新登录
throw new OakUnloggedInException();
}
if (atExpiredAt! < now) {
if (atExpiredAt as number < now) {
// 刷新accessToken
const { accessToken: at2, atExpiredAt: ate2, scope: s2 } = await wechatInstance.refreshUserAccessToken(refreshToken!);
await context.operate('wechatUser', {

View File

@ -485,8 +485,8 @@ const endpoints: Record<string, Endpoint<EntityDict, BRC>> = {
return '';
}
await context.setApplication(appId);
const { xml: data } = X2Js.xml2js(body);
const { content, contentType } = onWeChatPublicEvent(data as any, context);
const { xml: data } = X2Js.xml2js<{ xml: WechatPublicEventData }>(body);
const { content, contentType } = onWeChatPublicEvent(data, context);
return content;
},
}, {

View File

@ -38,10 +38,18 @@ export function createComponent<
>,
features: BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>> & FD,
) {
const { lifetimes, ...rest } = option;
const { lifetimes, methods, ...rest } = option;
const { attached, ...restLifeTimes } = lifetimes || {};
return createBaseComponent<ED, T, Cxt, FrontCxt, AD, FD, FormedData, IsList, TData, TProperty, TMethod>({
return createBaseComponent<ED, T, Cxt, FrontCxt, AD, FD, FormedData, IsList, TData, TProperty, TMethod & {
subscribeMpMessage: (messageTypes: string[], haveToAccept?: boolean, tip?: string) => Promise<boolean>;
}>({
methods: {
async subscribeMpMessage(messageTypes: string[], haveToAccept?: boolean, tip?: string) {
throw new Error('小程序环境专有函数在web下不成立');
},
...(methods as TMethod),
},
lifetimes: {
attached() {
this.subscribed.push(

View File

@ -26,7 +26,8 @@ export default OakComponent({
eventLoggedIn: String,
backUrl: String, //回调url
},
formData({ features }) {
formData() {
const { features } = this;
const application = features.application.getApplication();
const appId = (application?.config as WebConfig | undefined)?.wechat
?.appId;

View File

@ -217,7 +217,7 @@ export default OakComponent(
const searchStr = this.load('user_searchList') as string;
let searchArr: Array<string> = [];
if (!searchStr) {
searchArr.push(value)
searchArr.push(value!);
this.setState({
searchArr,
go: true,
@ -225,8 +225,8 @@ export default OakComponent(
}
else {
searchArr = JSON.parse(searchStr) as Array<string>;
if (!searchArr.includes(value)) {
searchArr.push(value);
if (!searchArr.includes(value!)) {
searchArr.push(value!);
}
this.setState({
searchArr,
@ -234,7 +234,7 @@ export default OakComponent(
})
}
this.save('user_searchList', JSON.stringify(searchArr));
this.setFilter(value);
this.setFilter(value!);
this.refresh();
},
},