修改游戏创建FTP账号逻辑
This commit is contained in:
parent
7a212e1535
commit
9ed073ff6c
@ -228,41 +228,6 @@ router.post('/create-ftp', async (req, res, next) => {
|
|||||||
const body = req.body;
|
const body = req.body;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const search = await GameInfo.findOne({
|
|
||||||
game_id: body.game_id,
|
|
||||||
deleted: false
|
|
||||||
});
|
|
||||||
if (!search) {
|
|
||||||
res.send({
|
|
||||||
errcode: 1,
|
|
||||||
errmsg: '游戏已删除或不存在!'
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const platforms = search.platforms;
|
|
||||||
for (let i = 0; i < platforms.length; i++) {
|
|
||||||
if (
|
|
||||||
platforms[i].platform.platform_id ===
|
|
||||||
body.platformInfo.platform.platform_id
|
|
||||||
) {
|
|
||||||
res.send({
|
|
||||||
errcode: 1,
|
|
||||||
errmsg: '平台已存在!'
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const save = await GameInfo.updateOne(
|
|
||||||
{
|
|
||||||
game_id: body.game_id,
|
|
||||||
deleted: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$push: { platforms: body.platformInfo }
|
|
||||||
}
|
|
||||||
);
|
|
||||||
let token = '';
|
let token = '';
|
||||||
const loginRes = await axios({
|
const loginRes = await axios({
|
||||||
url: config.minigame.api + 'gettoken/',
|
url: config.minigame.api + 'gettoken/',
|
||||||
@ -303,6 +268,43 @@ router.post('/create-ftp', async (req, res, next) => {
|
|||||||
const ftpStatus = ftpRes.status;
|
const ftpStatus = ftpRes.status;
|
||||||
if (ftpStatus === 200) {
|
if (ftpStatus === 200) {
|
||||||
// 通知用户刷新页面等待ftp账号
|
// 通知用户刷新页面等待ftp账号
|
||||||
|
|
||||||
|
const search = await GameInfo.findOne({
|
||||||
|
game_id: body.game_id,
|
||||||
|
deleted: false
|
||||||
|
});
|
||||||
|
if (!search) {
|
||||||
|
res.send({
|
||||||
|
errcode: 1,
|
||||||
|
errmsg: '游戏已删除或不存在!'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const platforms = search.platforms;
|
||||||
|
for (let i = 0; i < platforms.length; i++) {
|
||||||
|
if (
|
||||||
|
platforms[i].platform.platform_id ===
|
||||||
|
body.platformInfo.platform.platform_id
|
||||||
|
) {
|
||||||
|
res.send({
|
||||||
|
errcode: 1,
|
||||||
|
errmsg: '平台已存在!'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const save = await GameInfo.updateOne(
|
||||||
|
{
|
||||||
|
game_id: body.game_id,
|
||||||
|
deleted: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$push: { platforms: body.platformInfo }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
res.send({
|
res.send({
|
||||||
errcode: 0,
|
errcode: 0,
|
||||||
msg: '正在创建ftp账号,请等待一段时间后刷新页面!'
|
msg: '正在创建ftp账号,请等待一段时间后刷新页面!'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user