//#import $owl_app_log:services/modelService.jsx
//#import Util.js
//#import $owl_mall_u:services/modelService.jsx


function main(){
    var app = JSON.parse($body);
    var ip = "" + $.getClientIp();
    var ts = new Date().getTime();
    var userId = app.userId;
    var user = owl_mall_uService.get(userId);
    var userName='root'
    if(user){
        userName = user.name;
    }

    app.uname = userName;

    var ua = "" + request.getHeader("user-agent");
    app.ua = ua;
    app.ip = ip;
    app.ts = ts;
    owl_app_logService.add(app);
    var ret = {
        state: 'ok',
        id:app.id
    }
    out.print(JSON.stringify(ret));
    return;
}
main();