1
This commit is contained in:
24
api/controller_front/upgrade.js
Normal file
24
api/controller_front/upgrade.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const { plu_upgrade, op } = require("../../middleware/baseModel");
|
||||
|
||||
module.exports = {
|
||||
"POST /upgrade/add": async (ctx, next) => {
|
||||
let row = ctx.getBody();
|
||||
let { fingerPrintKey, newVersion, oldVersion } = row;
|
||||
let upgradeRow = await plu_upgrade.findOne({ where: { fingerPrintKey, newVersion } });
|
||||
if (upgradeRow) {
|
||||
await plu_upgrade.update({ fingerPrintKey, newVersion, oldVersion, whetherTip: true }, { where: { id: upgradeRow.id }, individualHooks: true });
|
||||
return ctx.success();
|
||||
} else {
|
||||
const res = await plu_upgrade.create(row);
|
||||
return ctx.success(res);
|
||||
}
|
||||
},
|
||||
|
||||
"GET /upgrade/detail": async (ctx, next) => {
|
||||
let fingerPrintKey = ctx.get("fingerPrintKey");
|
||||
let newVersion = ctx.get("newVersion");
|
||||
|
||||
const res = await plu_upgrade.findOne({ where: { fingerPrintKey, newVersion } });
|
||||
return ctx.success(res);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user