系统:停服维护逻辑
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
|
||||
import { Service } from 'egg';
|
||||
import { MaintenanceModel } from '@db/Maintenance';
|
||||
|
||||
/**
|
||||
* Test Service
|
||||
*/
|
||||
export default class Game extends Service {
|
||||
|
||||
public setServerMainten(maintenServers: number[]) {
|
||||
return this.app['maintenServers'] = maintenServers;
|
||||
}
|
||||
|
||||
public getServerMainten() {
|
||||
return this.app['maintenServers']||[];
|
||||
}
|
||||
|
||||
public async readDbMaintenance() {
|
||||
const maintenance = await MaintenanceModel.findOpenMaintenance();
|
||||
if(maintenance) {
|
||||
this.setServerMainten(maintenance.serverIds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user