...
|
...
|
@@ -26,7 +26,7 @@ Controller.prototype.__parseReq=function(req){ |
|
|
}
|
|
|
}
|
|
|
|
|
|
Controller.prototype.__define=function(method,router,view,apis,callback,clientmodel){
|
|
|
Controller.prototype.__define=function(method,router,view,apis,callback,clientmodel,clientsrc){
|
|
|
var me=this,isObj=false;
|
|
|
if(typeof apis=="string"){
|
|
|
apis=[apis];
|
...
|
...
|
@@ -49,14 +49,14 @@ Controller.prototype.__define=function(method,router,view,apis,callback,clientmo |
|
|
model=callback.apply(local, args);
|
|
|
}
|
|
|
if(view){
|
|
|
res.render(view,local,me.client(res,view,model,clientmodel));
|
|
|
res.render(view,local,me.client(res,clientsrc,model,clientmodel));
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
args.push(function (err, interfaces, names){
|
|
|
if (err) {
|
|
|
res.json({code:500,message:"接口异常"});
|
|
|
res.json({code:500,message:err.message||'接口异常'});
|
|
|
return;
|
|
|
}
|
|
|
//callback
|
...
|
...
|
@@ -78,7 +78,7 @@ Controller.prototype.__define=function(method,router,view,apis,callback,clientmo |
|
|
if (model&&model.readable) {
|
|
|
model.pipe(res);
|
|
|
}else if (view && method == "get" && !req.xhr) {
|
|
|
res.render(view, local, me.client(res, view, model,clientmodel));
|
|
|
res.render(view, local, me.client(res, clientsrc, model,clientmodel));
|
|
|
} else {
|
|
|
res.json(model);
|
|
|
}
|
...
|
...
|
@@ -106,7 +106,7 @@ Controller.prototype.vue=function(router,views,apis,callback){ |
|
|
apis=[];
|
|
|
}
|
|
|
apis=apis||[];
|
|
|
me.__define("get",router,views,apis,callback,"vue");
|
|
|
me.__define("get",router,"common.Vue",apis,callback,"vue",views);
|
|
|
}
|
|
|
Controller.prototype.get=function(router,views,apis,callback){
|
|
|
var me=this;
|
...
|
...
|
@@ -120,7 +120,7 @@ Controller.prototype.get=function(router,views,apis,callback){ |
|
|
apis=[];
|
|
|
}
|
|
|
apis=apis||[];
|
|
|
me.__define("get",router,views,apis,callback,"jquery");
|
|
|
me.__define("get",router,views,apis,callback,"jquery",views);
|
|
|
}
|
|
|
Controller.prototype.post=function(router,apis,callback){
|
|
|
var me=this;
|
...
|
...
|
|