flexbiz-server
Version:
Flexible Server
36 lines (35 loc) • 18.4 kB
JavaScript
'use strict';const assabcihandlerSchema=new Schema({id_app:{type:String,required:!0},event:{type:String,required:!0,uppercase:!0},id:{type:String,required:!0},trang_thai:{type:String,default:"0"},date_created:{type:Date,default:Date.now},data:Schema.Types.Mixed});(global.configs||{}).createIndexes&&assabcihandlerSchema.index({id_app:1,event:1,id:1},{unique:!0});const model=mongoose.models.assabcihandler||mongoose.model("assabcihandler",assabcihandlerSchema),moment=require("moment"),async=require("async");
model.start=()=>{console.log("abci handler is started");async.forever(function($next$$){setTimeout(async()=>{const $now$$=new Date,$withdraws$$=await global.getModel("asswithdraw").find({trang_thai:"0",status:!0,ngay_xu_ly:{$lte:$now$$}});await new Promise($resolve$$=>{async.mapSeries($withdraws$$,($Withdraw$$,$callback$$)=>{setImmediate(async()=>{let $query_abci$$={id_app:$Withdraw$$.id_app,event:"WITHDRAW",id:$Withdraw$$.id},$abci$$=await model.findOne($query_abci$$);if($abci$$&&"0"==$abci$$.trang_thai&&
1>moment().diff(moment($abci$$.date_created),"hours"))return $callback$$();try{$abci$$=new model($query_abci$$),await $abci$$.save()}catch($e$$){return $callback$$()}try{await global.getModel("assbank").sendCoins($Withdraw$$.id_app,$Withdraw$$.product_owner,$Withdraw$$.creator,$Withdraw$$.von,$Withdraw$$.denom,{...$Withdraw$$.toObject(),event:"WITHDRAW",memo:"R\u00fat v\u1ed1n"})}catch($e$$){return $callback$$()}try{$Withdraw$$.lai_truoc_han&&await global.getModel("assbank").sendCoins($Withdraw$$.id_app,
$Withdraw$$.product_owner,$Withdraw$$.creator,$Withdraw$$.lai_truoc_han,$Withdraw$$.denom,{...$Withdraw$$.toObject(),event:"INTEREST",memo:"L\u00e3i t\u1eeb \u0111\u1ea7u t\u01b0"}),$Withdraw$$.da_rut_von=!0,$Withdraw$$.trang_thai="5",await $Withdraw$$.save(),$abci$$.data={note:"R\u00fat v\u1ed1n th\u00e0nh c\u00f4ng",obj:$Withdraw$$.toObject()},$abci$$.trang_thai="5",await $abci$$.save(),console.log("lenh rut von nay da duoc thuc hien thanh cong:",$Withdraw$$.id)}catch($e$$){await global.getModel("assbank").sendCoins($Withdraw$$.id_app,
$Withdraw$$.creator,$Withdraw$$.product_owner,$Withdraw$$.von,$Withdraw$$.denom,{...$Withdraw$$.toObject(),event:"WITHDRAW",memo:"R\u00fat v\u1ed1n kh\u00f4ng thanh c\u00f4ng. X\u1eed l\u00fd l\u1ea1i v\u1ed1n \u0111\u00e3 tr\u1ea3 \u0111\u1ec3 th\u1ef1c hi\u1ec7n sau"}),$abci$$.trang_thai="5",$abci$$.event=`${$abci$$.event}-${$now$$.getTime()}`,$abci$$.data={note:"Kh\u00f4ng th\u1ec3 r\u00fat v\u1ed1n. Error: "+$e$$,obj:$Withdraw$$.toObject()},await $abci$$.save(),console.error("Kh\u00f4ng th\u1ec3 r\u00fat v\u1ed1n. Error:",
$e$$)}$callback$$()})},()=>{$resolve$$()})});const $investments$$=await global.getModel("assinvestment").find({trang_thai:"1",status:!0,da_dao_han:!1,ngay_dao_han:{$lte:$now$$}});await new Promise($resolve$$=>{async.mapSeries($investments$$,($Investment$$,$callback$$)=>{setImmediate(async()=>{var $balances_ngay_tinh_lai_ky_truoc_query_abci$$={id_app:$Investment$$.id_app,event:"INVESTMENT-EXPIRED",id:$Investment$$.id};let $abci$$=await model.findOne($balances_ngay_tinh_lai_ky_truoc_query_abci$$);if($abci$$&&
"0"==$abci$$.trang_thai&&1>moment().diff(moment($abci$$.date_created),"hours"))return $callback$$();try{$abci$$=new model($balances_ngay_tinh_lai_ky_truoc_query_abci$$),await $abci$$.save()}catch($e$$){return $callback$$()}$balances_ngay_tinh_lai_ky_truoc_query_abci$$=$Investment$$.ngay_tinh_lai_ky_truoc||$Investment$$.ngay_phat_hanh;let $so_ngay_tinh_lai$$=moment().diff(moment($balances_ngay_tinh_lai_ky_truoc_query_abci$$),"days"),$lai_suat$$=$Investment$$.lai_suat_cam_ket||0;$balances_ngay_tinh_lai_ky_truoc_query_abci$$=
await global.getModel("assbank").getInvestBalances($Investment$$.id_app,"",$Investment$$.token);try{const $period$$=await global.getModel("assperiod").findOne({id_app:$Investment$$.id_app,id:$Investment$$.id_period}),$product$$=await global.getModel("assproduct").findOne({id_app:$Investment$$.id_app,id:$period$$.id_product});await Promise.all($balances_ngay_tinh_lai_ky_truoc_query_abci$$.map($balance$$=>(async()=>{"wallet"==$balance$$.location&&await global.getModel("assbank").sendCoinsFromAccountToSystem($Investment$$.id_app,
$balance$$.address,$balance$$.amount,$balance$$.denom,{...$Investment$$.toObject(),event:"INVESTMENT-EXPIRED",memo:"Kho\u1ea3ng \u0111\u1ea7u t\u01b0 \u0111\u00e3 \u0111\u01b0\u1ee3c \u0111\u00e1o h\u1ea1n"});let $von$$=$Investment$$.gia*$balance$$.amount;try{await global.getModel("assbank").sendCoins($Investment$$.id_app,$product$$.creator,$balance$$.address,$von$$,$Investment$$.denom,{...$Investment$$.toObject(),event:"INVESTMENT-EXPIRED",memo:"Kho\u1ea3n \u0111\u1ea7u t\u01b0 \u0111\u00e3 \u0111\u00e1o h\u1ea1n"})}catch($e$$){throw"wallet"==
$balance$$.location&&await global.getModel("assbank").sendCoinsFromSystemToAccount($Investment$$.id_app,$balance$$.address,$balance$$.amount,$balance$$.denom,{...$Investment$$.toObject(),event:"INVESTMENT-EXPIRED",memo:"X\u1eed l\u00fd kho\u1ea3ng \u0111\u1ea7u t\u01b0 kh\u00f4ng th\u1ec3 \u0111\u00e1o h\u1ea1n"}),$e$$;}let $lai$$=Math.roundBy($von$$*$lai_suat$$*$so_ngay_tinh_lai$$/36500,0);try{$lai$$&&await global.getModel("assbank").sendCoins($Investment$$.id_app,$product$$.creator,$balance$$.address,
$lai$$,$Investment$$.denom,{...$Investment$$.toObject(),event:"INTEREST",memo:"L\u00e3i t\u1eeb \u0111\u1ea7u t\u01b0"})}catch($e$$){throw"wallet"==$balance$$.location&&await global.getModel("assbank").sendCoinsFromSystemToAccount($Investment$$.id_app,$balance$$.address,$balance$$.amount,$balance$$.denom,{...$Investment$$.toObject(),event:"INVESTMENT-EXPIRED",memo:"X\u1eed l\u00fd kho\u1ea3ng \u0111\u1ea7u t\u01b0 kh\u00f4ng th\u1ec3 \u0111\u00e1o h\u1ea1n"}),await global.getModel("assbank").sendCoins($Investment$$.id_app,
$balance$$.address,$product$$.creator,$von$$,$Investment$$.denom,{...$Investment$$.toObject(),event:"INVESTMENT-EXPIRED",memo:"X\u1eed l\u00fd kho\u1ea3ng \u0111\u1ea7u t\u01b0 kh\u00f4ng th\u1ec3 \u0111\u00e1o h\u1ea1n"}),$e$$;}$balance$$.von=$von$$;$balance$$.lai_suat=$lai_suat$$;$balance$$.so_ngay_tinh_lai=$so_ngay_tinh_lai$$;$balance$$.lai=$lai$$;$balance$$.ngay_dao_han=$now$$})()));$Investment$$.trang_thai="5";$Investment$$.da_dao_han=!0;await $Investment$$.save();await global.getModel("asssell").updateMany({id_app:$Investment$$.id_app,
token:$Investment$$.token},{trang_thai:"5"});console.log("khoan dau tu nay da duoc dao han thanh cong:",$Investment$$.token);$abci$$.data={note:`Kho\u1ea3n \u0111\u1ea7u t\u01b0 ${$Investment$$.token} \u0111\u00e3 \u0111\u00e1o h\u1ea1n th\u00e0nh c\u00f4ng`,obj:$Investment$$.toObject(),balances:$balances_ngay_tinh_lai_ky_truoc_query_abci$$};$abci$$.trang_thai="5";await $abci$$.save()}catch($e$$){$abci$$.event=`${$abci$$.event}-${$now$$.getTime()}`,$abci$$.data={note:`Kh\u00f4ng th\u1ec3 \u0111\u00e1o h\u1ea1n kho\u1ea3n \u0111\u1ea7u t\u01b0 ${$Investment$$.token}. Error: ${$e$$}`,
obj:$Investment$$.toObject(),balances:$balances_ngay_tinh_lai_ky_truoc_query_abci$$},$abci$$.trang_thai="5",await $abci$$.save()}$callback$$()})},()=>{$resolve$$()})});const $investments_tralai$$=await global.getModel("assinvestment").find({trang_thai:"1",ky_tinh_lai:{$ne:0},status:!0,da_dao_han:!1,$and:[{ngay_tinh_lai_ky_tiep_theo:{$exists:!0}},{ngay_tinh_lai_ky_tiep_theo:{$lte:$now$$}}]});await new Promise($resolve$$=>{async.mapSeries($investments_tralai$$,($Investment$$,$callback$$)=>{setImmediate(async()=>
{$Investment$$.lan_tinh_lai+=1;let $query_abci$$={id_app:$Investment$$.id_app,event:`INTEREST-${$Investment$$.id}-${$Investment$$.lan_tinh_lai}`,id:$Investment$$.id},$abci$$=await model.findOne($query_abci$$);if($abci$$&&"0"==$abci$$.trang_thai&&1>moment().diff(moment($abci$$.date_created),"hours"))return $callback$$();try{$abci$$=new model($query_abci$$),await $abci$$.save()}catch($e$$){return $callback$$()}try{const $period$$=await global.getModel("assperiod").findOne({id_app:$Investment$$.id_app,
id:$Investment$$.id_period});if(!$period$$)return console.error("Tr\u1ea3 l\u00e3i. Kh\u00f4ng th\u1ec3 t\u00ecm th\u1ea5y k\u1ef3 h\u1ea1n \u0111\u1ea7u t\u01b0",$Investment$$.id_period,$Investment$$.toObject()),await global.getModel("assinvestment").updateOne({_id:$Investment$$._id},{status:!1}),$callback$$();const $product$$=await global.getModel("assproduct").findOne({id_app:$Investment$$.id_app,id:$period$$.id_product});if(!$product$$)return console.error("Tr\u1ea3 l\u00e3i. Kh\u00f4ng th\u1ec3 t\u00ecm th\u1ea5y d\u1ef1 \u00e1n",
$period$$.id_product,$period$$.toObject()),await global.getModel("assinvestment").updateOne({_id:$Investment$$._id},{status:!1}),$callback$$();let $so_ngay_tinh_lai$$=0;switch($Investment$$.ky_tinh_lai){case 1:$so_ngay_tinh_lai$$=moment().diff(moment($Investment$$.ngay_tinh_lai_ky_truoc),"days");$Investment$$.ngay_tinh_lai_ky_tiep_theo=moment().add(1,"days").toDate();break;case 2:$so_ngay_tinh_lai$$=moment().diff(moment($Investment$$.ngay_tinh_lai_ky_truoc),"days");$Investment$$.ngay_tinh_lai_ky_tiep_theo=
moment().add(1,"weeks").toDate();break;case 3:$so_ngay_tinh_lai$$=moment().diff(moment($Investment$$.ngay_tinh_lai_ky_truoc),"days");$Investment$$.ngay_tinh_lai_ky_tiep_theo=moment().add(1,"months").toDate();break;case 4:$so_ngay_tinh_lai$$=moment().diff(moment($Investment$$.ngay_tinh_lai_ky_truoc),"days");$Investment$$.ngay_tinh_lai_ky_tiep_theo=moment().add(1,"quarters").toDate();break;case 5:$so_ngay_tinh_lai$$=moment().diff(moment($Investment$$.ngay_tinh_lai_ky_truoc),"days");$Investment$$.ngay_tinh_lai_ky_tiep_theo=
moment().add(1,"years").toDate();break;case 9:$so_ngay_tinh_lai$$=moment().diff(moment($Investment$$.ngay_tinh_lai_ky_truoc),"hours"),$so_ngay_tinh_lai$$/=24,$Investment$$.ngay_tinh_lai_ky_tiep_theo=moment().add(1,"hours").toDate()}$Investment$$.ngay_tinh_lai_ky_truoc=$now$$;const $balances$$=await global.getModel("assbank").getInvestBalances($Investment$$.id_app,"",$Investment$$.token);await Promise.all($balances$$.map($balance$$=>(async()=>{let $von$$=$Investment$$.gia*$balance$$.amount,$lai_suat$$=
$Investment$$.lai_suat_cam_ket||0,$lai$$=Math.roundBy($von$$*$lai_suat$$*$so_ngay_tinh_lai$$/36500,0);$balance$$.von=$von$$;$balance$$.lai_suat=$lai_suat$$;$balance$$.so_ngay_tinh_lai=$so_ngay_tinh_lai$$;$balance$$.lai=$lai$$;$balance$$.ngay_tinh_lai=$Investment$$.ngay_tinh_lai_ky_truoc;$lai$$&&await global.getModel("assbank").sendCoins($Investment$$.id_app,$product$$.creator,$balance$$.address,$lai$$,$Investment$$.denom,{...$Investment$$.toObject(),event:"INTEREST",memo:"L\u00e3i t\u1eeb \u0111\u1ea7u t\u01b0"})})()));
await $Investment$$.save();$abci$$.data={note:"Tr\u1ea3 l\u00e3i cho kho\u1ea3n \u0111\u1ea7u t\u01b0",obj:$Investment$$.toObject(),balances:$balances$$};$abci$$.trang_thai="5";await $abci$$.save()}catch($e$$){$abci$$.event=`${$abci$$.event}-${$now$$.getTime()}`,$abci$$.data={note:"Kh\u00f4ng th\u1ec3 tr\u1ea3 l\u00e3i \u0111\u1ecbnh k\u1ef3. Error: "+$e$$,obj:$Investment$$.toObject()},$abci$$.trang_thai="5",await $abci$$.save()}$callback$$()})},()=>{$resolve$$()})});let $query$$={trang_thai:"0",
so_luong_con_lai:{$gt:0},ngay_het_han:{$lte:$now$$}};const $ntbs$$=await global.getModel("assneedtobuy").find($query$$);await new Promise($resolve$$=>{async.mapSeries($ntbs$$,($ntb$$,$callback$$)=>{setImmediate(async()=>{let $query_abci$$={id_app:$ntb$$.id_app,event:`NEEDTOBUY-${$ntb$$.id}`,id:$ntb$$.id},$abci$$=await model.findOne($query_abci$$);if($abci$$&&"0"==$abci$$.trang_thai&&1>moment().diff(moment($abci$$.date_created),"hours"))return $callback$$();try{$abci$$=new model($query_abci$$),await $abci$$.save()}catch($e$$){return $callback$$()}try{let $gia_tri_con_lai$$=
$ntb$$.so_luong_con_lai*$ntb$$.gia_mua;await global.getModel("assbank").sendCoinsFromSystemToAccount($ntb$$.id_app,$ntb$$.creator,$gia_tri_con_lai$$,$ntb$$.denom,{...$ntb$$.toObject(),event:"BUY-EXPIRED",memo:"L\u1ec7nh mua \u0111\u00e3 h\u1ebft h\u1ea1n"});$ntb$$.trang_thai="9";await $ntb$$.save();$abci$$.data={note:"Nhu c\u1ea7u mua \u0111\u00e3 h\u1ebft h\u1ea1n",obj:$ntb$$.toObject()};$abci$$.trang_thai="5";await $abci$$.save()}catch($e$$){console.error("Kh\u00f4ng th\u1ec3 x\u1eed l\u00fd l\u1ec7nh mua \u0111\u00e3 h\u1ebft h\u1ea1n",
$e$$),$abci$$.event=`${$abci$$.event}-${$now$$.getTime()}`,$abci$$.data={note:"Kh\u00f4ng th\u1ec3 x\u1eed l\u00fd l\u1ec7nh mua \u0111\u00e3 h\u1ebft h\u1ea1n. Error: "+$e$$,obj:$ntb$$.toObject()},$abci$$.trang_thai="5",await $abci$$.save()}$callback$$()})},()=>{$resolve$$()})});const $sells$$=await global.getModel("asssell").find({trang_thai:"0",status:!0});await new Promise($resolve$$=>{async.mapSeries($sells$$,($sell$$,$callback$$)=>{setImmediate(async()=>{let $query_abci$jscomp$0$$={id_app:$sell$$.id_app,
event:`SELL-${$sell$$.id}`,id:$sell$$.id},$abci$jscomp$0$$=await model.findOne($query_abci$jscomp$0$$);if($abci$jscomp$0$$&&"0"==$abci$jscomp$0$$.trang_thai&&15>moment().diff(moment($abci$jscomp$0$$.date_created),"minutes"))return console.error("Lenh ban nay dang duoc xu ly boi tien trinh khac",$abci$jscomp$0$$.toObject(),", thoi gian da thuc hien:",moment().diff(moment($abci$jscomp$0$$.date_created),"hours")),$callback$$();try{$abci$jscomp$0$$=new model($query_abci$jscomp$0$$),await $abci$jscomp$0$$.save()}catch($e$$){return $callback$$()}if(0==
$sell$$.con_lai)$sell$$.trang_thai="8",await $sell$$.save(),$abci$jscomp$0$$.data={note:"L\u1ec7nh b\u00e1n \u0111\u00e3 b\u00e1n h\u1ebft",obj:$sell$$.toObject()},$abci$jscomp$0$$.trang_thai="5",await $abci$jscomp$0$$.save();else if((new Date($sell$$.ngay_het_han)).getTime()<$now$$.getTime())try{$sell$$.trang_thai="9",await global.getModel("assbank").sendCoinsFromSystemToAccount($sell$$.id_app,$sell$$.creator,$sell$$.con_lai,$sell$$.token,{...$sell$$.toObject(),event:"SELL-EXPIRED",memo:"L\u1ec7nh b\u00e1n \u0111\u00e3 h\u1ebft h\u1ea1n"}),
await $sell$$.save(),$abci$jscomp$0$$.data={note:"L\u1ec7nh b\u00e1n \u0111\u00e3 h\u1ebft h\u1ea1n",obj:$sell$$.toObject()},$abci$jscomp$0$$.trang_thai="5",await $abci$jscomp$0$$.save()}catch($e$$){console.error("Kh\u00f4ng th\u1ec3 x\u1eed l\u00fd l\u1ec7nh b\u00e1n \u0111\u00e3 h\u1ebft h\u1ea1n. Error",$e$$),$abci$jscomp$0$$.trang_thai="5",$abci$jscomp$0$$.data={note:"Kh\u00f4ng th\u1ec3 x\u1eed l\u00fd l\u1ec7nh b\u00e1n \u0111\u00e3 h\u1ebft h\u1ea1n. Error: "+$e$$,obj:$sell$$.toObject()},await $abci$jscomp$0$$.save()}else{var $investment_query$$=
await global.getModel("assinvestment").findOne({id_app:$sell$$.id_app,token:$sell$$.token}).lean();if(!$investment_query$$)return $abci$jscomp$0$$.trang_thai="5",$abci$jscomp$0$$.data={note:"Kho\u1ea3n \u0111\u1ea7u t\u01b0 kh\u00f4ng t\u1ed3n t\u1ea1i",obj:$sell$$.toObject()},await $abci$jscomp$0$$.save(),$callback$$();let $thoi_gian_con_lai_sell$$=$investment_query$$.ngay_dao_han?moment($investment_query$$.ngay_dao_han).diff(moment(),"days"):-1;$investment_query$$={id_app:$sell$$.id_app,id_period:$sell$$.id_period,
creator:{$ne:$sell$$.creator},trang_thai:"0",so_luong_con_lai:{$gt:0},ngay_het_han:{$gte:$now$$}};const $ntbs$$=await global.getModel("assneedtobuy").find($investment_query$$);console.log("ki\u1ec3m tra l\u1ec7nh mua",$investment_query$$,",so luong lenh mua:",$ntbs$$.length);if(0==$ntbs$$.length)return await model.deleteOne($query_abci$jscomp$0$$),$callback$$();await new Promise($rs$$=>{async.mapSeries($ntbs$$,($ntb$$,$cb$$)=>{setImmediate(async()=>{if(0==$sell$$.con_lai)return $cb$$();if($sell$$.gia_ban<=
$ntb$$.gia_mua){if(0<$ntb$$.thoi_gian_con_lai&&(console.log("check thoi gian con lai cua khoan dau tu",{thoi_gian_con_lai_sell:$thoi_gian_con_lai_sell$$,thoi_gian_con_lai:$ntb$$.thoi_gian_con_lai}),0>$thoi_gian_con_lai_sell$$||$ntb$$.thoi_gian_con_lai<$thoi_gian_con_lai_sell$$))return $cb$$();let $query_abci$$={id_app:$ntb$$.id_app,event:`BUY-${$ntb$$.id}`,id:$ntb$$.id},$abci$$=await model.findOne($query_abci$$);if($abci$$&&"0"==$abci$$.trang_thai&&1>moment().diff(moment($abci$$.date_created),"hours"))return $callback$$();
try{$abci$$=new model($query_abci$$),await $abci$$.save()}catch($e$$){return $callback$$()}try{let $so_luong_khop_lenh$$=Math.min($sell$$.con_lai,$ntb$$.so_luong_con_lai),$gia_tri$$=$so_luong_khop_lenh$$*$sell$$.gia_ban;await global.getModel("assbank").sendCoinsFromSystemToAccount($ntb$$.id_app,$ntb$$.creator,$so_luong_khop_lenh$$,$sell$$.token,{...$sell$$.toObject(),event:"KHOPLENH-BUY",memo:"Kh\u1edbp l\u1ec7nh b\u00e1n"});await global.getModel("assbank").sendCoinsFromSystemToAccount($sell$$.id_app,
$sell$$.creator,$gia_tri$$,$sell$$.denom,{...$sell$$.toObject(),event:"KHOPLENH-SELL",memo:"Kh\u1edbp l\u1ec7nh mua"});$sell$$.da_ban=($sell$$.da_ban||0)+$so_luong_khop_lenh$$;$sell$$.con_lai=$sell$$.so_luong-$sell$$.da_ban;0==$sell$$.con_lai&&($sell$$.trang_thai="8");await $sell$$.save();$ntb$$.so_luong_da_mua=($ntb$$.so_luong_da_mua||0)+$so_luong_khop_lenh$$;$ntb$$.so_luong_con_lai=$ntb$$.so_luong-$ntb$$.so_luong_da_mua;0==$ntb$$.so_luong_con_lai&&($ntb$$.trang_thai="8");await $ntb$$.save();$abci$$.data=
{note:"\u0110\u00e3 kh\u1edbp l\u1ec7nh.",id_sell:$sell$$.id,id_ntb:$ntb$$.id,id_period:$sell$$.id_period,so_luong_khop_lenh:$so_luong_khop_lenh$$,gia_khop_lenh:$sell$$.gia_ban,obj:$ntb$$.toObject()};$ntb$$.so_luong_con_lai&&"0"==$ntb$$.trang_thai&&($abci$$.event=`${$abci$$.event}-${$now$$.getTime()}`);$abci$$.trang_thai="5";await $abci$$.save()}catch($e$$){return console.error("L\u1ed7i x\u1eed l\u00fd giao d\u1ecbch. B\u1ecf kho\u00e1 l\u1ec7nh mua ch\u1edd phi\u00ean ti\u1ebfp theo",$query_abci$$),
$abci$$.event=`${$abci$$.event}-${$now$$.getTime()}`,$abci$$.data={note:"L\u1ed7i x\u1eed l\u00fd giao d\u1ecbch. H\u1ec7 th\u1ed1ng s\u1ebd th\u1eed l\u1ea1i trong phi\u00ean ti\u1ebfp theo. Error: "+$e$$,obj:$ntb$$.toObject()},$abci$$.trang_thai="5",await $abci$$.save(),$cb$$($e$$)}}$cb$$()})},async $e$$=>{$e$$?($abci$jscomp$0$$.event=`${$abci$jscomp$0$$.event}-${$now$$.getTime()}`,$abci$jscomp$0$$.data={note:"Kh\u00f4ng th\u1ec3 x\u1eed l\u00fd l\u1ec7nh b\u00e1n n\u00e0y. H\u1ec7 th\u1ed1ng s\u1ebd th\u1eed l\u1ea1i trong phi\u00ean ti\u1ebfp theo. Error:"+
$e$$,obj:$sell$$.toObject()}):($abci$jscomp$0$$.event=`${$abci$jscomp$0$$.event}-${$now$$.getTime()}`,$abci$jscomp$0$$.data={note:"",obj:$sell$$.toObject()});$abci$jscomp$0$$.trang_thai="5";await $abci$jscomp$0$$.save();$rs$$()})})}$callback$$()})},()=>{$resolve$$()})});$next$$()},5E3)},function($err$$){$err$$&&console.error($err$$)})};module.exports=model;