//#import $owl_orgs:services/modelService.jsx
//#import $owl_website:services/modelService.jsx

function main(){
    var params = JSON.parse($body);
    var websiteId = params.id;
    var website = owl_websiteService.get(websiteId);
    var org = owl_orgsService.get(website.orgId);

    org.name = website.siteTitle;
    org.business_circles = website.business_circles.map(function(bc){
        return {id:bc.business_circle_id,name:bc.business_circle_name}
    })
    org.logo = website.appLogo;

    owl_orgsService.update(org);

    var ret = {
        state: 'ok',
        msg:org.name + " 更新成功"

    }
    out.print(JSON.stringify(ret));
    return;

}
main();