1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
-- 版本信息表
|
-- 版本信息表
|
||||||
CREATE TABLE IF NOT EXISTS `version_info` (
|
CREATE TABLE IF NOT EXISTS `win_version_info` (
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||||
`version` VARCHAR(20) NOT NULL COMMENT '版本号(x.y.z 格式)',
|
`version` VARCHAR(20) NOT NULL COMMENT '版本号(x.y.z 格式)',
|
||||||
`platform` VARCHAR(20) NOT NULL COMMENT '平台类型(win32/darwin/linux)',
|
`platform` VARCHAR(20) NOT NULL COMMENT '平台类型(win32/darwin/linux)',
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
'POST /version/list': async (ctx) => {
|
'POST /version/list': async (ctx) => {
|
||||||
const models = Framework.getModels();
|
const models = Framework.getModels();
|
||||||
const { version_info } = models;
|
const { win_version_info } = models;
|
||||||
const { op } = models;
|
const { op } = models;
|
||||||
const body = ctx.getBody();
|
const body = ctx.getBody();
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await version_info.findAndCountAll({
|
const result = await win_version_info.findAndCountAll({
|
||||||
where,
|
where,
|
||||||
limit,
|
limit,
|
||||||
offset,
|
offset,
|
||||||
@@ -139,14 +139,14 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
'POST /version/detail': async (ctx) => {
|
'POST /version/detail': async (ctx) => {
|
||||||
const models = Framework.getModels();
|
const models = Framework.getModels();
|
||||||
const { version_info } = models;
|
const { win_version_info } = models;
|
||||||
const { id } = ctx.getBody();
|
const { id } = ctx.getBody();
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return ctx.fail('版本ID不能为空');
|
return ctx.fail('版本ID不能为空');
|
||||||
}
|
}
|
||||||
|
|
||||||
const version = await version_info.findByPk(id);
|
const version = await win_version_info.findByPk(id);
|
||||||
|
|
||||||
if (!version) {
|
if (!version) {
|
||||||
return ctx.fail('版本不存在');
|
return ctx.fail('版本不存在');
|
||||||
@@ -204,7 +204,7 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
'POST /version/update': async (ctx) => {
|
'POST /version/update': async (ctx) => {
|
||||||
const models = Framework.getModels();
|
const models = Framework.getModels();
|
||||||
const { version_info } = models;
|
const { win_version_info } = models;
|
||||||
const { op } = models;
|
const { op } = models;
|
||||||
const body = ctx.getBody();
|
const body = ctx.getBody();
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ module.exports = {
|
|||||||
return ctx.fail('版本ID不能为空');
|
return ctx.fail('版本ID不能为空');
|
||||||
}
|
}
|
||||||
|
|
||||||
const version = await version_info.findByPk(body.id);
|
const version = await win_version_info.findByPk(body.id);
|
||||||
if (!version) {
|
if (!version) {
|
||||||
return ctx.fail('版本不存在');
|
return ctx.fail('版本不存在');
|
||||||
}
|
}
|
||||||
@@ -223,7 +223,7 @@ module.exports = {
|
|||||||
const check_platform = body.platform || version.platform;
|
const check_platform = body.platform || version.platform;
|
||||||
const check_arch = body.arch || version.arch;
|
const check_arch = body.arch || version.arch;
|
||||||
|
|
||||||
const existing = await version_info.findOne({
|
const existing = await win_version_info.findOne({
|
||||||
where: {
|
where: {
|
||||||
version: check_version,
|
version: check_version,
|
||||||
platform: check_platform,
|
platform: check_platform,
|
||||||
@@ -255,7 +255,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 更新版本
|
// 更新版本
|
||||||
await version_info.update({
|
await win_version_info.update({
|
||||||
version: body.version,
|
version: body.version,
|
||||||
platform: body.platform,
|
platform: body.platform,
|
||||||
arch: body.arch,
|
arch: body.arch,
|
||||||
@@ -298,14 +298,14 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
'POST /version/delete': async (ctx) => {
|
'POST /version/delete': async (ctx) => {
|
||||||
const models = Framework.getModels();
|
const models = Framework.getModels();
|
||||||
const { version_info } = models;
|
const { win_version_info } = models;
|
||||||
const { id } = ctx.getBody();
|
const { id } = ctx.getBody();
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return ctx.fail('版本ID不能为空');
|
return ctx.fail('版本ID不能为空');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await version_info.destroy({
|
const result = await win_version_info.destroy({
|
||||||
where: { id }
|
where: { id }
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -345,7 +345,7 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
'POST /version/update_status': async (ctx) => {
|
'POST /version/update_status': async (ctx) => {
|
||||||
const models = Framework.getModels();
|
const models = Framework.getModels();
|
||||||
const { version_info } = models;
|
const { win_version_info } = models;
|
||||||
const { id, status } = ctx.getBody();
|
const { id, status } = ctx.getBody();
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
@@ -356,7 +356,7 @@ module.exports = {
|
|||||||
return ctx.fail('状态不能为空');
|
return ctx.fail('状态不能为空');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await version_info.update({
|
const result = await win_version_info.update({
|
||||||
status: status
|
status: status
|
||||||
}, {
|
}, {
|
||||||
where: { id }
|
where: { id }
|
||||||
|
|||||||
@@ -100,13 +100,8 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
'POST /file/upload_file_to_oss_by_auto_work': async (ctx) => {
|
'POST /file/upload_file_to_oss_by_auto_work': async (ctx) => {
|
||||||
|
|
||||||
|
|
||||||
const file =ctx.request.files.file ;
|
const file =ctx.request.files.file ;
|
||||||
|
|
||||||
|
|
||||||
const result = await ossToolService.uploadFile(file, 'work_boss');
|
const result = await ossToolService.uploadFile(file, 'work_boss');
|
||||||
|
|
||||||
return ctx.success(result);
|
return ctx.success(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,10 +147,10 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取模型
|
// 获取模型
|
||||||
const { version_info } = Framework.getModels();
|
const { win_version_info } = Framework.getModels();
|
||||||
|
|
||||||
// 查询所有启用状态的版本(按 platform + arch + status=1)
|
// 查询所有启用状态的版本(按 platform + arch + status=1)
|
||||||
const all_versions = await version_info.findAll({
|
const all_versions = await win_version_info.findAll({
|
||||||
where: {
|
where: {
|
||||||
platform: platform,
|
platform: platform,
|
||||||
arch: arch,
|
arch: arch,
|
||||||
@@ -268,7 +268,7 @@ module.exports = {
|
|||||||
'POST /version/create': async (ctx) => {
|
'POST /version/create': async (ctx) => {
|
||||||
|
|
||||||
const models = Framework.getModels();
|
const models = Framework.getModels();
|
||||||
const { version_info } = models;
|
const { win_version_info } = models;
|
||||||
const body = ctx.getBody();
|
const body = ctx.getBody();
|
||||||
|
|
||||||
// 参数验证
|
// 参数验证
|
||||||
@@ -298,7 +298,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 检查版本是否已存在
|
// 检查版本是否已存在
|
||||||
const existing = await version_info.findOne({
|
const existing = await win_version_info.findOne({
|
||||||
where: {
|
where: {
|
||||||
version: body.version,
|
version: body.version,
|
||||||
platform: body.platform,
|
platform: body.platform,
|
||||||
@@ -333,7 +333,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 创建版本
|
// 创建版本
|
||||||
const version = await version_info.create({
|
const version = await win_version_info.create({
|
||||||
version: body.version,
|
version: body.version,
|
||||||
platform: body.platform,
|
platform: body.platform,
|
||||||
arch: body.arch,
|
arch: body.arch,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const Sequelize = require('sequelize');
|
|||||||
* 存储应用版本信息,支持多平台多架构
|
* 存储应用版本信息,支持多平台多架构
|
||||||
*/
|
*/
|
||||||
module.exports = (db) => {
|
module.exports = (db) => {
|
||||||
const version_info = db.define("version_info", {
|
const win_version_info = db.define("win_version_info", {
|
||||||
// 版本基本信息
|
// 版本基本信息
|
||||||
version: {
|
version: {
|
||||||
comment: '版本号(x.y.z 格式)',
|
comment: '版本号(x.y.z 格式)',
|
||||||
@@ -81,6 +81,6 @@ module.exports = (db) => {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
return version_info;
|
return win_version_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 白名单URL - 不需要token验证的接口
|
// 白名单URL - 不需要token验证的接口
|
||||||
"allowUrls": ["/admin_api/sys_user/login", "/admin_api/sys_user/authorityMenus", "/admin_api/sys_user/register", "/api/user/loginByWeixin", "/file/", "/sys_file/", "/admin_api/win_data/viewLogInfo", "/api/user/wx_auth", '/api/docs', 'api/swagger.json', 'payment/notify', 'payment/refund-notify', 'wallet/transfer_notify', 'user/sms/send', 'user/sms/verify', '/api/version/check'],
|
"allowUrls": ["/admin_api/sys_user/login", "/admin_api/sys_user/authorityMenus", "/admin_api/sys_user/register", "/api/user/loginByWeixin", "/file/", "/sys_file/", "/admin_api/win_data/viewLogInfo", "/api/user/wx_auth", '/api/docs', 'api/swagger.json', 'payment/notify', 'payment/refund-notify', 'wallet/transfer_notify', 'user/sms/send', 'user/sms/verify', '/api/version/check','/api/file/upload_file_to_oss_by_auto_work','/api/version/create'],
|
||||||
|
|
||||||
|
|
||||||
// AI服务配置
|
// AI服务配置
|
||||||
|
|||||||
Reference in New Issue
Block a user