mirror of
https://github.com/vastxie/99AI.git
synced 2025-11-13 04:03:45 +08:00
v-4.0.0 开源可二开源码
This commit is contained in:
80
dist/modules/app/app.controller.js
vendored
80
dist/modules/app/app.controller.js
vendored
@@ -22,7 +22,6 @@ const app_service_1 = require("./app.service");
|
||||
const collectApp_dto_1 = require("./dto/collectApp.dto");
|
||||
const createApp_dto_1 = require("./dto/createApp.dto");
|
||||
const createCats_dto_1 = require("./dto/createCats.dto");
|
||||
const custonApp_dto_1 = require("./dto/custonApp.dto");
|
||||
const deleteApp_dto_1 = require("./dto/deleteApp.dto");
|
||||
const deleteCats_dto_1 = require("./dto/deleteCats.dto");
|
||||
const queryApp_dto_1 = require("./dto/queryApp.dto");
|
||||
@@ -55,9 +54,6 @@ let AppController = class AppController {
|
||||
appList(req, query) {
|
||||
return this.appService.appList(req, query);
|
||||
}
|
||||
appSystemList() {
|
||||
return this.appService.appSystemList();
|
||||
}
|
||||
list(req, query) {
|
||||
return this.appService.frontAppList(req, query);
|
||||
}
|
||||
@@ -67,27 +63,12 @@ let AppController = class AppController {
|
||||
createApp(body) {
|
||||
return this.appService.createApp(body);
|
||||
}
|
||||
customApp(body, req) {
|
||||
return this.appService.customApp(body, req);
|
||||
}
|
||||
updateApp(body) {
|
||||
return this.appService.updateApp(body);
|
||||
}
|
||||
updateSystemApp(body) {
|
||||
return this.appService.updateSystemApp(body);
|
||||
}
|
||||
delApp(body) {
|
||||
return this.appService.delApp(body);
|
||||
}
|
||||
auditPass(body) {
|
||||
return this.appService.auditPass(body);
|
||||
}
|
||||
auditFail(body) {
|
||||
return this.appService.auditFail(body);
|
||||
}
|
||||
delMineApp(body, req) {
|
||||
return this.appService.delMineApp(body, req);
|
||||
}
|
||||
collect(body, req) {
|
||||
return this.appService.collect(body, req);
|
||||
}
|
||||
@@ -161,15 +142,6 @@ __decorate([
|
||||
__metadata("design:paramtypes", [Object, queryApp_dto_1.QuerAppDto]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], AppController.prototype, "appList", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)('querySystemApp'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '获取系统App列表' }),
|
||||
(0, common_1.UseGuards)(adminAuth_guard_1.AdminAuthGuard),
|
||||
(0, swagger_1.ApiBearerAuth)(),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", void 0)
|
||||
], AppController.prototype, "appSystemList", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)('list'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '客户端获取App' }),
|
||||
@@ -197,17 +169,6 @@ __decorate([
|
||||
__metadata("design:paramtypes", [createApp_dto_1.CreateAppDto]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], AppController.prototype, "createApp", null);
|
||||
__decorate([
|
||||
(0, common_1.Post)('customApp'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '添加自定义App' }),
|
||||
(0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
|
||||
(0, swagger_1.ApiBearerAuth)(),
|
||||
__param(0, (0, common_1.Body)()),
|
||||
__param(1, (0, common_1.Req)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [custonApp_dto_1.CustomAppDto, Object]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], AppController.prototype, "customApp", null);
|
||||
__decorate([
|
||||
(0, common_1.Post)('updateApp'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '修改App' }),
|
||||
@@ -218,16 +179,6 @@ __decorate([
|
||||
__metadata("design:paramtypes", [updateApp_dto_1.UpdateAppDto]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], AppController.prototype, "updateApp", null);
|
||||
__decorate([
|
||||
(0, common_1.Post)('updateSystemApp'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '修改系统App' }),
|
||||
(0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
|
||||
(0, swagger_1.ApiBearerAuth)(),
|
||||
__param(0, (0, common_1.Body)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Object]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], AppController.prototype, "updateSystemApp", null);
|
||||
__decorate([
|
||||
(0, common_1.Post)('delApp'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '删除App' }),
|
||||
@@ -238,37 +189,6 @@ __decorate([
|
||||
__metadata("design:paramtypes", [deleteApp_dto_1.OperateAppDto]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], AppController.prototype, "delApp", null);
|
||||
__decorate([
|
||||
(0, common_1.Post)('auditPass'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '审核通过App' }),
|
||||
(0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
|
||||
(0, swagger_1.ApiBearerAuth)(),
|
||||
__param(0, (0, common_1.Body)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [deleteApp_dto_1.OperateAppDto]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], AppController.prototype, "auditPass", null);
|
||||
__decorate([
|
||||
(0, common_1.Post)('auditFail'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '审核拒绝App' }),
|
||||
(0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
|
||||
(0, swagger_1.ApiBearerAuth)(),
|
||||
__param(0, (0, common_1.Body)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [deleteApp_dto_1.OperateAppDto]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], AppController.prototype, "auditFail", null);
|
||||
__decorate([
|
||||
(0, common_1.Post)('delMineApp'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '删除个人App' }),
|
||||
(0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
|
||||
(0, swagger_1.ApiBearerAuth)(),
|
||||
__param(0, (0, common_1.Body)()),
|
||||
__param(1, (0, common_1.Req)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [deleteApp_dto_1.OperateAppDto, Object]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], AppController.prototype, "delMineApp", null);
|
||||
__decorate([
|
||||
(0, common_1.Post)('collect'),
|
||||
(0, swagger_1.ApiOperation)({ summary: '收藏/取消收藏App' }),
|
||||
|
||||
97
dist/modules/app/app.service.js
vendored
97
dist/modules/app/app.service.js
vendored
@@ -130,14 +130,6 @@ let AppService = class AppService {
|
||||
}
|
||||
return { rows, count };
|
||||
}
|
||||
async appSystemList() {
|
||||
const where = { isSystemReserved: 1 };
|
||||
const [rows, count] = await this.appEntity.findAndCount({
|
||||
where,
|
||||
order: { id: 'DESC' },
|
||||
});
|
||||
return { rows, count };
|
||||
}
|
||||
async frontAppList(req, query, orderKey = 'id') {
|
||||
var _a;
|
||||
const { page = 1, size = 1000, name, catId, role } = query;
|
||||
@@ -218,67 +210,6 @@ let AppService = class AppService {
|
||||
}
|
||||
return await this.appEntity.save(body);
|
||||
}
|
||||
async customApp(body, req) {
|
||||
const { id } = req.user;
|
||||
const { name, catId, des, preset, coverImg, demoData, public: isPublic, appId, } = body;
|
||||
if (appId) {
|
||||
const a = await this.appEntity.findOne({
|
||||
where: { id: appId, userId: id },
|
||||
});
|
||||
if (!a) {
|
||||
throw new common_1.HttpException('您正在编辑一个不存在的应用!', common_1.HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
const data = {
|
||||
name,
|
||||
catId,
|
||||
des,
|
||||
preset,
|
||||
coverImg,
|
||||
demoData,
|
||||
public: isPublic,
|
||||
status: isPublic ? 3 : 1,
|
||||
};
|
||||
const res = await this.appEntity.update({ id: appId, userId: id }, data);
|
||||
if (res.affected) {
|
||||
return '修改成功';
|
||||
}
|
||||
else {
|
||||
throw new common_1.HttpException('修改失败!', common_1.HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
if (!appId) {
|
||||
const c = await this.appCatsEntity.findOne({ where: { id: catId } });
|
||||
if (!c) {
|
||||
throw new common_1.HttpException('该分类不存在!', common_1.HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
const a = await this.appEntity.findOne({ where: { name } });
|
||||
if (a) {
|
||||
throw new common_1.HttpException('该应用名称已存在!', common_1.HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
const data = {
|
||||
name,
|
||||
catId,
|
||||
des,
|
||||
preset,
|
||||
coverImg,
|
||||
status: isPublic ? 3 : 1,
|
||||
demoData,
|
||||
public: isPublic,
|
||||
role: 'user',
|
||||
userId: id,
|
||||
};
|
||||
const res = await this.appEntity.save(data);
|
||||
const params = {
|
||||
appId: res.id,
|
||||
userId: id,
|
||||
appType: 'user',
|
||||
public: isPublic,
|
||||
status: isPublic ? 3 : 1,
|
||||
catId,
|
||||
};
|
||||
return this.userAppsEntity.save(params);
|
||||
}
|
||||
}
|
||||
async updateApp(body) {
|
||||
const { id, name, catId, status } = body;
|
||||
const a = await this.appEntity.findOne({ where: { name, id: (0, typeorm_2.Not)(id) } });
|
||||
@@ -298,22 +229,6 @@ let AppService = class AppService {
|
||||
return '修改App信息成功';
|
||||
throw new common_1.HttpException('修改App信息失败!', common_1.HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
async updateSystemApp(body) {
|
||||
const { id, name } = body;
|
||||
const existingApp = await this.appEntity.findOne({
|
||||
where: { name, id: (0, typeorm_2.Not)(id) },
|
||||
});
|
||||
if (existingApp) {
|
||||
common_1.Logger.warn(`应用名称已存在:${name}`);
|
||||
throw new common_1.HttpException('该应用名称已存在!', common_1.HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
const res = await this.appEntity.update({ id }, body);
|
||||
if (res.affected > 0) {
|
||||
return '修改系统应用信息成功';
|
||||
}
|
||||
common_1.Logger.error(`修改系统应用信息失败:${name}`);
|
||||
throw new common_1.HttpException('修改系统应用信息失败!', common_1.HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
async delApp(body) {
|
||||
const { id } = body;
|
||||
const a = await this.appEntity.findOne({ where: { id } });
|
||||
@@ -346,18 +261,6 @@ let AppService = class AppService {
|
||||
await this.userAppsEntity.update({ appId: id }, { status: 5 });
|
||||
return '应用审核拒绝完成';
|
||||
}
|
||||
async delMineApp(body, req) {
|
||||
const { id } = body;
|
||||
const a = await this.appEntity.findOne({
|
||||
where: { id, userId: req.user.id },
|
||||
});
|
||||
if (!a) {
|
||||
throw new common_1.HttpException('您正在操作一个不存在的资源!', common_1.HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
await this.appEntity.delete(id);
|
||||
await this.userAppsEntity.delete({ appId: id, userId: req.user.id });
|
||||
return '删除应用成功!';
|
||||
}
|
||||
async collect(body, req) {
|
||||
const { appId } = body;
|
||||
const { id: userId } = req.user;
|
||||
|
||||
Reference in New Issue
Block a user