fix: 兼容获取appKey和version

This commit is contained in:
2024-10-10 01:16:51 +08:00
parent 44d8a831c2
commit 15e8c9eea9
4 changed files with 63 additions and 6 deletions

View File

@@ -148,6 +148,19 @@ app
if (!files || !files.length) {
throw new CustomError('files is required');
}
let am = await AppModel.findOne({ where: { key: appKey, uid: tokenUser.id } });
if (!am) {
am = await AppModel.create({
user: tokenUser.username,
key: appKey,
uid: tokenUser.id,
version: '0.0.0',
title: appKey,
data: {
files: [],
},
});
}
let app = await AppListModel.findOne({ where: { version: version, key: appKey, uid: tokenUser.id } });
if (!app) {
// throw new CustomError('app not found');