flexbiz-server
Version:
Flexible Server
4 lines (3 loc) • 1.07 kB
JavaScript
const model=global.getModel("financialroadmap"),controller=require("../../controllers/controller");
module.exports=function($router$$){(new controller($router$$,model,"financialroadmap",{unique:["code"],onCreating:($user$$,$obj$$,$next$$)=>{if(($obj$$.steps||[]).find($s$$=>{$s$$.sl_cp_slot=0;if(!$s$$.sl_slot)return!1;let $sl_cp_slot$$=Math.floor($s$$.dillution/100*$s$$.total_share/$s$$.sl_slot);if($sl_cp_slot$$<1)return!0;$s$$.sl_cp_slot=$sl_cp_slot$$;return!1}))return $next$$("S\u1ed1 l\u01b0\u1ee3ng c\u1ed5 ph\u1ea7n m\u1ed7i slot ph\u1ea3i l\u1edbn h\u01a1n kh\u00f4ng");$next$$(null,$obj$$)},
onUpdating:($user$$,$data$$,$obj$$,$next$$)=>{$data$$.steps=$data$$.steps||$obj$$.steps;if(($data$$.steps||[]).find($s$$=>{$s$$.sl_cp_slot=0;if(!$s$$.sl_slot)return!1;let $sl_cp_slot$$=Math.floor($s$$.dillution/100*$s$$.total_share/$s$$.sl_slot);if($sl_cp_slot$$<1)return!0;$s$$.sl_cp_slot=$sl_cp_slot$$;return!1}))return $next$$("S\u1ed1 l\u01b0\u1ee3ng c\u1ed5 ph\u1ea7n m\u1ed7i slot ph\u1ea3i l\u1edbn h\u01a1n kh\u00f4ng");$next$$(null,$data$$,$obj$$)}})).route()};