nsgm-cli 2.0.6 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/README.md +161 -161
- package/client/layout/index.tsx +248 -245
- package/client/redux/reducers.ts +4 -4
- package/client/redux/store.ts +50 -50
- package/client/redux/template/manage/actions.ts +190 -190
- package/client/redux/template/manage/reducers.ts +118 -118
- package/client/redux/template/manage/types.ts +24 -24
- package/client/service/template/manage.ts +96 -96
- package/client/styled/common.ts +60 -27
- package/client/styled/layout/index.ts +25 -25
- package/client/styled/template/manage.ts +51 -51
- package/client/utils/common.ts +89 -86
- package/client/utils/cookie.ts +51 -51
- package/client/utils/fetch.ts +25 -25
- package/client/utils/menu.tsx +27 -27
- package/client/utils/sso.ts +205 -0
- package/generation/README.md +19 -19
- package/generation/app.js +2 -2
- package/generation/client/redux/reducers.ts +4 -4
- package/generation/client/utils/menu.tsx +27 -27
- package/generation/gitignore +4 -4
- package/generation/mysql.config.js +12 -13
- package/generation/next.config.js +6 -6
- package/generation/package.json +21 -26
- package/generation/project.config.js +13 -12
- package/generation/server/rest.js +23 -20
- package/generation/tsconfig.json +30 -30
- package/index.js +10 -10
- package/lib/args.d.ts +6 -6
- package/lib/args.js +53 -53
- package/lib/generate.d.ts +3 -3
- package/lib/generate.js +751 -736
- package/lib/index.d.ts +2 -2
- package/lib/index.js +272 -272
- package/lib/server/db.d.ts +5 -5
- package/lib/server/db.js +110 -110
- package/lib/server/graphql.d.ts +7 -7
- package/lib/server/graphql.js +119 -119
- package/lib/server/plugins/date.d.ts +5 -5
- package/lib/server/plugins/date.js +16 -16
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/mysql.config.js +14 -14
- package/next-env.d.ts +6 -6
- package/next.config.js +2 -2
- package/package.json +126 -126
- package/pages/_app.tsx +54 -44
- package/pages/login.tsx +79 -0
- package/pages/template/manage.tsx +278 -278
- package/project.config.js +16 -14
- package/public/slbhealthcheck.html +9 -9
- package/scripts/shutdown.sh +9 -9
- package/scripts/startup.sh +34 -34
- package/server/apis/sso.js +44 -0
- package/server/apis/template.js +17 -17
- package/server/modules/template/schema.js +33 -33
- package/server/rest.js +24 -20
- package/server/sql/template.sql +8 -8
- package/generation/.DS_Store +0 -0
package/scripts/startup.sh
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
cpu=1
|
|
4
|
-
|
|
5
|
-
if [ -n "$CDOS_CPUS" ]; then
|
|
6
|
-
cpu=$(printf "%.0f" $CDOS_CPUS)
|
|
7
|
-
else
|
|
8
|
-
cpu=$(cat /proc/cpuinfo | grep "processor" | wc -l)
|
|
9
|
-
fi
|
|
10
|
-
|
|
11
|
-
if [ $cpu -lt 1 ]; then
|
|
12
|
-
cpu=1
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
if [ $cpu -gt 8 ]; then
|
|
16
|
-
cpu=8
|
|
17
|
-
fi
|
|
18
|
-
|
|
19
|
-
cd $(dirname $BASH_SOURCE)
|
|
20
|
-
cd ..
|
|
21
|
-
appid=$(basename $(pwd))
|
|
22
|
-
cd current
|
|
23
|
-
appname=node-app-$appid
|
|
24
|
-
|
|
25
|
-
pm2 delete $appname
|
|
26
|
-
pm2 web
|
|
27
|
-
pm2 start app.js\
|
|
28
|
-
-i $cpu\
|
|
29
|
-
--name $appname\
|
|
30
|
-
--merge-logs\
|
|
31
|
-
--log-date-format="YYYY-MM-DD HH:mm:ss"\
|
|
32
|
-
--log /opt/logs/$appid/outerr.log\
|
|
33
|
-
--output /opt/logs/$appid/out.log\
|
|
34
|
-
--error /opt/logs/$appid/err.log
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
cpu=1
|
|
4
|
+
|
|
5
|
+
if [ -n "$CDOS_CPUS" ]; then
|
|
6
|
+
cpu=$(printf "%.0f" $CDOS_CPUS)
|
|
7
|
+
else
|
|
8
|
+
cpu=$(cat /proc/cpuinfo | grep "processor" | wc -l)
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
if [ $cpu -lt 1 ]; then
|
|
12
|
+
cpu=1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
if [ $cpu -gt 8 ]; then
|
|
16
|
+
cpu=8
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
cd $(dirname $BASH_SOURCE)
|
|
20
|
+
cd ..
|
|
21
|
+
appid=$(basename $(pwd))
|
|
22
|
+
cd current
|
|
23
|
+
appname=node-app-$appid
|
|
24
|
+
|
|
25
|
+
pm2 delete $appname
|
|
26
|
+
pm2 web
|
|
27
|
+
pm2 start app.js\
|
|
28
|
+
-i $cpu\
|
|
29
|
+
--name $appname\
|
|
30
|
+
--merge-logs\
|
|
31
|
+
--log-date-format="YYYY-MM-DD HH:mm:ss"\
|
|
32
|
+
--log /opt/logs/$appid/outerr.log\
|
|
33
|
+
--output /opt/logs/$appid/out.log\
|
|
34
|
+
--error /opt/logs/$appid/err.log
|
|
35
35
|
pm2 dump
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const express = require('express')
|
|
2
|
+
|
|
3
|
+
const router = express.Router()
|
|
4
|
+
|
|
5
|
+
router.get('/sessionCheck', (req, res) => {
|
|
6
|
+
const { query } = req
|
|
7
|
+
const { cookieValue, redirectUrl, appId } = query
|
|
8
|
+
|
|
9
|
+
res.json({
|
|
10
|
+
name: 'sessionCheck',
|
|
11
|
+
query,
|
|
12
|
+
returnCode: 0,
|
|
13
|
+
userAttr: {
|
|
14
|
+
displayName: "Erishen"
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
router.get('/ticketCheck', (req, res) => {
|
|
20
|
+
const { query } = req
|
|
21
|
+
const { ticket, name } = query
|
|
22
|
+
// console.log('name', name, atob(name))
|
|
23
|
+
|
|
24
|
+
if(atob(name) === "erishen,123456"){
|
|
25
|
+
res.json({
|
|
26
|
+
name: 'ticketCheck',
|
|
27
|
+
query,
|
|
28
|
+
returnCode: 0,
|
|
29
|
+
userAttr: {
|
|
30
|
+
displayName: "Erishen"
|
|
31
|
+
},
|
|
32
|
+
cookieValue: 'login_cookie',
|
|
33
|
+
cookieExpire: 10000
|
|
34
|
+
})
|
|
35
|
+
} else {
|
|
36
|
+
res.json({
|
|
37
|
+
name: 'ticketCheck',
|
|
38
|
+
query,
|
|
39
|
+
returnCode: -1
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
module.exports = router
|
package/server/apis/template.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const express = require('express')
|
|
2
|
-
const XLSX = require('xlsx')
|
|
3
|
-
const { templateBatchAdd } = require('../modules/template/resolver')
|
|
4
|
-
const router = express.Router()
|
|
5
|
-
|
|
6
|
-
router.post('/import', (req, res) => {
|
|
7
|
-
//console.log('files', req.files)
|
|
8
|
-
const workbook = XLSX.read(req.files.file.data, { type: "buffer" })
|
|
9
|
-
//console.log('Sheets', workbook.Sheets)
|
|
10
|
-
|
|
11
|
-
const datas = XLSX.utils.sheet_to_json(workbook.Sheets["Template"])
|
|
12
|
-
//console.log('datas', datas)
|
|
13
|
-
|
|
14
|
-
templateBatchAdd({ datas })
|
|
15
|
-
res.json({ name: 'Template' })
|
|
16
|
-
})
|
|
17
|
-
|
|
1
|
+
const express = require('express')
|
|
2
|
+
const XLSX = require('xlsx')
|
|
3
|
+
const { templateBatchAdd } = require('../modules/template/resolver')
|
|
4
|
+
const router = express.Router()
|
|
5
|
+
|
|
6
|
+
router.post('/import', (req, res) => {
|
|
7
|
+
//console.log('files', req.files)
|
|
8
|
+
const workbook = XLSX.read(req.files.file.data, { type: "buffer" })
|
|
9
|
+
//console.log('Sheets', workbook.Sheets)
|
|
10
|
+
|
|
11
|
+
const datas = XLSX.utils.sheet_to_json(workbook.Sheets["Template"])
|
|
12
|
+
//console.log('datas', datas)
|
|
13
|
+
|
|
14
|
+
templateBatchAdd({ datas })
|
|
15
|
+
res.json({ name: 'Template' })
|
|
16
|
+
})
|
|
17
|
+
|
|
18
18
|
module.exports = router
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
query: `
|
|
3
|
-
template(page: Int, pageSize: Int): Templates
|
|
4
|
-
templateGet(id: Int): Template
|
|
5
|
-
templateSearch(page: Int, pageSize: Int, data: TemplateSearchInput): Templates
|
|
6
|
-
`,
|
|
7
|
-
mutation: `
|
|
8
|
-
templateAdd(data: TemplateAddInput): Int
|
|
9
|
-
templateBatchAdd(datas: [TemplateAddInput]): Int
|
|
10
|
-
templateUpdate(id: Int, data: TemplateAddInput): Boolean
|
|
11
|
-
templateDelete(id: Int): Boolean
|
|
12
|
-
templateBatchDelete(ids: [Int]): Boolean
|
|
13
|
-
`,
|
|
14
|
-
subscription: ``,
|
|
15
|
-
type: `
|
|
16
|
-
type Template {
|
|
17
|
-
id: Int
|
|
18
|
-
name: String
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
type Templates {
|
|
22
|
-
totalCounts: Int
|
|
23
|
-
items: [Template]
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
input TemplateAddInput {
|
|
27
|
-
name: String
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
input TemplateSearchInput {
|
|
31
|
-
name: String
|
|
32
|
-
}
|
|
33
|
-
`
|
|
1
|
+
module.exports = {
|
|
2
|
+
query: `
|
|
3
|
+
template(page: Int, pageSize: Int): Templates
|
|
4
|
+
templateGet(id: Int): Template
|
|
5
|
+
templateSearch(page: Int, pageSize: Int, data: TemplateSearchInput): Templates
|
|
6
|
+
`,
|
|
7
|
+
mutation: `
|
|
8
|
+
templateAdd(data: TemplateAddInput): Int
|
|
9
|
+
templateBatchAdd(datas: [TemplateAddInput]): Int
|
|
10
|
+
templateUpdate(id: Int, data: TemplateAddInput): Boolean
|
|
11
|
+
templateDelete(id: Int): Boolean
|
|
12
|
+
templateBatchDelete(ids: [Int]): Boolean
|
|
13
|
+
`,
|
|
14
|
+
subscription: ``,
|
|
15
|
+
type: `
|
|
16
|
+
type Template {
|
|
17
|
+
id: Int
|
|
18
|
+
name: String
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type Templates {
|
|
22
|
+
totalCounts: Int
|
|
23
|
+
items: [Template]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
input TemplateAddInput {
|
|
27
|
+
name: String
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
input TemplateSearchInput {
|
|
31
|
+
name: String
|
|
32
|
+
}
|
|
33
|
+
`
|
|
34
34
|
}
|
package/server/rest.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
const express = require('express')
|
|
2
|
-
const moment = require('moment')
|
|
3
|
-
const template = require('./apis/template')
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
router.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
router.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
const express = require('express')
|
|
2
|
+
const moment = require('moment')
|
|
3
|
+
const template = require('./apis/template')
|
|
4
|
+
|
|
5
|
+
const sso = require('./apis/sso')
|
|
6
|
+
|
|
7
|
+
const router = express.Router()
|
|
8
|
+
|
|
9
|
+
router.use((req, res, next) => {
|
|
10
|
+
const fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl
|
|
11
|
+
console.log(moment().format('YYYY-MM-DD HH:mm:ss') + ' ' + fullUrl)
|
|
12
|
+
next()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
router.use('/template', template)
|
|
16
|
+
|
|
17
|
+
router.use('/sso', sso)
|
|
18
|
+
|
|
19
|
+
router.get('/*', (req, res) => {
|
|
20
|
+
res.statusCode = 200
|
|
21
|
+
res.json({ name: 'REST' })
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
module.exports = router
|
package/server/sql/template.sql
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
use crm_demo;
|
|
2
|
-
|
|
3
|
-
CREATE TABLE `template` (
|
|
4
|
-
`id` integer NOT NULL AUTO_INCREMENT COMMENT '主键',
|
|
5
|
-
`name` varchar(100) DEFAULT '' COMMENT '名称',
|
|
6
|
-
`create_date` TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
|
7
|
-
`update_date` TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
|
8
|
-
PRIMARY KEY (`id`)
|
|
1
|
+
use crm_demo;
|
|
2
|
+
|
|
3
|
+
CREATE TABLE `template` (
|
|
4
|
+
`id` integer NOT NULL AUTO_INCREMENT COMMENT '主键',
|
|
5
|
+
`name` varchar(100) DEFAULT '' COMMENT '名称',
|
|
6
|
+
`create_date` TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
|
7
|
+
`update_date` TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
|
8
|
+
PRIMARY KEY (`id`)
|
|
9
9
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
|
package/generation/.DS_Store
DELETED
|
Binary file
|