zet-lib 1.2.88 → 1.2.89
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/lib/zCache.js +6 -44
- package/lib/zGeneratorRouter.js +1 -1
- package/package.json +1 -1
package/lib/zCache.js
CHANGED
|
@@ -19,7 +19,7 @@ zCache.KEYS = {
|
|
|
19
19
|
ZFUNCTIONS: 'ZFUNCTIONS',
|
|
20
20
|
VERSIONS: 'VERSIONS',
|
|
21
21
|
MODELS_RELATIONS: 'MODELS_RELATIONS',
|
|
22
|
-
APPROVAL_LEVELS
|
|
22
|
+
APPROVAL_LEVELS: 'APPROVAL_LEVELS',
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
zCache.STATICS = zCache.KEYS
|
|
@@ -62,12 +62,6 @@ const cache = async () => {
|
|
|
62
62
|
} else {
|
|
63
63
|
await zCache.MYMODELS()
|
|
64
64
|
}
|
|
65
|
-
if (myCache.has('CONFIG')) {
|
|
66
|
-
i = i + 1
|
|
67
|
-
} else {
|
|
68
|
-
//console.log("cache CONFIG not exist " + i)
|
|
69
|
-
await zCache.CONFIG()
|
|
70
|
-
}
|
|
71
65
|
if (myCache.has('MENU')) {
|
|
72
66
|
i = i + 1
|
|
73
67
|
} else {
|
|
@@ -87,7 +81,7 @@ const cache = async () => {
|
|
|
87
81
|
await zCache.ZFUNCTIONS()
|
|
88
82
|
}
|
|
89
83
|
if (myCache.has('APPROVAL_LEVELS')) {
|
|
90
|
-
|
|
84
|
+
i = i + 1
|
|
91
85
|
} else {
|
|
92
86
|
await zCache.APPROVAL_LEVELS()
|
|
93
87
|
}
|
|
@@ -176,38 +170,6 @@ zCache.VERSIONS = () => {
|
|
|
176
170
|
}
|
|
177
171
|
}
|
|
178
172
|
|
|
179
|
-
zCache.CONFIG = async () => {
|
|
180
|
-
let results = async () => {
|
|
181
|
-
return await connection.results({
|
|
182
|
-
table: 'zconfig',
|
|
183
|
-
})
|
|
184
|
-
}
|
|
185
|
-
let companies = await connection.results({
|
|
186
|
-
table: 'zcompany',
|
|
187
|
-
})
|
|
188
|
-
let r = await results()
|
|
189
|
-
let configObj = Util.arrayToObject(r, 'company_id')
|
|
190
|
-
for (let i = 0; i < companies.length; i++) {
|
|
191
|
-
let item = companies[i]
|
|
192
|
-
if (!configObj[item.id]) {
|
|
193
|
-
await connection.insert({
|
|
194
|
-
table: 'zconfig',
|
|
195
|
-
data: {
|
|
196
|
-
company_id: item.id,
|
|
197
|
-
layout: 0,
|
|
198
|
-
json: JSON.stringify(CONFIG),
|
|
199
|
-
created_at: Util.now(),
|
|
200
|
-
updated_at: Util.now(),
|
|
201
|
-
},
|
|
202
|
-
})
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
myCache.set(zCache.KEYS.CONFIG, Util.arrayToObject(await results(), 'company_id'))
|
|
207
|
-
//add to version after set
|
|
208
|
-
zCache.updateVersions(zCache.KEYS.CONFIG)
|
|
209
|
-
}
|
|
210
|
-
|
|
211
173
|
zCache.MENU = async () => {
|
|
212
174
|
let results = async () => {
|
|
213
175
|
return await connection.results({
|
|
@@ -322,15 +284,15 @@ zCache.MODELS_RELATIONS = async () => {
|
|
|
322
284
|
}
|
|
323
285
|
}
|
|
324
286
|
|
|
325
|
-
zCache.APPROVAL_LEVELS = async() => {
|
|
287
|
+
zCache.APPROVAL_LEVELS = async () => {
|
|
326
288
|
if (myCache.has('APPROVAL_LEVELS')) {
|
|
327
289
|
return myCache.get('APPROVAL_LEVELS')
|
|
328
290
|
} else {
|
|
329
291
|
let results = await connection.results({
|
|
330
|
-
select:'id,name,color',
|
|
331
|
-
table:'zapproval_type'
|
|
292
|
+
select: 'id,name,color',
|
|
293
|
+
table: 'zapproval_type',
|
|
332
294
|
})
|
|
333
|
-
let obj = Util.arrayToObject(results,
|
|
295
|
+
let obj = Util.arrayToObject(results, 'id')
|
|
334
296
|
myCache.set('APPROVAL_LEVELS', obj)
|
|
335
297
|
return obj
|
|
336
298
|
}
|
package/lib/zGeneratorRouter.js
CHANGED
|
@@ -16,7 +16,7 @@ const ejs = require('ejs')
|
|
|
16
16
|
var app = express()
|
|
17
17
|
const path = require('path')
|
|
18
18
|
|
|
19
|
-
const nots = ['index', 'uploads', 'js', 'css', 'log', 'generator', 'zmenu', 'zgenerator', 'zfields', 'zrole', 'zfunction', 'zgrid', 'zgrid_default', 'zreport', 'zpage', 'zlayout', 'zerror', 'zuser_company'
|
|
19
|
+
const nots = ['index', 'uploads', 'js', 'css', 'log', 'generator', 'zmenu', 'zgenerator', 'zfields', 'zrole', 'zfunction', 'zgrid', 'zgrid_default', 'zreport', 'zpage', 'zlayout', 'zerror', 'zuser_company']
|
|
20
20
|
//const nots = [];
|
|
21
21
|
//const generatorUrl = 'http://localhost:3005';
|
|
22
22
|
const generatorUrl = 'https://generator.cmsqu.com'
|