test
This commit is contained in:
parent
ecf4ef11b9
commit
c71040fb8a
@ -7,16 +7,15 @@ const config = {
|
|||||||
development: {
|
development: {
|
||||||
root: rootPath,
|
root: rootPath,
|
||||||
app: {
|
app: {
|
||||||
name: 'garfield'
|
name: 'pikachu'
|
||||||
},
|
},
|
||||||
host: 'http://192.168.199.210:3000',
|
host: 'http://192.168.199.210:3000',
|
||||||
port: process.env.PORT || 2333,
|
port: process.env.PORT || 2333,
|
||||||
secret: 'garfield_sd*3,Jd32-xd..q(jd,vHdklx2z;3',
|
secret: 'pikachu_sd*3,Jd32-xd..q(jd,vHdklx2z;3',
|
||||||
session_name: 'sessionId_garfield',
|
session_name: 'sessionId_pikachu',
|
||||||
|
|
||||||
special_sid: '58c939a11c2c7cf2653d7f07',
|
special_sid: '58c939a11c2c7cf2653d7f07',
|
||||||
empty_user: '000000000000000000000000',
|
empty_user: '000000000000000000000000',
|
||||||
db_admin: 'mongodb://localhost/garfield-development',
|
db_admin: 'mongodb://localhost/pikachu-development',
|
||||||
db_snoopy: 'mongodb://localhost/snoopy-development',
|
db_snoopy: 'mongodb://localhost/snoopy-development',
|
||||||
db_dalmatian: 'mongodb://localhost/dalmatian-development',
|
db_dalmatian: 'mongodb://localhost/dalmatian-development',
|
||||||
db_beagle: 'mongodb://localhost/beagle-development',
|
db_beagle: 'mongodb://localhost/beagle-development',
|
||||||
@ -29,7 +28,7 @@ const config = {
|
|||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
password: ''
|
password: ''
|
||||||
},
|
},
|
||||||
redisPublish: {
|
redisPublish: {
|
||||||
port: 6379,
|
port: 6379,
|
||||||
host: '192.144.140.87',
|
host: '192.144.140.87',
|
||||||
password: ''
|
password: ''
|
||||||
@ -63,24 +62,29 @@ const config = {
|
|||||||
user: 'cn=admin,dc=kingsome,dc=cn',
|
user: 'cn=admin,dc=kingsome,dc=cn',
|
||||||
password: 'milesQWE321'
|
password: 'milesQWE321'
|
||||||
},
|
},
|
||||||
|
minigame: {
|
||||||
|
api: 'http://192.168.100.206:8000/api/',
|
||||||
|
username: 'ops-apiuser',
|
||||||
|
password: 'hhsxafTuUtVV'
|
||||||
|
},
|
||||||
jwtSecret: 'OA3A$0X6*OsD*6oE',
|
jwtSecret: 'OA3A$0X6*OsD*6oE',
|
||||||
pay_record: 'http://192.168.100.23:7051/webapp/index.php',
|
pay_record: 'http://192.168.100.23:7051/webapp/index.php',
|
||||||
logs_path: '/Users/zhl/Documents/logs/garfield'
|
logs_path: 'E:logsgarfield'
|
||||||
},
|
},
|
||||||
|
|
||||||
production: {
|
production: {
|
||||||
root: rootPath,
|
root: rootPath,
|
||||||
app: {
|
app: {
|
||||||
name: 'garfield'
|
name: 'pikachu'
|
||||||
},
|
},
|
||||||
host: 'http://192.168.199.210:3000',
|
host: 'http://192.168.199.210:3000',
|
||||||
port: process.env.PORT || 3000,
|
port: process.env.PORT || 2333,
|
||||||
secret: 'garfield_sd*3,Jd32-xd..q(jd,vHdklx2z;3',
|
secret: 'garfield_sd*3,Jd32-xd..q(jd,vHdklx2z;3',
|
||||||
session_name: 'sessionId_garfield',
|
session_name: 'sessionId_garfield',
|
||||||
|
|
||||||
special_sid: '58c939a11c2c7cf2653d7f07',
|
special_sid: '58c939a11c2c7cf2653d7f07',
|
||||||
empty_user: '000000000000000000000000',
|
empty_user: '000000000000000000000000',
|
||||||
db_admin: 'mongodb://localhost/garfield-production',
|
db_admin: 'mongodb://localhost/pikachu-production',
|
||||||
db_snoopy: 'mongodb://localhost/snoopy-production',
|
db_snoopy: 'mongodb://localhost/snoopy-production',
|
||||||
db_dalmatian: 'mongodb://localhost/dalmatian-production',
|
db_dalmatian: 'mongodb://localhost/dalmatian-production',
|
||||||
db_beagle: 'mongodb://localhost/beagle-production',
|
db_beagle: 'mongodb://localhost/beagle-production',
|
||||||
@ -90,12 +94,12 @@ const config = {
|
|||||||
short_url_base: 'https://wechat-test.kingsome.cn/s/',
|
short_url_base: 'https://wechat-test.kingsome.cn/s/',
|
||||||
redis: {
|
redis: {
|
||||||
port: 6379,
|
port: 6379,
|
||||||
host: '127.0.0.1',
|
host: '10.10.9.3',
|
||||||
password: ''
|
password: ''
|
||||||
},
|
},
|
||||||
redisPublish: {
|
redisPublish: {
|
||||||
port: 6379,
|
port: 6379,
|
||||||
host: '192.144.140.87',
|
host: '10.10.9.3',
|
||||||
password: ''
|
password: ''
|
||||||
},
|
},
|
||||||
cos: {
|
cos: {
|
||||||
@ -127,9 +131,14 @@ const config = {
|
|||||||
user: 'cn=admin,dc=kingsome,dc=cn',
|
user: 'cn=admin,dc=kingsome,dc=cn',
|
||||||
password: 'milesQWE321'
|
password: 'milesQWE321'
|
||||||
},
|
},
|
||||||
|
minigame: {
|
||||||
|
api: 'http://192.168.100.206:8000/api/',
|
||||||
|
username: 'ops-apiuser',
|
||||||
|
password: 'hhsxafTuUtVV'
|
||||||
|
},
|
||||||
jwtSecret: 'OA3A$0X6*OsD*6oE',
|
jwtSecret: 'OA3A$0X6*OsD*6oE',
|
||||||
pay_record: 'http://192.168.100.23:7051/webapp/index.php',
|
pay_record: 'http://192.168.100.23:7051/webapp/index.php',
|
||||||
logs_path: '/var/logs'
|
logs_path: 'E:logsgarfield'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,6 +27,6 @@ exports.roles = [
|
|||||||
updatedAt: ISODate('2019-05-16T03:46:20.316Z'),
|
updatedAt: ISODate('2019-05-16T03:46:20.316Z'),
|
||||||
__v: 0,
|
__v: 0,
|
||||||
basePermissionTable:
|
basePermissionTable:
|
||||||
'{"games":{"name":"games","label":"游戏列表","permission":"writeable"},"settings":{"name":"settings","label":"配置项管理","permission":"writeable"},"users":{"name":"users","label":"用户列表","permission":"writeable"},"permission":{"name":"permission","label":"权限管理","permission":"writeable"},"logs":{"name":"logs","label":"操作日志","permission":"writeable"},"dics":{"name":"dics","label":"字典","permission":"writeable"},"data":{"name":"data","label":"数据查询","permission":"writeable"}}'
|
'{"games":{"name":"games","label":"游戏列表","permission":"writeable"},"settings":{"name":"settings","label":"配置项管理","permission":"writeable"},"platforms":{"name":"platforms","label":"平台管理","permission":"writeable"},"users":{"name":"users","label":"用户列表","permission":"writeable"},"permission":{"name":"permission","label":"权限管理","permission":"writeable"},"logs":{"name":"logs","label":"操作日志","permission":"writeable"}}'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
22
init-data.js
22
init-data.js
@ -7,12 +7,18 @@ const fixturesDir = path.join(config.root, '/fixtures');
|
|||||||
|
|
||||||
const platforms = require('./fixtures/platforms');
|
const platforms = require('./fixtures/platforms');
|
||||||
|
|
||||||
// fixtures.load(__dirname + '/fixtures/platforms.js', function(err) {
|
fixtures.clear(function(err) {
|
||||||
// if (err) throw err;
|
if (!err) {
|
||||||
// });
|
fixtures.load(__dirname + '/fixtures/platforms.js', function(err) {
|
||||||
// fixtures.load(__dirname + '/fixtures/roles.js', function(err) {
|
if (err) throw err;
|
||||||
// if (err) throw err;
|
});
|
||||||
// });
|
fixtures.load(__dirname + '/fixtures/roles.js', function(err) {
|
||||||
fixtures.load(__dirname + '/fixtures/system_dics.js', function(err) {
|
if (err) throw err;
|
||||||
if (err) throw err;
|
});
|
||||||
|
fixtures.load(__dirname + '/fixtures/system_dics.js', function(err) {
|
||||||
|
if (err) throw err;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -29,7 +29,8 @@ router.get('/list', async (req, res, next) => {
|
|||||||
return (
|
return (
|
||||||
userPerms.includes(`${uid}-readable`) ||
|
userPerms.includes(`${uid}-readable`) ||
|
||||||
userPerms.includes(`${uid}-edit`) ||
|
userPerms.includes(`${uid}-edit`) ||
|
||||||
userPerms.includes(`${uid}-publish`)
|
userPerms.includes(`${uid}-publish`) ||
|
||||||
|
userPerms.includes(`games-writeable`)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -129,7 +130,8 @@ router.post('/update', async (req, res, next) => {
|
|||||||
// 权限判断
|
// 权限判断
|
||||||
const hasPerm =
|
const hasPerm =
|
||||||
req.user.permissions.includes(`${req.body._id}-edit`) ||
|
req.user.permissions.includes(`${req.body._id}-edit`) ||
|
||||||
req.user.permissions.includes(`${req.body._id}-publish`);
|
req.user.permissions.includes(`${req.body._id}-publish`) ||
|
||||||
|
req.user.permissions.includes(`games-writeable`);
|
||||||
if (!hasPerm) {
|
if (!hasPerm) {
|
||||||
res.status(403).send({
|
res.status(403).send({
|
||||||
errcode: 1,
|
errcode: 1,
|
||||||
@ -214,7 +216,8 @@ router.post('/create-ftp', async (req, res, next) => {
|
|||||||
// 权限判断
|
// 权限判断
|
||||||
const hasPerm =
|
const hasPerm =
|
||||||
req.user.permissions.includes(`${req.body.uid}-edit`) ||
|
req.user.permissions.includes(`${req.body.uid}-edit`) ||
|
||||||
req.user.permissions.includes(`${req.body.uid}-publish`);
|
req.user.permissions.includes(`${req.body.uid}-publish`) ||
|
||||||
|
req.user.permissions.includes(`games-writeable`);
|
||||||
if (!hasPerm) {
|
if (!hasPerm) {
|
||||||
res.status(403).send({
|
res.status(403).send({
|
||||||
errcode: 1,
|
errcode: 1,
|
||||||
@ -234,7 +237,23 @@ router.post('/create-ftp', async (req, res, next) => {
|
|||||||
errcode: 1,
|
errcode: 1,
|
||||||
errmsg: '游戏已删除或不存在!'
|
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(
|
const save = await GameInfo.updateOne(
|
||||||
{
|
{
|
||||||
game_id: body.game_id,
|
game_id: body.game_id,
|
||||||
@ -293,6 +312,7 @@ router.post('/create-ftp', async (req, res, next) => {
|
|||||||
errcode: 1,
|
errcode: 1,
|
||||||
errmsg: '创建ftp账号时发生错误'
|
errmsg: '创建ftp账号时发生错误'
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
next(err);
|
next(err);
|
||||||
@ -306,7 +326,8 @@ router.post('/update-ftp', async (req, res, next) => {
|
|||||||
// 权限判断
|
// 权限判断
|
||||||
const hasPerm =
|
const hasPerm =
|
||||||
req.user.permissions.includes(`${req.body.uid}-edit`) ||
|
req.user.permissions.includes(`${req.body.uid}-edit`) ||
|
||||||
req.user.permissions.includes(`${req.body.uid}-publish`);
|
req.user.permissions.includes(`${req.body.uid}-publish`) ||
|
||||||
|
req.user.permissions.includes(`games-writeable`);
|
||||||
if (!hasPerm) {
|
if (!hasPerm) {
|
||||||
res.status(403).send({
|
res.status(403).send({
|
||||||
errcode: 1,
|
errcode: 1,
|
||||||
@ -323,7 +344,6 @@ router.post('/update-ftp', async (req, res, next) => {
|
|||||||
deleted: false
|
deleted: false
|
||||||
});
|
});
|
||||||
if (search) {
|
if (search) {
|
||||||
console.log(search);
|
|
||||||
const platforms = search.platforms;
|
const platforms = search.platforms;
|
||||||
for (let i = 0; i < platforms.length; i++) {
|
for (let i = 0; i < platforms.length; i++) {
|
||||||
if (platforms[i].platform.name_en === body.platform) {
|
if (platforms[i].platform.name_en === body.platform) {
|
||||||
|
@ -68,7 +68,6 @@ router.post('/edit', async (req, res, next) => {
|
|||||||
const body = req.body;
|
const body = req.body;
|
||||||
try {
|
try {
|
||||||
const search = await Platform.findOne({ platform_id: body.platform_id });
|
const search = await Platform.findOne({ platform_id: body.platform_id });
|
||||||
console.log(search);
|
|
||||||
if (search) {
|
if (search) {
|
||||||
const result = await Platform.updateOne(
|
const result = await Platform.updateOne(
|
||||||
{ platform_id: body.platform_id },
|
{ platform_id: body.platform_id },
|
||||||
|
@ -147,7 +147,6 @@ router.post('/save', async (req, res, next) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const body = req.body;
|
const body = req.body;
|
||||||
console.log(body);
|
|
||||||
const dn = `cn=${body.fullname},ou=people,dc=kingsome,dc=cn`;
|
const dn = `cn=${body.fullname},ou=people,dc=kingsome,dc=cn`;
|
||||||
const uidNumber = randomUid();
|
const uidNumber = randomUid();
|
||||||
const entry = {
|
const entry = {
|
||||||
@ -213,7 +212,6 @@ router.post('/del', async (req, res, next) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const body = req.body;
|
const body = req.body;
|
||||||
console.log(body);
|
|
||||||
const dn = `cn=${body.fullname},ou=people,dc=kingsome,dc=cn`;
|
const dn = `cn=${body.fullname},ou=people,dc=kingsome,dc=cn`;
|
||||||
const client = ldap.createClient({
|
const client = ldap.createClient({
|
||||||
url: config.ldap.url
|
url: config.ldap.url
|
||||||
|
Loading…
x
Reference in New Issue
Block a user