分享图分平台

This commit is contained in:
yulixing 2019-07-22 20:14:40 +08:00
parent 759243cf0d
commit 8962116e4a
6 changed files with 63 additions and 13 deletions

View File

@ -211,7 +211,13 @@ router.post('/update', async (req, res, next) => {
}) })
} }
} catch (err) { } catch (err) {
next(err) if (err.response && err.response.data.error) {
next({
message: err.response.data.error,
})
} else {
next(err)
}
} }
}) })
@ -243,8 +249,6 @@ router.post('/update_rc', async (req, res, next) => {
deleted: false, deleted: false,
}) })
// TODO:
if (search) { if (search) {
// 更新 // 更新
const recommendation = search.recommendation ? search.recommendation : {} const recommendation = search.recommendation ? search.recommendation : {}
@ -375,7 +379,13 @@ router.post('/create-ftp', async (req, res, next) => {
return return
} }
} catch (err) { } catch (err) {
next(err) if (err.response && err.response.data.error) {
next({
message: err.response.data.error,
})
} else {
next(err)
}
} }
}) })
@ -457,7 +467,13 @@ router.post('/deploy-config', async (req, res, next) => {
}) })
} }
} catch (err) { } catch (err) {
next(err) if (err.response && err.response.data.error) {
next({
message: err.response.data.error,
})
} else {
next(err)
}
} }
}) })

View File

@ -61,6 +61,7 @@ router.post('/list', async (req, res, next) => {
const gameId = body.gameId const gameId = body.gameId
const shareType = body.shareType const shareType = body.shareType
const type = body.type const type = body.type
const platform_id = body.platform_id
const isDev = body.isDev const isDev = body.isDev
const currentPage = body.currentPage const currentPage = body.currentPage
const pageSize = body.pageSize const pageSize = body.pageSize
@ -79,6 +80,9 @@ router.post('/list', async (req, res, next) => {
if (shareType) { if (shareType) {
opt.share_type = shareType opt.share_type = shareType
} }
if(platform_id) {
opt.platform_id = platform_id
}
if (type || type === 0) { if (type || type === 0) {
opt.type = type opt.type = type
} }

View File

@ -1,4 +1,3 @@
import axios from 'axios' import axios from 'axios'
import config from '../../../config/config' import config from '../../../config/config'
import {User, LdapUser} from '../../models/admin/User' import {User, LdapUser} from '../../models/admin/User'
@ -85,7 +84,13 @@ router.get('/list', async function userListCtrl(req, res, next) {
userList: compUserList, userList: compUserList,
}) })
} catch (err) { } catch (err) {
next(err) if (err.response && err.response.data.error) {
next({
message: err.response.data.error,
})
} else {
next(err)
}
} }
}) })
@ -162,7 +167,13 @@ router.post('/save', async (req, res, next) => {
errcode: 0, errcode: 0,
}) })
} catch (err) { } catch (err) {
next(err) if (err.response && err.response.data.error) {
next({
message: err.response.data.error,
})
} else {
next(err)
}
} }
}) })
@ -208,7 +219,13 @@ router.post('/del', async (req, res, next) => {
errcode: 0, errcode: 0,
}) })
} catch (err) { } catch (err) {
next(err) if (err.response && err.response.data.error) {
next({
message: err.response.data.error,
})
} else {
next(err)
}
} }
}) })

View File

@ -81,7 +81,13 @@ router.post('/change-pwd', async function(req, res, next) {
errcode: 0, errcode: 0,
}) })
} catch (err) { } catch (err) {
next(err) if (err.response && err.response.data.error) {
next({
message: err.response.data.error,
})
} else {
next(err)
}
} }
}) })

View File

@ -1,4 +1,3 @@
import jwt from 'jsonwebtoken' import jwt from 'jsonwebtoken'
import config from '../../../config/config' import config from '../../../config/config'
import {User} from '../../models/admin/User' import {User} from '../../models/admin/User'
@ -46,8 +45,8 @@ router.post('/login', async function(req, res, next) {
authorization: 'Bearer ' + token, authorization: 'Bearer ' + token,
}, },
}) })
const user = loginRes.data
const user = loginRes.data
const jwtToken = jwt.sign( const jwtToken = jwt.sign(
{ {
@ -90,7 +89,13 @@ router.post('/login', async function(req, res, next) {
userInfo: userSearch, userInfo: userSearch,
}) })
} catch (err) { } catch (err) {
next(err) if (err.response && err.response.data.error) {
next({
message: err.response.data.error,
})
} else {
next(err)
}
} }
}) })

View File

@ -12,6 +12,8 @@ const GameShareImage = new mongoose.Schema(
{ {
// 游戏id // 游戏id
game_id: {type: String}, game_id: {type: String},
// 平台id
platform_id: {type: String},
// 是否是默认分享 // 是否是默认分享
default_share: {type: Boolean, default: false}, default_share: {type: Boolean, default: false},
// 分享类型 // 分享类型