|
@@ -26,10 +26,17 @@ var Handler = {
|
|
|
},
|
|
|
apiResponse:function(res,data){
|
|
|
if(!res) return;
|
|
|
- data = data?{success:1,data:data}:{success:0};
|
|
|
+ data = data?{success:1,result:data}:{success:1};
|
|
|
res.writeHead(200, {'Content-Type': 'text/json'});
|
|
|
res.write(JSON.stringify(data));
|
|
|
res.end();
|
|
|
+ },
|
|
|
+ apiErrorResponse:function(res,msg){
|
|
|
+ if(!res) return;
|
|
|
+ msg = msg?{success:0,msg:msg}:{success:0};
|
|
|
+ res.writeHead(200, {'Content-Type': 'text/json'});
|
|
|
+ res.write(JSON.stringify(msg));
|
|
|
+ res.end();
|
|
|
}
|
|
|
}
|
|
|
|