zeanium-node
Advanced tools
Comparing version 0.6.36 to 0.6.37
{ | ||
"name": "zeanium-node", | ||
"version": "0.6.36", | ||
"version": "0.6.37", | ||
"description": "Zeanium for Node.js, simple http server and custome your business.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -35,3 +35,3 @@ zn.define(function () { | ||
convert: 'zn_plugin_admin_convert_user({})', | ||
hidden: true, | ||
//hidden: true, | ||
default: 0, | ||
@@ -57,3 +57,3 @@ get: function (){ | ||
ignore: true, | ||
hidden: true, | ||
//hidden: true, | ||
default: 0, | ||
@@ -60,0 +60,0 @@ auto_update: function (){ |
@@ -86,2 +86,45 @@ zn.define([ | ||
}, | ||
initFunction: { | ||
method: 'GET/POST', | ||
value: function (request, response, chain){ | ||
var _basePath = response._applicationContext._APP_PATH, | ||
_dataPath = node_path.join(_basePath, 'src', 'function'), | ||
_store = this.store(), | ||
_self = this; | ||
if(node_fs.existsSync(_dataPath)){ | ||
var _fns = [], | ||
_sql = '', | ||
_data = {}, | ||
_file = null, | ||
_content = null; | ||
node_fs.readdirSync(_dataPath).forEach(function (file){ | ||
_content = node_fs.readFileSync(node_path.join(_dataPath, file), 'utf-8'); | ||
_file = node_path.parse(node_path.join(_dataPath, file)); | ||
switch (_file.ext.toLowerCase()) { | ||
case '.sql': | ||
case '.txt': | ||
if(file.indexOf('zn_function_')!=-1){ | ||
_fns = _fns.concat(_content.split('----')); | ||
}else { | ||
_sql += _content; | ||
} | ||
break; | ||
} | ||
}); | ||
var _tran = _store.beginTransaction(); | ||
_fns.length && _fns.forEach(function (fn_sql){ | ||
fn_sql && _tran.query(fn_sql); | ||
}); | ||
_sql && _tran.query(_sql); | ||
_tran.on('error', function (sender, err){ | ||
response.error(err); | ||
}).on('finally', function (sender, data){ | ||
response.success(data); | ||
}).commit(); | ||
}else { | ||
response.error('不存在 ./src/function 路径'); | ||
} | ||
} | ||
}, | ||
initModel: { | ||
@@ -88,0 +131,0 @@ method: 'GET/POST', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
262401
6114