elvinzeng / nwf Goto Github PK
View Code? Open in Web Editor NEWA simple and easy-to-use MVC framework for NPL Web application
License: MIT License
A simple and easy-to-use MVC framework for NPL Web application
License: MIT License
不同路径下的同名controller会被覆盖,比如:www/controller/aaa/DemoController.lua与www/controller/bbb/DemoController.lua,在注册controller时将会出现相互覆盖的bug.
配置了模块搜索路径的时候 load会加载搜索路径下的全部模块
需要增加404、5XX等自定义异常页面
貌似请求的nid一直都是1,好像现在不会变化了。
如果项目依赖配置文件存在空行会出现错误,框架会误认为需要加载一个名字为空串的模块。
错误信息:
error: function [get], file [www/controller/DemoController.lua], line number [38].
[string "script/ide/STL/UnorderedArraySet.lua"]:115: table index is nil
stack traceback:
[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:284: in function '__newindex'
[string "script/ide/STL/UnorderedArraySet.lua"]:115: in function 'add'
[string "npl_packages/nwf/npl_mod/nwf/db/dbTemplate.lua"]:84: in function 'getListFromCursor'
[string "npl_packages/nwf/npl_mod/nwf/db/dbTemplate.lua"]:270: in function 'queryFirst'
[string "www/controller/DemoController.lua"]:67: in function 'action'
[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:261: in function <[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:242>
[C]: in function 'xpcall'
[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:242: in function 'process'
[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:305: in function <[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:304>
[C]: in function 'xpcall'
[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:304: in function 'doNext'
[string "npl_packages/nwf/npl_mod/nwf/session.lua"]:157: in function <[string "npl_packages/nwf/npl_mod/nwf/session.lua"]:149>
[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:300: in function <[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:299>
[C]: in function 'xpcall'
[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:299: in function 'doFilter'
[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:302: in function 'doNext'
[string "npl_packages/nwf/npl_mod/nwf/loader.lua"]:49: in function <[string "npl_packages/nwf/npl_mod/nwf/loader.lua"]:40>
[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:300: in function <[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:299>
[C]: in function 'xpcall'
[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:299: in function 'doFilter'
[string "npl_packages/nwf/npl_mod/nwf/dispatcher.lua"]:340: in function 'handle'
[string "www/router.lua"]:9: in function <[string "www/router.lua"]:8>
测试代码:
local sql = "SELECT c.cart_id AS cid , u.user_name AS uname FROM tb_cart c LEFT JOIN tb_user u ON c.user_id = u.user_id WHERE c.cart_id='7f293e5d-a1bf-403c-c091-49d144021be9'";
local data,err = dbTemplate:queryFirst(sql, {"tb_cart","tb_user"});
model内容:
local user = commonlib.gettable("entity.user");
user.tbName = "tb_user";
user.fields = {
user_id = {notNil = true,isPrimaryKey = true},
user_name = {notNil = false},
password = {notNil = false},
eidt_time = {notNil = false},
create_time = {notNil = false},
is_deleted = {notNil = false}
}
local cart = commonlib.gettable("entity.cart");
cart.tbName = "tb_cart";
cart.fields = {
cart_id = {notNil = true,isPrimaryKey = true},
user_id = {notNil = true},
product_price = {notNil = true},
eidt_time = {notNil = false},
create_time = {notNil = false},
is_deleted = {notNil = false}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.