flexbiz-server 12.0.21 → 12.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/server/controllers/controller.js +16 -16
- package/server/libs/blockchainconnect.js +18 -19
- package/server/libs/post-book.js +3 -2
- package/server/libs/post-socai.js +4 -3
- package/server/libs/tinhgiatb.js +15 -16
- package/server/models/approve.js +3 -3
- package/server/models/area.js +3 -3
- package/server/models/assbuy.js +2 -2
- package/server/models/asscashwithdraw.js +2 -2
- package/server/models/assinvestment.js +4 -4
- package/server/models/asskey.js +1 -1
- package/server/models/assneedtobuy.js +3 -3
- package/server/models/assperiod.js +4 -4
- package/server/models/assproduct.js +3 -3
- package/server/models/assprofitsharing.js +3 -3
- package/server/models/assreceiver.js +1 -1
- package/server/models/assrequest.js +3 -3
- package/server/models/asssell.js +4 -4
- package/server/models/asstransfer.js +4 -4
- package/server/models/asswithdraw.js +2 -2
- package/server/models/bangtinhluong.js +1 -1
- package/server/models/bg1.js +8 -8
- package/server/models/bg2.js +7 -7
- package/server/models/cart.js +4 -4
- package/server/models/cddiem.js +1 -1
- package/server/models/cddt.js +2 -2
- package/server/models/cdtk.js +2 -2
- package/server/models/cdvt.js +3 -3
- package/server/models/chamcong.js +2 -2
- package/server/models/checkin.js +3 -2
- package/server/models/dmdt.js +4 -4
- package/server/models/dmdvt.js +1 -1
- package/server/models/dmgiaban.js +5 -5
- package/server/models/dmgiamua.js +4 -4
- package/server/models/dmkho.js +4 -4
- package/server/models/dmkhuyenmai.js +3 -3
- package/server/models/dmkhuyenmaihd.js +2 -2
- package/server/models/dmlo.js +2 -2
- package/server/models/dmloaicong.js +1 -1
- package/server/models/dmloaitask.js +1 -1
- package/server/models/dmloaits.js +1 -1
- package/server/models/dmnghiepvu.js +2 -2
- package/server/models/dmnguonvon.js +1 -1
- package/server/models/dmnhnv.js +3 -3
- package/server/models/dmnv.js +3 -3
- package/server/models/dmphi.js +2 -2
- package/server/models/dmqct.js +3 -3
- package/server/models/dmqddvt.js +1 -1
- package/server/models/dmtanggiamts.js +1 -1
- package/server/models/dmto.js +3 -3
- package/server/models/dmtt.js +2 -2
- package/server/models/dmvt.js +6 -6
- package/server/models/dmyt.js +3 -3
- package/server/models/file.js +2 -2
- package/server/models/listinfo.js +43 -38
- package/server/models/moduleinfo.js +3 -3
- package/server/models/otp.js +1 -1
- package/server/models/pbl.js +11 -11
- package/server/models/pdn.js +8 -8
- package/server/models/pkk.js +2 -2
- package/server/models/pnc.js +8 -8
- package/server/models/pnk.js +6 -6
- package/server/models/po1.js +10 -10
- package/server/models/pxc.js +8 -8
- package/server/models/pxk.js +6 -6
- package/server/models/quanhuyen.js +1 -1
- package/server/models/reportinfo.js +4 -4
- package/server/models/right.js +2 -2
- package/server/models/rpt.js +1 -1
- package/server/models/rptobject.js +2 -2
- package/server/models/socai.js +8 -7
- package/server/models/socaitmp.js +11 -11
- package/server/models/sodiemthuong.js +2 -2
- package/server/models/sokho.js +9 -8
- package/server/models/sokhocapphat.js +9 -8
- package/server/models/sokhokhongton.js +9 -9
- package/server/models/sokhott.js +9 -8
- package/server/models/sophanbokh.js +3 -3
- package/server/models/sosanxuat.js +4 -4
- package/server/models/sotinhkh.js +1 -1
- package/server/models/tableinfo.js +3 -3
- package/server/models/templaterpt.js +1 -1
- package/server/models/templatestore.js +2 -2
- package/server/models/templatevoucher.js +1 -1
- package/server/models/tinhthanh.js +1 -1
- package/server/models/tokens.js +1 -1
- package/server/models/trangthai.js +2 -2
- package/server/models/usergroup.js +1 -1
- package/server/models/vat.js +2 -2
- package/server/models/xaphuong.js +1 -1
- package/server/modules/lists/ls-file.js +16 -14
- package/server/modules/lists/ls-participant.js +5 -4
- package/server/modules/reports/rp-assinterest.js +3 -2
- package/server/modules/reports/rp-thgt.js +2 -2
- package/server/modules/systems/sys-user.js +19 -16
- package/server/modules/vouchers/vo-pkk.js +4 -7
- package/server/route.js +3 -5
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "flexbiz-server",
|
|
3
3
|
"main": "./server/app.js",
|
|
4
4
|
"description": "Flexible Server",
|
|
5
|
-
"version": "12.0.
|
|
5
|
+
"version": "12.0.24",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Van Truong Pham",
|
|
8
8
|
"email": "invncur@gmail.com"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"async": "^3.2.0",
|
|
22
22
|
"axios": "^0.20.0",
|
|
23
23
|
"body-parser": "^1.19.0",
|
|
24
|
-
"
|
|
24
|
+
"bwip-js": "^3.1.0",
|
|
25
25
|
"cheerio": "^1.0.0-rc.10",
|
|
26
26
|
"compression": "^1.7.4",
|
|
27
27
|
"compression-webpack-plugin": "^3.0.0",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"fluent-ffmpeg": "^2.1.2",
|
|
39
39
|
"gm": "^1.23.1",
|
|
40
40
|
"google-translate": "^3.0.0",
|
|
41
|
-
"jsbarcode": "^3.11.5",
|
|
42
41
|
"jsonwebtoken": "^8.5.1",
|
|
43
42
|
"jspdf": "^2.1.1",
|
|
44
43
|
"jszip": "^3.1.5",
|
|
@@ -55,6 +54,7 @@
|
|
|
55
54
|
"multer": "0.1.8",
|
|
56
55
|
"natives": "^1.1.6",
|
|
57
56
|
"ng-node-compile": "^2.0.52",
|
|
57
|
+
"node-tesseract-ocr": "^2.2.1",
|
|
58
58
|
"node-worker-threads-pool": "^1.4.3",
|
|
59
59
|
"node-xlsx": "latest",
|
|
60
60
|
"node-zip": "latest",
|
|
@@ -165,27 +165,27 @@ $obj$$.toObject());if(!$obj$$._id)return console.error("Error when delete post:
|
|
|
165
165
|
function($detail$$,$callback$$){$callback$$($detail$$)})).remove(function($e$$){$callback$jscomp$0$$($e$$)})})},skkhongton:$callback$jscomp$0$$=>{setImmediate(()=>{(new PostBook($obj$$,$obj$$.details,Sokhokhongton,function($detail$$,$callback$$){$callback$$($detail$$)})).remove(function($e$$){$callback$jscomp$0$$($e$$)})})},vsc:$callback$$=>{setImmediate(()=>{if(global.model_books&&0<=global.model_books.indexOf("vsocai"))return $callback$$();vsocai.deleteMany({id_ct:$obj$$._id.toString()},function($error$$){$callback$$($error$$)})})},
|
|
166
166
|
sc:$callback$$=>{setImmediate(()=>{Socai.deleteMany({id_ct:$obj$$._id.toString()},function($error$$){$callback$$($error$$)})})},vatra:$callback$$=>{setImmediate(()=>{if(global.model_books&&0<=global.model_books.indexOf("vatra"))return $callback$$();Vatra.deleteMany({id_ct:$obj$$._id.toString()},function($error$$){$callback$$($error$$)})})},vatvao:$callback$$=>{setImmediate(()=>{if(global.model_books&&0<=global.model_books.indexOf("vatvao"))return $callback$$();Vatvao.deleteMany({id_ct:$obj$$._id.toString()},
|
|
167
167
|
function($error$$){$callback$$($error$$)})})},tdttno:$callback$$=>{setImmediate(()=>{if(global.model_books&&0<=global.model_books.indexOf("tdttno"))return $callback$$();Tdttno.deleteMany({id_ct:$obj$$._id.toString()},function($error$$){$callback$$($error$$)})})},tdttco:$callback$$=>{setImmediate(()=>{if(global.model_books&&0<=global.model_books.indexOf("tdttco"))return $callback$$();Tdttco.deleteMany({id_ct:$obj$$._id.toString()},function($error$$){$callback$$($error$$)})})},tdttno_tt:$callback$jscomp$0$$=>
|
|
168
|
-
{setImmediate(()=>{Tdttno_tt.deleteMany({id_ct:$obj$$._id.toString()},function($error$jscomp$0$$){if($error$jscomp$0$$)return $callback$jscomp$0$$($error$jscomp$0$$);$obj$$.tdttnos?async.map($obj$$.tdttnos,function($detail$$,$callback$$){setImmediate(()=>{Tdttno.findOneAndUpdate({_id:$detail$$.id_hd,so_hd:$detail$$.so_hd},{$set:{tat_toan:!1}},function($error$$){setImmediate(()=>{if($error$$)return $callback$$($error$$);$callback$$()})})})},function($e$$){console.error($e$$);$callback$jscomp$0$$()}):
|
|
168
|
+
{setImmediate(()=>{Tdttno_tt.deleteMany({id_ct:$obj$$._id.toString()},function($error$jscomp$0$$){if($error$jscomp$0$$)return $callback$jscomp$0$$($error$jscomp$0$$);$obj$$.tdttnos?async.map($obj$$.tdttnos,function($detail$$,$callback$$){setImmediate(()=>{Tdttno.findOneAndUpdate({_id:$detail$$.id_hd,so_hd:$detail$$.so_hd},{$set:{tat_toan:!1}},function($error$$){setImmediate(()=>{if($error$$)return $callback$$($error$$);$callback$$()})})})},function($e$$){$e$$&&console.error($e$$);$callback$jscomp$0$$()}):
|
|
169
169
|
$callback$jscomp$0$$()})})},tdttco_tt:$callback$jscomp$0$$=>{setImmediate(()=>{Tdttco_tt.deleteMany({id_ct:$obj$$._id.toString()},function($error$jscomp$0$$){if($error$jscomp$0$$)return $callback$jscomp$0$$($error$jscomp$0$$);$obj$$.tdttcos?async.map($obj$$.tdttcos,function($detail$$,$callback$$){setImmediate(()=>{Tdttco.findOneAndUpdate({_id:$detail$$.id_hd,so_hd:$detail$$.so_hd},{$set:{tat_toan:!1}},function($error$$){setImmediate(()=>{if($error$$)return $callback$$($error$$);$callback$$()})})})},
|
|
170
|
-
function($e$$){console.error($e$$);$callback$jscomp$0$$()}):$callback$jscomp$0$$()})})}},function($e$$){console.
|
|
170
|
+
function($e$$){$e$$&&console.error($e$$);$callback$jscomp$0$$()}):$callback$jscomp$0$$()})})}},function($e$$){$e$$&&console.error("delete books",$e$$);$callback$jscomp$1$$($e$$,$obj$$)})},runWebhooks=controller.runWebhooks=async($ctrl$$,$obj$$,$action$$,$voucher_options$$)=>{$voucher_options$$||($voucher_options$$=(await OptionsModel.findOne({id_app:$obj$$.id_app,id_func:$ctrl$$.name},{option:1}).lean()||{}).option);if($voucher_options$$&&$voucher_options$$.option_webhooks&&($ctrl$$=$voucher_options$$.option_webhooks.find($w$$=>
|
|
171
171
|
$w$$.action.toUpperCase()===$action$$.toUpperCase()&&$w$$.url))){$voucher_options$$=path.dirname(__dirname)+"/workers/webhook.js";if(!fs.existsSync($voucher_options$$))return console.error("webhook process is not exitst");global.webhookPool||(global.webhookPool=new StaticPool($voucher_options$$));global.webhookPool.exec({data:$obj$$,webhook_configs:$ctrl$$},$response$$=>{$response$$.error?console.error($response$$.error):console.log($response$$)})}},postData=controller.postData=function($obj$$,$ctrl$$,
|
|
172
172
|
$callback$jscomp$0$$){const $post$$=$ctrl$$.dynamicPost||$ctrl$$.post;if(!$post$$)return $callback$jscomp$0$$();let $obj_created$$=$obj$$.toObject?$obj$$.toObject():{...$obj$$};if(!$obj_created$$.ma_ct)return console.error("\u0110\u1ec3 post \u0111\u01b0\u1ee3c data, y\u00eau c\u1ea7u c\u1ea7n c\u00f3 field ma_ct",$obj_created$$),$callback$jscomp$0$$("\u0110\u1ec3 post \u0111\u01b0\u1ee3c data, \u0110\u1ed1i t\u01b0\u1ee3ng c\u1ea7n c\u00f3 d\u1eef li\u1ec7u ma_ct,trang_thai");Object.keys($obj_created$$).forEach($key$$=>
|
|
173
173
|
{let $p$$=$obj_created$$[$key$$];$p$$&&($p$$.toObject&&($obj_created$$[$key$$]=$p$$.toObject()),underscore.isArray($p$$)&&($obj_created$$[$key$$]=$p$$.map($el$$=>$el$$?$el$$.toObject?$el$$.toObject():$el$$:$el$$)))});$ctrl$$.beforePost||($ctrl$$.beforePost=function($obj_created$$,$callback$$){$callback$$(null,null)});$ctrl$$.beforePost($obj_created$$,function($e$jscomp$3$$){if($e$jscomp$3$$)return $callback$jscomp$0$$($e$jscomp$3$$);deletePost($obj_created$$.user_updated,$obj_created$$,async function($e$jscomp$2$$){if($e$jscomp$2$$)return $callback$jscomp$0$$($e$jscomp$2$$);
|
|
174
174
|
if($ctrl$$.dynamicDeletePost)try{await $ctrl$$.dynamicDeletePost($obj_created$$)}catch($e$$){return $callback$jscomp$0$$($e$$.message||$e$$.error||$e$$)}setImmediate(()=>{if($obj_created$$.trang_thai||0==$obj_created$$.trang_thai)$obj_created$$.trang_thai=$obj_created$$.trang_thai.toString();trangthai.findOne({ma_ct:$obj_created$$.ma_ct.toUpperCase(),ma_trang_thai:$obj_created$$.trang_thai},function($e$jscomp$1$$,$trang_thai$$){if($e$jscomp$1$$)return $callback$jscomp$0$$($e$jscomp$1$$);if($trang_thai$$&&
|
|
175
|
-
!$trang_thai$$.post)return $callback$jscomp$0$$();setImmediate(()=>{$post$$($obj_created$$,function($e$jscomp$0$$,$rs$$){setImmediate(()=>{$e$jscomp$0
|
|
176
|
-
$callback$jscomp$0$$($e$jscomp$0$$.message||$e$jscomp$0$$.error||$e$jscomp$0$$)}catch($e$$){return console.error($e$$.message||$e$$.error||$e$$),$callback$jscomp$0$$($e$$)}else $callback$jscomp$0$$($e$jscomp$0$$)})
|
|
177
|
-
{...$_obj$$};$obj$jscomp$0$$._id=$obj$jscomp$0$$._id.toString();$options$$||($options$$={});var $exclude_token$$=$options$$.exclude_token,$trang_thai$$=($obj$jscomp$0$$.trang_thai||(0==$obj$jscomp$0$$.progress?"0":$obj$jscomp$0$$.progress)||
|
|
178
|
-
$rs$$)=>{setImmediate(async()=>{if($rs$$&&$rs$$.option&&$rs$$.option.users_receive_notification)var $notifications_setting_users_receive_notification$$=$rs$$.option.users_receive_notification;$notifications_setting_users_receive_notification$$&&
|
|
179
|
-
$resolve$$(await $n$$($obj$jscomp$0$$)):$resolve$$($n$$)})}))));$notifications_setting_users_receive_notification$$&&($notifications_setting_users_receive_notification$$=$notifications_setting_users_receive_notification$$.filter($u
|
|
180
|
-
$func_string$jscomp$1_n$$=$func_string$jscomp$1_n$$.condition;0>$func_string$jscomp$1_n$$.indexOf("return ")&&($func_string$jscomp$1_n$$=`return ${$func_string$jscomp$1_n$$}`);try{return evalute($func_string$jscomp$1_n$$,
|
|
181
|
-
trang_thai:$trang_thai$$,id_app:$obj$jscomp$0$$.id_app,code:$obj$jscomp$0$$.ma_ct||$ctrl$$.name,id_link:$obj$jscomp$0$$.id_link,code_link:$obj$jscomp$0$$.code_link,event:$eventName$$,action:$eventName$$.toUpperCase(),
|
|
182
|
-
$p$jscomp$0$$.title||$p$jscomp$0$$.content||"",$obj$jscomp$0$$)));$notificationData$$.title||$notificationData$$.body||($exclude_token$$=null);let $users_will_receive$$=$p$jscomp$0$$.users;$users_will_receive$$||
|
|
183
|
-
(await Participant.find({id_app:$obj$jscomp$0$$.id_app,group_id:{$in:$admins_employees_groups_of_user_sandbox$$}}).lean()).map($p$$=>$p$$.email),$users_will_receive$$=$users_will_receive$$.concat($admins_employees_groups_of_user_sandbox$$))}$p$jscomp$0$$.send_phu_trach
|
|
184
|
-
|
|
185
|
-
$p$jscomp$0$$.send_to_customer&&($obj$jscomp$0$$.ma_kh||$obj$jscomp$0$$.id_kh)&&($admins_employees_groups_of_user_sandbox$$=await mongoose.models.customer.getInfo($obj$jscomp$0$$.id_app,{$or:[{ma_kh:$obj$jscomp$0$$.ma_kh},
|
|
186
|
-
($users_will_receive$$=$users_will_receive$$.filter($u$$=>$u$$!==$obj$jscomp$0$$.user_created));if($p$jscomp$0$$.handle_receivers){$admins_employees_groups_of_user_sandbox$$={obj:$obj$jscomp$0$$,users_will_receive:$users_will_receive$$};
|
|
187
|
-
($ctrl$$.options={});$ctrl$$.options.onEmitEvent||($ctrl$$.options.onEmitEvent=($obj$$,$users_will_receive$$,$next$$,$_notificationData$$)=>{$next$$(null,$users_will_receive$$,$_notificationData$$)});$ctrl$$.options.onEmitEvent(Object.assign({}
|
|
188
|
-
app.emitEvent($obj$jscomp$0$$.id_app,`${$ctrl$$.name.toLowerCase()}:${$eventName$$}`,$_notificationData$$||$notificationData$$,$exclude_token$$,$_users_will_receive$$,!0)})},Object.assign({},$notificationData$$),Object.assign({},$p$jscomp$0$$))})}))})})}})};
|
|
175
|
+
!$trang_thai$$.post)return $callback$jscomp$0$$();setImmediate(()=>{$post$$($obj_created$$,function($e$jscomp$0$$,$rs$$){setImmediate(()=>{if($e$jscomp$0$$){let $msg_error$$=$e$jscomp$0$$.message||$e$jscomp$0$$.error||$e$jscomp$0$$.toString();if(0<=$msg_error$$.indexOf("E11000 duplicate")&&(0<=$msg_error$$.indexOf("id_ct_1_nh_dk_1")||0<=$msg_error$$.indexOf("id_ct_1_line_1")))return $callback$jscomp$0$$(null,$rs$$);console.error("error post data",$obj_created$$._id,$msg_error$$);deletePost($obj_created$$.user_updated,
|
|
176
|
+
$obj_created$$,async function($e_delete_post$$){if($e_delete_post$$)return console.error("error delete post",$e_delete_post$$),$callback$jscomp$0$$($e_delete_post$$);console.error("deleted books because error post");if($ctrl$$.dynamicDeletePost)try{return await $ctrl$$.dynamicDeletePost($obj_created$$),$callback$jscomp$0$$($e$jscomp$0$$.message||$e$jscomp$0$$.error||$e$jscomp$0$$)}catch($e$$){return console.error($e$$.message||$e$$.error||$e$$),$callback$jscomp$0$$($e$$)}else $callback$jscomp$0$$($e$jscomp$0$$)})}else $callback$jscomp$0$$(null,
|
|
177
|
+
$rs$$)})})})})})})})},pushNotification=controller.pushNotification=($ctrl$$,$_obj$$,$eventName$$="new",$old_obj$$=null,$justFireEvents$$=!1,$options$$={title:"",data:{}})=>{setImmediate(()=>{if($_obj$$.status){var $obj$jscomp$0$$=$_obj$$.toObject?$_obj$$.toObject():{...$_obj$$};$obj$jscomp$0$$._id=$obj$jscomp$0$$._id.toString();$options$$||($options$$={});var $exclude_token$$=$options$$.exclude_token,$trang_thai$$=($obj$jscomp$0$$.trang_thai||(0==$obj$jscomp$0$$.progress?"0":$obj$jscomp$0$$.progress)||
|
|
178
|
+
"").toString();$old_obj$$&&!$justFireEvents$$&&($old_obj$$.trang_thai||(0==$old_obj$$.progress?"0":$old_obj$$.progress)||"").toString()===$trang_thai$$&&($justFireEvents$$=!0);OptionsModel.findOne({id_app:$obj$jscomp$0$$.id_app,id_func:$ctrl$$.name},{option:1}).lean().exec(async($e$jscomp$0$$,$rs$$)=>{setImmediate(async()=>{if($rs$$&&$rs$$.option&&$rs$$.option.users_receive_notification)var $notifications_setting_users_receive_notification$$=$rs$$.option.users_receive_notification;$notifications_setting_users_receive_notification$$&&
|
|
179
|
+
0!==$notifications_setting_users_receive_notification$$.length||($notifications_setting_users_receive_notification$$=await Promise.all((($ctrl$$.options||{}).users_receive_notification_default||[]).map($n$$=>new Promise($resolve$$=>{setImmediate(async()=>{underscore.isFunction($n$$)?$resolve$$(await $n$$($obj$jscomp$0$$)):$resolve$$($n$$)})}))));$notifications_setting_users_receive_notification$$&&($notifications_setting_users_receive_notification$$=$notifications_setting_users_receive_notification$$.filter($u$$=>
|
|
180
|
+
!$u$$.trang_thai||$u$$.trang_thai.toString()===$trang_thai$$||"delete"===$u$$.trang_thai.toString()),$notifications_setting_users_receive_notification$$=$notifications_setting_users_receive_notification$$.filter($func_string$jscomp$1_n$$=>{if(!$func_string$jscomp$1_n$$.condition)return!0;$func_string$jscomp$1_n$$=$func_string$jscomp$1_n$$.condition;0>$func_string$jscomp$1_n$$.indexOf("return ")&&($func_string$jscomp$1_n$$=`return ${$func_string$jscomp$1_n$$}`);try{return evalute($func_string$jscomp$1_n$$,
|
|
181
|
+
{...$obj$jscomp$0$$,master:$obj$jscomp$0$$,data:$obj$jscomp$0$$})}catch($e$$){return console.error($e$$,$func_string$jscomp$1_n$$),!1}}),$notifications_setting_users_receive_notification$$.forEach(async $p$jscomp$0$$=>{setImmediate(async()=>{let $notificationData$$={_id:$obj$jscomp$0$$._id,trang_thai:$trang_thai$$,id_app:$obj$jscomp$0$$.id_app,code:$obj$jscomp$0$$.ma_ct||$ctrl$$.name,id_link:$obj$jscomp$0$$.id_link,code_link:$obj$jscomp$0$$.code_link,event:$eventName$$,action:$eventName$$.toUpperCase(),
|
|
182
|
+
data:$options$$.data};$justFireEvents$$||"delete"===$eventName$$.toLowerCase()?($notificationData$$.title="",$notificationData$$.body=""):($notificationData$$.body=$p$jscomp$0$$.body?compileHtml($p$jscomp$0$$.body,$obj$jscomp$0$$):"",$notificationData$$.title=stripHtmlTags(compileHtml($options$$.title||$p$jscomp$0$$.title||$p$jscomp$0$$.content||"",$obj$jscomp$0$$)));$notificationData$$.title||$notificationData$$.body||($exclude_token$$=null);let $users_will_receive$$=$p$jscomp$0$$.users;$users_will_receive$$||
|
|
183
|
+
($users_will_receive$$=[]);if($p$jscomp$0$$.send_tat_ca_nhan_vien){var $admins_employees_groups_of_user_sandbox$$=(await Usergroup.find({id_app:$obj$jscomp$0$$.id_app,is_employee_group:!0}).lean()).map($g$$=>$g$$._id.toString());0<$admins_employees_groups_of_user_sandbox$$.length&&($admins_employees_groups_of_user_sandbox$$=(await Participant.find({id_app:$obj$jscomp$0$$.id_app,group_id:{$in:$admins_employees_groups_of_user_sandbox$$}}).lean()).map($p$$=>$p$$.email),$users_will_receive$$=$users_will_receive$$.concat($admins_employees_groups_of_user_sandbox$$))}$p$jscomp$0$$.send_phu_trach&&
|
|
184
|
+
$obj$jscomp$0$$.phu_trach&&($users_will_receive$$=$users_will_receive$$.concat([$obj$jscomp$0$$.phu_trach]));$p$jscomp$0$$.send_admin&&($admins_employees_groups_of_user_sandbox$$=(await Participant.find({id_app:$obj$jscomp$0$$.id_app,admin:!0}).lean()).map($p$$=>$p$$.email),$users_will_receive$$=$users_will_receive$$.concat($admins_employees_groups_of_user_sandbox$$));$p$jscomp$0$$.send_attends&&$obj$jscomp$0$$.attends&&($users_will_receive$$=$users_will_receive$$.concat($obj$jscomp$0$$.attends));
|
|
185
|
+
$p$jscomp$0$$.group_id&&($admins_employees_groups_of_user_sandbox$$=(await Participant.find({id_app:$obj$jscomp$0$$.id_app,group_id:$p$jscomp$0$$.group_id}).lean()).map($u$$=>$u$$.email),$users_will_receive$$=$users_will_receive$$.concat($admins_employees_groups_of_user_sandbox$$));$p$jscomp$0$$.send_to_customer&&($obj$jscomp$0$$.ma_kh||$obj$jscomp$0$$.id_kh)&&($admins_employees_groups_of_user_sandbox$$=await mongoose.models.customer.getInfo($obj$jscomp$0$$.id_app,{$or:[{ma_kh:$obj$jscomp$0$$.ma_kh},
|
|
186
|
+
{_id:$obj$jscomp$0$$.id_kh}]},"of_user"))&&($users_will_receive$$=$users_will_receive$$.concat([$admins_employees_groups_of_user_sandbox$$]));$p$jscomp$0$$.send_to_user_created?$users_will_receive$$=$users_will_receive$$.concat([$obj$jscomp$0$$.user_created]):!1===$p$jscomp$0$$.send_to_user_created&&($users_will_receive$$=$users_will_receive$$.filter($u$$=>$u$$!==$obj$jscomp$0$$.user_created));if($p$jscomp$0$$.handle_receivers){$admins_employees_groups_of_user_sandbox$$={obj:$obj$jscomp$0$$,users_will_receive:$users_will_receive$$};
|
|
187
|
+
try{let $str_func$$=$p$jscomp$0$$.handle_receivers;0!==$str_func$$.indexOf("return ")&&($str_func$$=`return ${$str_func$$}`);0>$str_func$$.indexOf("async ")&&($users_will_receive$$=evalute($str_func$$,$admins_employees_groups_of_user_sandbox$$))}catch($e$$){console.error($e$$)}}$ctrl$$.options||($ctrl$$.options={});$ctrl$$.options.onEmitEvent||($ctrl$$.options.onEmitEvent=($obj$$,$users_will_receive$$,$next$$,$_notificationData$$)=>{$next$$(null,$users_will_receive$$,$_notificationData$$)});$ctrl$$.options.onEmitEvent(Object.assign({},
|
|
188
|
+
$obj$jscomp$0$$),$users_will_receive$$,($e$$,$_users_will_receive$$,$_notificationData$$)=>{setImmediate(()=>{if($e$$)return console.error("Error emit events",$e$$);$_users_will_receive$$=underscore.uniq($_users_will_receive$$);0<$_users_will_receive$$.length&&app.emitEvent($obj$jscomp$0$$.id_app,`${$ctrl$$.name.toLowerCase()}:${$eventName$$}`,$_notificationData$$||$notificationData$$,$exclude_token$$,$_users_will_receive$$,!0)})},Object.assign({},$notificationData$$),Object.assign({},$p$jscomp$0$$))})}))})})}})};
|
|
189
189
|
async function createIdRef($model$$,$data$$){$model$$=Object.values($model$$.schema.paths).filter($path$$=>$path$$.options&&$path$$.options.ref&&$path$$.options.localField&&$path$$.options.foreignField);try{return await Promise.all($model$$.map($path$$=>new Promise($resove$$=>{setImmediate(async()=>{let $namePath$$=$path$$.path;var $modelRef_modelRefName$$=$path$$.options.ref,$localField_obj$$=$path$$.options.localField;let $foreignField$$=$path$$.options.foreignField;$data$$[$localField_obj$$]?($modelRef_modelRefName$$=
|
|
190
190
|
mongoose.models[$modelRef_modelRefName$$.toLowerCase()])?($localField_obj$$=await $modelRef_modelRefName$$.findOne({id_app:$data$$.id_app,[$foreignField$$]:$data$$[$localField_obj$$]}).lean(),$data$$[$namePath$$]=$localField_obj$$?$localField_obj$$._id.toString():null):$data$$[$namePath$$]=null:$data$$[$namePath$$]=null;$resove$$($path$$)})})))}catch($e2$$){return console.error("error create ref data",$e2$$),null}}
|
|
191
191
|
async function create($user$jscomp$0$$,$ctrl$$,$data$$,$callback$jscomp$1$$,$id_be_supply_by_user$$,$req$$){try{const $model$$=$ctrl$$.model,$voucher_options$$=(await OptionsModel.findOne({id_app:$user$jscomp$0$$.current_id_app,id_func:$ctrl$$.name}).lean()||{}).option,$schema_paths$$=$model$$.schema.paths;let $v_data$$;try{$v_data$$=await asyncBodyToJson($data$$,$ctrl$$,$user$jscomp$0$$.current_id_app,$voucher_options$$)}catch($e$$){return $callback$jscomp$1$$($e$$.message||$e$$.error||$e$$)}underscore.has($schema_paths$$,
|
|
@@ -24,27 +24,26 @@ $events$jscomp$1_rs$$.page=$page$$;$events$jscomp$1_rs$$.txs.forEach($r$$=>{$r$$
|
|
|
24
24
|
$url$$),$reject$$($e$$))})})},ping=async $from_address$$=>{console.log("ping from ",$from_address$$,"...");let $key$$=await model.findOne({address:$from_address$$});$key$$&&createTx($key$$.id_app,null,{values:{creator:$from_address$$,data:0},typeUrl:"/pvtruong.flexzen.flexzen.MsgPing",from_address:$from_address$$,username:$key$$.username}).then(async $rs$$=>{console.log("Pingged",$rs$$.code)})},processEventTx=async $data$$=>{try{let $senders$$=[],$receivers$$=[],$owners$$=[];for(let $key$$ in $data$$.result.events)$data$$.result.events[$key$$].forEach(async $action$$=>
|
|
25
25
|
{0<$key$$.indexOf(".owner")?$owners$$.push($action$$):0<$key$$.indexOf(".sender")?$senders$$.push($action$$):(0<$key$$.indexOf(".receiver")||0<$key$$.indexOf(".recipient"))&&$receivers$$.push($action$$)});[...(new Set($senders$$))].forEach(async $sender$$=>{let $u$$=await getKeyByAddress($sender$$);$u$$&&User.emitEvent($u$$.user_created,"blockchain.wallet.changed",{sender:$sender$$,data:$data$$})});[...(new Set($receivers$$))].forEach(async $receiver$$=>{let $u$$=await getKeyByAddress($receiver$$);
|
|
26
26
|
$u$$&&User.emitEvent($u$$.user_created,"blockchain.wallet.changed",{receiver:$receiver$$,data:$data$$})});[...(new Set($owners$$))].filter($o$$=>!$senders$$.find($s$$=>$s$$==$o$$)).filter($o$$=>!$receivers$$.find($s$$=>$s$$==$o$$)).forEach(async $owner$$=>{let $u$$=await getKeyByAddress($owner$$);$u$$&&User.emitEvent($u$$.user_created,"blockchain.wallet.changed",{receiver:$owner$$,sender:$owner$$,data:$data$$})})}catch($e$$){console.error("error emit events",$e$$.message)}};let notificationPool={};
|
|
27
|
-
const processEventAt=async $events$$=>{let $receivers$$=[];for(let $key$$ in $events$$)$events$$[$key$$].forEach(async $action$$=>{(0<=$key$$.indexOf(".receiver")||0<=$key$$.indexOf(".recipient")||0<=$key$$.indexOf(".sender")||0<=$key$$.indexOf(".creator")||0<=$key$$.indexOf(".owner")||0<=$key$$.indexOf(".buyer")||0<=$key$$.indexOf(".seller"))&&$receivers$$.push($action$$)});[...(new Set($receivers$$))].forEach(async $receiver$$=>{let $u$$=await getKeyByAddress($receiver$$);$u$$&&$events$$["at.action"].forEach(async($
|
|
27
|
+
const processEventAt=async $events$$=>{let $receivers$$=[];for(let $key$$ in $events$$)$events$$[$key$$].forEach(async $action$$=>{(0<=$key$$.indexOf(".receiver")||0<=$key$$.indexOf(".recipient")||0<=$key$$.indexOf(".sender")||0<=$key$$.indexOf(".creator")||0<=$key$$.indexOf(".owner")||0<=$key$$.indexOf(".buyer")||0<=$key$$.indexOf(".seller"))&&$receivers$$.push($action$$)});[...(new Set($receivers$$))].forEach(async $receiver$$=>{let $u$$=await getKeyByAddress($receiver$$);$u$$&&$events$$["at.action"].forEach(async($_u_action$$,
|
|
28
28
|
$id$jscomp$2_index$jscomp$17_title_token$$)=>{let $creator$$=$events$$["at.creator"]&&$events$$["at.creator"].length>$id$jscomp$2_index$jscomp$17_title_token$$?$events$$["at.creator"][$id$jscomp$2_index$jscomp$17_title_token$$]:"",$owner$$=$events$$["at.owner"]&&$events$$["at.owner"].length>$id$jscomp$2_index$jscomp$17_title_token$$?$events$$["at.owner"][$id$jscomp$2_index$jscomp$17_title_token$$]:"",$memo$$=$events$$["at.memo"]&&$events$$["at.memo"].length>$id$jscomp$2_index$jscomp$17_title_token$$?
|
|
29
|
-
$events$$["at.memo"][$id$jscomp$2_index$jscomp$17_title_token$$]:"",$timestamp$$=$events$$["at.timestamp"]&&$events$$["at.timestamp"].length>$id$jscomp$2_index$jscomp$17_title_token$$?$events$$["at.timestamp"][$id$jscomp$2_index$jscomp$17_title_token$$]:"";$timestamp$$=Number($timestamp$$||0)+$id$jscomp$2_index$jscomp$17_title_token$$;switch($
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
$events$$["at.memo"][$id$jscomp$2_index$jscomp$17_title_token$$]:"",$timestamp$$=$events$$["at.timestamp"]&&$events$$["at.timestamp"].length>$id$jscomp$2_index$jscomp$17_title_token$$?$events$$["at.timestamp"][$id$jscomp$2_index$jscomp$17_title_token$$]:"";$timestamp$$=Number($timestamp$$||0)+$id$jscomp$2_index$jscomp$17_title_token$$;switch($_u_action$$){case "send":$_u_action$$=$events$$["at.sender"]&&$events$$["at.sender"].length>$id$jscomp$2_index$jscomp$17_title_token$$?$events$$["at.sender"][$id$jscomp$2_index$jscomp$17_title_token$$]:
|
|
30
|
+
"";if($receiver$$!==$_u_action$$){var $id_invest_noti_sender$jscomp$1_token$$="";$_u_action$$&&($_u_action$$=await getKeyByAddress($_u_action$$))&&($id_invest_noti_sender$jscomp$1_token$$=$_u_action$$.name);$_u_action$$=$events$$["at.denom"]&&$events$$["at.denom"].length>$id$jscomp$2_index$jscomp$17_title_token$$?$events$$["at.denom"][$id$jscomp$2_index$jscomp$17_title_token$$]:"vnd";$id$jscomp$2_index$jscomp$17_title_token$$=`${$id_invest_noti_sender$jscomp$1_token$$||"unknow"} \u0111\u00e3 g\u1eedi cho b\u1ea1n ${numeral($events$$["at.amount"]&&
|
|
31
|
+
$events$$["at.amount"].length>$id$jscomp$2_index$jscomp$17_title_token$$?$events$$["at.amount"][$id$jscomp$2_index$jscomp$17_title_token$$]:0).format()} ${$_u_action$$}`;$id_invest_noti_sender$jscomp$1_token$$={title:$id$jscomp$2_index$jscomp$17_title_token$$,receiver:$receiver$$,body:`${$id$jscomp$2_index$jscomp$17_title_token$$} v\u1edbi n\u1ed9i dung: ${$memo$$}`,data:{key:"send:"+$timestamp$$}}}break;case "withdraw":$id$jscomp$2_index$jscomp$17_title_token$$=$events$$["at.idWithdraw"]&&$events$$["at.idWithdraw"].length>
|
|
32
|
+
$id$jscomp$2_index$jscomp$17_title_token$$?$events$$["at.idWithdraw"][$id$jscomp$2_index$jscomp$17_title_token$$]:"";$id_invest_noti_sender$jscomp$1_token$$={title:"X\u1eed l\u00fd r\u00fat v\u1ed1n",receiver:$receiver$$,body:$memo$$||`Y\u00eau c\u1ea7u r\u00fat v\u1ed1n s\u1ed1 ${$id$jscomp$2_index$jscomp$17_title_token$$} \u0111\u00e3 \u0111\u01b0\u1ee3c x\u1eed l\u00fd xong`,data:{key:"withdraw:"+$id$jscomp$2_index$jscomp$17_title_token$$+$timestamp$$,id_withdraw:$events$$["at.idWithdraw"]}};break;
|
|
33
|
+
case "buy":$receiver$$===$creator$$&&($id_invest_noti_sender$jscomp$1_token$$={title:"Mua th\u00e0nh c\u00f4ng",receiver:$receiver$$,body:$memo$$||`B\u1ea1n \u0111\u00e3 mua th\u00e0nh c\u00f4ng ${$events$$["at.amount"][$id$jscomp$2_index$jscomp$17_title_token$$]} ${$events$$["at.token"][$id$jscomp$2_index$jscomp$17_title_token$$]}`,data:{key:`buy:${$events$$["at.idNeedToBuy"][$id$jscomp$2_index$jscomp$17_title_token$$]}-${$events$$["at.idSell"][$id$jscomp$2_index$jscomp$17_title_token$$]}`+$timestamp$$,
|
|
34
|
+
id_need_to_buy:$events$$["at.idNeedToBuy"][$id$jscomp$2_index$jscomp$17_title_token$$],id_sell:$events$$["at.idSell"][$id$jscomp$2_index$jscomp$17_title_token$$]}});break;case "sell":$receiver$$===$creator$$&&($id_invest_noti_sender$jscomp$1_token$$={title:"B\u00e1n th\u00e0nh c\u00f4ng",receiver:$receiver$$,body:$memo$$||`B\u1ea1n \u0111\u00e3 b\u00e1n th\u00e0nh c\u00f4ng ${$events$$["at.amount"][$id$jscomp$2_index$jscomp$17_title_token$$]} ${$events$$["at.token"][$id$jscomp$2_index$jscomp$17_title_token$$]}`,
|
|
35
35
|
data:{key:`sell:${$events$$["at.idSell"][$id$jscomp$2_index$jscomp$17_title_token$$]}-${$events$$["at.idBuy"][$id$jscomp$2_index$jscomp$17_title_token$$]}`+$timestamp$$,id_sell:$events$$["at.idSell"][$id$jscomp$2_index$jscomp$17_title_token$$],id_buy:$events$$["at.idBuy"][$id$jscomp$2_index$jscomp$17_title_token$$]}});break;case "sell-expired":if($receiver$$===$creator$$){let $id_sell$$=$events$$["at.idSell"][$id$jscomp$2_index$jscomp$17_title_token$$];global.getModel("asssell").updateOne({id:$id_sell$$},
|
|
36
|
-
{trang_thai:"9"}).then($rs$$=>{console.log("updated expired asssell",$id_sell$$,$rs$$)});$
|
|
37
|
-
Number($events$$["at.idNeedToBuy"][$id$jscomp$2_index$jscomp$17_title_token$$]);global.getModel("assneedtobuy").updateOne({id:$id_need_to_buy$$},{trang_thai:"9"}).then($rs$$=>{console.log("updated expired need to buy",$id_need_to_buy$$,$rs$$)});$
|
|
38
|
-
data:{key:"need-to-buy-expired:"+$events$$["at.idNeedToBuy"][$id$jscomp$2_index$jscomp$17_title_token$$]+$timestamp$$,id_need_to_buy:$events$$["at.idNeedToBuy"][$id$jscomp$2_index$jscomp$17_title_token$$]}}}break;case "invest-interest":$receiver$$===$owner$$&&($
|
|
39
|
-
$
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
$
|
|
47
|
-
notificationPool[$denom_ky_tra_lai_noti_sender_address$$.data.key]=$denom_ky_tra_lai_noti_sender_address$$)})})},WS=require("ws");let notiInterval,connectSocket=!1;
|
|
36
|
+
{trang_thai:"9"}).then($rs$$=>{console.log("updated expired asssell",$id_sell$$,$rs$$)});$id_invest_noti_sender$jscomp$1_token$$={title:"Tin b\u00e1n h\u1ebft h\u1ea1n",receiver:$receiver$$,body:$memo$$||`Tin b\u00e1n s\u1ed1 ${$id_sell$$} \u0111\u00e3 h\u1ebft h\u1ea1n. Token \u0111\u00e3 \u0111\u01b0\u1ee3c chuy\u1ec3n l\u1ea1i v\u00e0o v\u00ed c\u1ee7a b\u1ea1n`,data:{key:"sell-expired:"+$id_sell$$+$timestamp$$,id_sell:$id_sell$$}}}break;case "need-to-buy-expired":if($receiver$$===$creator$$){let $id_need_to_buy$$=
|
|
37
|
+
Number($events$$["at.idNeedToBuy"][$id$jscomp$2_index$jscomp$17_title_token$$]);global.getModel("assneedtobuy").updateOne({id:$id_need_to_buy$$},{trang_thai:"9"}).then($rs$$=>{console.log("updated expired need to buy",$id_need_to_buy$$,$rs$$)});$id_invest_noti_sender$jscomp$1_token$$={title:"Tin mua h\u1ebft h\u1ea1n",receiver:$receiver$$,body:$memo$$||`Tin mua s\u1ed1 ${$events$$["at.idNeedToBuy"][$id$jscomp$2_index$jscomp$17_title_token$$]} \u0111\u00e3 h\u1ebft h\u1ea1n. Ti\u1ec1n c\u1ecdc \u0111\u00e3 \u0111\u01b0\u1ee3c chuy\u1ec3n l\u1ea1i v\u00e0o v\u00ed c\u1ee7a b\u1ea1n`,
|
|
38
|
+
data:{key:"need-to-buy-expired:"+$events$$["at.idNeedToBuy"][$id$jscomp$2_index$jscomp$17_title_token$$]+$timestamp$$,id_need_to_buy:$events$$["at.idNeedToBuy"][$id$jscomp$2_index$jscomp$17_title_token$$]}}}break;case "invest-interest":$receiver$$===$owner$$&&($id_invest_noti_sender$jscomp$1_token$$=Number($events$$["at.idInvestment"][$id$jscomp$2_index$jscomp$17_title_token$$]),$_u_action$$=Number($events$$["at.kyTraLai"][$id$jscomp$2_index$jscomp$17_title_token$$]),$id$jscomp$2_index$jscomp$17_title_token$$=
|
|
39
|
+
$events$$["at.token"][$id$jscomp$2_index$jscomp$17_title_token$$],$id_invest_noti_sender$jscomp$1_token$$={title:"L\u00e3i \u0111\u1ecbnh k\u1ef3",receiver:$receiver$$,body:$memo$$||`Nh\u1eadn l\u00e3i t\u1eeb kho\u1ea3n \u0111\u1ea7u t\u01b0 ${$id$jscomp$2_index$jscomp$17_title_token$$}`,data:{key:"invest-interest:"+$id_invest_noti_sender$jscomp$1_token$$+"-"+$_u_action$$+$timestamp$$,id_invest:$id_invest_noti_sender$jscomp$1_token$$,ky_tra_lai:$_u_action$$,token:$id$jscomp$2_index$jscomp$17_title_token$$}});
|
|
40
|
+
break;case "profit-sharing":$receiver$$===$owner$$&&($id_invest_noti_sender$jscomp$1_token$$=$events$$["at.token"][$id$jscomp$2_index$jscomp$17_title_token$$],$id_invest_noti_sender$jscomp$1_token$$={title:"L\u1ee3i nhu\u1eadn \u0111\u01b0\u1ee3c chia",receiver:$receiver$$,body:$memo$$||`B\u1ea1n \u0111\u01b0\u1ee3c chia l\u1ee3i nhu\u1eadn t\u1eeb kho\u1ea3n \u0111\u1ea7u t\u01b0 ${$id_invest_noti_sender$jscomp$1_token$$}`,data:{key:"profit-sharing"+$timestamp$$,id_profit_sharing:$events$$["at.idProfitSharing"][$id$jscomp$2_index$jscomp$17_title_token$$],
|
|
41
|
+
id_product:$events$$["at.idProduct"][$id$jscomp$2_index$jscomp$17_title_token$$],amount:$events$$["at.amount"][$id$jscomp$2_index$jscomp$17_title_token$$],denom:$events$$["at.denom"][$id$jscomp$2_index$jscomp$17_title_token$$],token:$id_invest_noti_sender$jscomp$1_token$$}});break;case "profit-sharing-error":$receiver$$===$owner$$&&($id_invest_noti_sender$jscomp$1_token$$={title:"Kh\u00f4ng th\u1ec3 chia l\u1ee3i nhu\u1eadn",receiver:$receiver$$,body:$memo$$,data:{key:"profit-sharing-error"+$timestamp$$,
|
|
42
|
+
id_profit_sharing:$events$$["at.idProfitSharing"][$id$jscomp$2_index$jscomp$17_title_token$$],id_product:$events$$["at.idProduct"][$id$jscomp$2_index$jscomp$17_title_token$$],amount:$events$$["at.amount"][$id$jscomp$2_index$jscomp$17_title_token$$],denom:$events$$["at.denom"][$id$jscomp$2_index$jscomp$17_title_token$$],token:$events$$["at.token"][$id$jscomp$2_index$jscomp$17_title_token$$]}});break;case "invest-expired":if($receiver$$===$owner$$){let $id_invest$$=Number($events$$["at.idInvestment"][$id$jscomp$2_index$jscomp$17_title_token$$]),
|
|
43
|
+
$token$$=$events$$["at.token"][$id$jscomp$2_index$jscomp$17_title_token$$];global.getModel("assinvestment").updateOne({id:$id_invest$$},{trang_thai:"5"}).then($rs$$=>{console.log("updated expired assinvestment",$id_invest$$,$rs$$)});$token$$&&global.getModel("asssell").updateOne({token:$token$$},{trang_thai:"5"}).then($rs$$=>{console.log("updated expired asssell for token",$token$$,$rs$$)});$id_invest_noti_sender$jscomp$1_token$$={title:"Kho\u1ea3n \u0111\u1ea7u t\u01b0 \u0111\u00e1o h\u1ea1n",receiver:$receiver$$,
|
|
44
|
+
body:$memo$$||`Kho\u1ea3n \u0111\u1ea7u t\u01b0 ${$token$$} \u0111\u00e3 \u0111\u00e1o h\u1ea1n. Ti\u1ec1n g\u1ed1c v\u00e0 l\u00e3i \u0111\u00e3 \u0111\u01b0\u1ee3c chuy\u1ec3n v\u00e0o v\u00ed c\u1ee7a b\u1ea1n`,data:{key:"invest-expired:"+$id_invest$$+$timestamp$$,id_invest:$id_invest$$,token:$token$$}}}break;case "exchange":$id_invest_noti_sender$jscomp$1_token$$={title:"Giao d\u1ecbch c\u1ee7a b\u1ea1n \u0111\u00e3 kh\u1edbp l\u1ec7nh",receiver:$receiver$$,body:$memo$$||`\u0110\u00e3 kh\u1edbp l\u1ec7nh giao d\u1ecbch gi\u1eefa tin mua s\u1ed1 ${$events$$["at.idNeedToBuy"][$id$jscomp$2_index$jscomp$17_title_token$$]} v\u00e0 tin b\u00e1n s\u1ed1 ${$events$$["at.idSell"][$id$jscomp$2_index$jscomp$17_title_token$$]}. V\u00ed c\u1ee7a b\u1ea1n \u0111\u00e3 \u0111\u01b0\u1ee3c c\u1eadp nh\u1eadt s\u1ed1 d\u01b0`,
|
|
45
|
+
data:{key:`exchange:${$events$$["at.idSell"][$id$jscomp$2_index$jscomp$17_title_token$$]}-${$events$$["at.idNeedToBuy"][$id$jscomp$2_index$jscomp$17_title_token$$]}`+$timestamp$$,id_sell:$events$$["at.idSell"][$id$jscomp$2_index$jscomp$17_title_token$$],id_need_to_buy:$events$$["at.idNeedToBuy"][$id$jscomp$2_index$jscomp$17_title_token$$]}};break;default:console.log("don't implement action",$_u_action$$)}$id_invest_noti_sender$jscomp$1_token$$&&($id_invest_noti_sender$jscomp$1_token$$.user=$u$$.user_created,
|
|
46
|
+
$id_invest_noti_sender$jscomp$1_token$$.data.key=$id_invest_noti_sender$jscomp$1_token$$.user+$id_invest_noti_sender$jscomp$1_token$$.data.key,notificationPool[$id_invest_noti_sender$jscomp$1_token$$.data.key]=$id_invest_noti_sender$jscomp$1_token$$)})})},WS=require("ws");let notiInterval,connectSocket=!1;
|
|
48
47
|
const setupSocket=()=>{if(!connectSocket){var $ws$$=new WS(configs.BLOCKCHAIN_SOCKET);$ws$$.on("error",$e$$=>{connectSocket=!1;console.error("Can't connect to blockchain socket server",$e$$.message);notiInterval&&(clearInterval(notiInterval),notiInterval=null)});$ws$$.on("close",()=>{connectSocket=!1;notiInterval&&(clearInterval(notiInterval),notiInterval=null);setTimeout(()=>{setupSocket()},5E3)});$ws$$.on("open",()=>{console.log("connected to blockchain socket");connectSocket=!0;$ws$$.send(JSON.stringify({jsonrpc:"2.0",
|
|
49
48
|
method:"subscribe",id:"0",params:{query:"tm.event = 'Tx'"}}));$ws$$.send(JSON.stringify({jsonrpc:"2.0",method:"subscribe",id:"1",params:{query:"at.event = 'auto'"}}));notiInterval=setInterval(()=>{const $values$$=Object.values(notificationPool);notificationPool={};0<$values$$.length&&console.log("create notifications",$values$$);$values$$.forEach($noti$$=>{User.emitEvent($noti$$.user,"blockchain.wallet.changed",{receiver:$noti$$.receiver,data:$noti$$.data});global.createNotification("SYSTEM",$noti$$.user,
|
|
50
49
|
$noti$$.title,$noti$$.body,$e$$=>{$e$$&&console.error($e$$.message)},$noti$$.data,!0)})},3E3)});$ws$$.on("message",async $data$jscomp$8_msg$$=>{($data$jscomp$8_msg$$=JSON.parse($data$jscomp$8_msg$$))&&$data$jscomp$8_msg$$.result&&$data$jscomp$8_msg$$.result.events&&($data$jscomp$8_msg$$.result.events["at.event"]&&$data$jscomp$8_msg$$.result.events["at.action"]&&processEventAt($data$jscomp$8_msg$$.result.events,$data$jscomp$8_msg$$),$data$jscomp$8_msg$$.result.events["tx.hash"]&&0<$data$jscomp$8_msg$$.result.events["tx.hash"].length&&
|
package/server/libs/post-book.js
CHANGED
|
@@ -9,5 +9,6 @@ utils.round(($detail$$.sl_nhap||0)*$detail$$.tu/$detail$$.mau,round)):($detail$$
|
|
|
9
9
|
fields:["tu","mau",{he_so_qd:"ty_le_qd"}]}),$details$$.forEach($detail$$=>{$detail$$.he_so_qd=$detail$$.he_so_qd||1;$detail$$.mau&&$detail$$.tu?($detail$$.he_so_qd=$detail$$.tu/$detail$$.mau,$detail$$.sl_xuat_qd=utils.round(($detail$$.sl_xuat||0)*$detail$$.tu/$detail$$.mau,round),$detail$$.sl_nhap_qd=utils.round(($detail$$.sl_nhap||0)*$detail$$.tu/$detail$$.mau,round)):($detail$$.sl_xuat_qd=utils.round(($detail$$.sl_xuat||0)*$detail$$.he_so_qd,round),$detail$$.sl_nhap_qd=utils.round(($detail$$.sl_nhap||
|
|
10
10
|
0)*$detail$$.he_so_qd,round))}));if("vatra"===$model_book$$.modelName.toLowerCase()||"vatvao"===$model_book$$.modelName.toLowerCase()){let $rs$$=await Promise.all($details$$.filter($r$$=>$r$$.so_hd&&$r$$.so_hd.toUpperCase()!==($master$$.ma_ct||"").toUpperCase()).map($detail$$=>(async()=>{let $v$$=await $model_book$$.findOne({id_app:$master$$.id_app,so_hd:$detail$$.so_hd,so_seri:$detail$$.so_seri,ky_hieu_hoa_don:$detail$$.ky_hieu_hoa_don,id_ct:{$ne:$master$$._id.toString()}});return $v$$?$v$$.so_hd:
|
|
11
11
|
""})()));$rs$$=$rs$$.filter($r$$=>$r$$);if(0<$rs$$.length)return $callback$$(`S\u1ed1 ho\u00e1 \u0111\u01a1n ${$rs$$.join(",")} \u0111\u00e3 t\u1ed3n t\u1ea1i`)}$details$$=$details$$.map(($detail$$,$line$$)=>{$detail$$.id_ct=$master$$._id.toString();for(let $attr$$ in $model_book$$.schema.paths)if("id_ct"!=$attr$$&&"_id"!=$attr$$){let $v$$=$detail$$[$attr$$];void 0!=$v$$&&null!=$v$$&&""!=$v$$||void 0==$master$$[$attr$$]||($detail$$[$attr$$]=$master$$[$attr$$])}$detail$$.line=$line$$;delete $detail$$.toObject;
|
|
12
|
-
delete $detail$$._id;delete $detail$$.__v;return $detail$$});const $self$$=this;$self$$.remove($error$$=>{if($error$$)return console.error("error delete data post",$error$$),$callback$$($error$$);$model_book$$.create($details$$,async($e$jscomp$0$$,$rs$$)=>{if($e$jscomp$0$$)
|
|
13
|
-
$master$$._id)
|
|
12
|
+
delete $detail$$._id;delete $detail$$.__v;return $detail$$});const $self$$=this;$self$$.remove($error$$=>{if($error$$)return console.error("error delete data post",$error$$),$callback$$($error$$);if(0==$details$$.length)return $callback$$(null,[]);$model_book$$.create($details$$,async($e$jscomp$0$$,$rs$$)=>{if($e$jscomp$0$$){var $contr_msg_error$$=$e$jscomp$0$$.message||$e$jscomp$0$$.error||$e$jscomp$0$$.toString();0<=$contr_msg_error$$.indexOf("E11000 duplicate")&&0<=$contr_msg_error$$.indexOf("id_ct_1_line_1")?
|
|
13
|
+
($rs$$=await $model_book$$.find({id_ct:$master$$._id.toString()}),0<$rs$$.length?$callback$$(null,$rs$$):(console.error("error save data post",$e$jscomp$0$$,$details$$),$self$$.remove(()=>{$callback$$($e$jscomp$0$$)}))):(console.error("error save data post",$e$jscomp$0$$,$details$$),$self$$.remove(()=>{$callback$$($e$jscomp$0$$)}))}else{if($master$$.ma_ct)if($contr_msg_error$$=global.controllers[$master$$.ma_ct.toUpperCase()]){if(!await $contr_msg_error$$.model.findById($master$$._id)){console.error("Ch\u1ee9ng t\u1eeb kh\u00f4ng t\u1ed3n t\u1ea1i. X\u00f3a s\u1ed5 s\u00e1ch",
|
|
14
|
+
$master$$._id);$self$$.remove(()=>{$callback$$("Ch\u1ee9ng t\u1eeb kh\u00f4ng t\u1ed3n t\u1ea1i")});return}}else console.log("not found controller",$master$$.ma_ct.toUpperCase());$callback$$(null,$rs$$);$rs$$&&"sokho"===$model_book$$.modelName.toLowerCase()&&setImmediate(()=>{tontucthoi.tinhTonTucThoi($rs$$,$e$$=>{$e$$&&console.error("L\u1ed7i t\u00ednh t\u1ed3n t\u1ee9c th\u1eddi v\u1eadt t\u01b0",$rs$$,$e$$)})})}})})};module.exports=post;
|
|
@@ -9,6 +9,7 @@ $resolve$$($details$jscomp$0$$)})};
|
|
|
9
9
|
post.prototype.run=async function($callback$jscomp$0$$=()=>{}){if(!this.details)return $callback$jscomp$0$$(null,null);const $Socai$$=this.model||SocaiModel;let $master$$=this.master,$details$jscomp$0$$=await this.runPrepare(this.prepare,this.details);$details$jscomp$0$$=$details$jscomp$0$$.filter($d$$=>$d$$.tk_no&&$d$$.tk_co);if(!$master$$.ngay_ct)return $callback$jscomp$0$$("ngay_ct is not null");async.map($details$jscomp$0$$,($detail$jscomp$0$$,$callback$$)=>{setImmediate(()=>{$detail$jscomp$0$$.ma_kh_no||
|
|
10
10
|
($detail$jscomp$0$$.ma_kh_no=$detail$jscomp$0$$.ma_kh||$master$$.ma_kh);$detail$jscomp$0$$.ma_kh_co||($detail$jscomp$0$$.ma_kh_co=$detail$jscomp$0$$.ma_kh||$master$$.ma_kh);checkData($master$$.id_app,$master$$.ngay_ct,$detail$jscomp$0$$,($e$$,$detail$$)=>{$callback$$($e$$,$detail$$)})})},($but_toan_loi_e$$,$details$$)=>{if($but_toan_loi_e$$)return $callback$jscomp$0$$($but_toan_loi_e$$);$but_toan_loi_e$$=$details$$.filter($detail$$=>isNaN($detail$$.tien_nt)||isNaN($detail$$.tien));0<$but_toan_loi_e$$.length&&
|
|
11
11
|
console.error("Cac but toan khong hop ly",$but_toan_loi_e$$,"cua chung tu",$master$$._id);let $dks$$=$details$$.filter($detail$$=>!(0===$detail$$.tien_nt&&0===$detail$$.tien)&&!isNaN($detail$$.tien_nt)&&!isNaN($detail$$.tien)).map(($detail$$,$nh_dk$$)=>{for(let $attr$$ in $Socai$$.schema.paths)"id_ct"!=$attr$$&&"_id"!=$attr$$&&(void 0!=$detail$$[$attr$$]&&null!=$detail$$[$attr$$]&&""!=$detail$$[$attr$$]||void 0==$master$$[$attr$$]||($detail$$[$attr$$]=$master$$[$attr$$]));$detail$$.nh_dk=$nh_dk$$;
|
|
12
|
-
$detail$$.id_ct=$master$$._id.toString();delete $detail$$.toObject;delete $detail$$._id;delete $detail$$.__v;return $detail$$});$Socai$$.deleteMany({id_ct:$master$$._id.toString()},$error$$=>{if($error$$)return $callback$jscomp$0$$("Don't remove socai \n"+$error$$);$Socai$$.create($dks$$,async($e$$,$
|
|
13
|
-
$master$$._id.toString(),
|
|
14
|
-
$master$$.
|
|
12
|
+
$detail$$.id_ct=$master$$._id.toString();delete $detail$$.toObject;delete $detail$$._id;delete $detail$$.__v;return $detail$$});$Socai$$.deleteMany({id_ct:$master$$._id.toString()},$error$$=>{if($error$$)return $callback$jscomp$0$$("Don't remove socai \n"+$error$$);if(0==$dks$$.length)return $callback$jscomp$0$$(null,[]);$Socai$$.create($dks$$,async($e$$,$msg_error_rs$$)=>{if($e$$)if($msg_error_rs$$=$e$$.message||$e$$.error||$e$$.toString(),0<=$msg_error_rs$$.indexOf("E11000 duplicate")&&0<=$msg_error_rs$$.indexOf("id_ct_1_nh_dk_1"))if($msg_error_rs$$=
|
|
13
|
+
await $Socai$$.find({id_ct:$master$$._id.toString()}),0<$msg_error_rs$$.length)$callback$jscomp$0$$(null,$msg_error_rs$$);else{console.error("Error save socai",$e$$,$master$$);let $q_remove$$={id_app:$master$$.id_app,id_ct:$master$$._id.toString()};$Socai$$.deleteMany($q_remove$$,($_e$$,$rs$$)=>{console.error("delete socai because error when posting",$master$$._id.toString(),JSON.stringify($rs$$),$q_remove$$);$callback$jscomp$0$$($e$$)})}else{console.error("Error save socai",$e$$,$master$$);let $q_remove$$=
|
|
14
|
+
{id_app:$master$$.id_app,id_ct:$master$$._id.toString()};$Socai$$.deleteMany($q_remove$$,($_e$$,$rs$$)=>{console.error("delete socai because error when posting",$master$$._id.toString(),JSON.stringify($rs$$),$q_remove$$);$callback$jscomp$0$$($e$$)})}else if($master$$.ma_ct){let $contr$$=global.controllers[$master$$.ma_ct.toUpperCase()];$contr$$?await $contr$$.model.findById($master$$._id)?$callback$jscomp$0$$(null,$msg_error_rs$$):$Socai$$.deleteMany({id_ct:$master$$._id.toString()},($_e$$,$rs$$)=>
|
|
15
|
+
{console.error("Ch\u1ee9ng t\u1eeb kh\u00f4ng t\u1ed3n t\u1ea1i. X\u00f3a socai",$master$$._id,$rs$$);$callback$jscomp$0$$($e$$)}):(console.log("not found controller",$master$$.ma_ct.toUpperCase()),$callback$jscomp$0$$(null,$msg_error_rs$$))}else $callback$jscomp$0$$(null,$msg_error_rs$$)})})})};module.exports=post;
|
package/server/libs/tinhgiatb.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
module.exports=function($condition$$,$fn$$){if($condition$$&&$condition$$.tu_thang&&$condition$$.den_thang&&$condition$$.nam&&$condition$$.id_app){$condition$$.tu_thang=Number($condition$$.tu_thang);$condition$$.den_thang=Number($condition$$.den_thang);var $ma_kho$$=$condition$$.ma_kho,$tu_ngay$$=moment(new Date($condition$$.nam,$condition$$.tu_thang-1,15)).startOf("month").toDate(),$den_ngay$$=moment(new Date($condition$$.nam,$condition$$.den_thang-1,15)).endOf("month").toDate(),$id_app$$=$condition$$.id_app,
|
|
3
3
|
$query_dmvt$$={id_app:$id_app$$,gia_xuat:"1"};$condition$$.ma_nvt&&($query_dmvt$$.ma_nvt=$condition$$.ma_nvt);$condition$$.ma_ncc&&($query_dmvt$$.ma_ncc=$condition$$.ma_ncc);$condition$$.ma_vt&&($query_dmvt$$.ma_vt=$condition$$.ma_vt);dmvt.find($query_dmvt$$).lean().exec(function($error$jscomp$3$$,$dmvts$$){async.map($dmvts$$,function($vt$$,$callback$$){setImmediate(()=>{tinhgiatb1vt({id_app:$id_app$$,tu_ngay:$tu_ngay$$,den_ngay:$den_ngay$$,ma_vt:$vt$$.ma_vt,ma_kho:$ma_kho$$},function($error$$,$gia$$){if($error$$)return $callback$$($error$$);
|
|
4
4
|
$gia$$.id_app=$id_app$$;$gia$$.ma_kho=$ma_kho$$;$gia$$.status=!0;$callback$$(null,$gia$$)})})},function($error$jscomp$2$$,$bang_gia$$){if($error$jscomp$2$$)return $fn$$($error$jscomp$2$$);$bang_gia$$=underscore.filter($bang_gia$$,function($r$$){return 0!==$r$$.gia||0!==$r$$.tong_sl||0!==$r$$.tong_tien});$error$jscomp$2$$=[];for(let $t$$=$condition$$.tu_thang;$t$$<=$condition$$.den_thang;$t$$++)$error$jscomp$2$$.push($t$$);async.map($error$jscomp$2$$,function($t$$,$callback$jscomp$1$$){async.map($bang_gia$$,
|
|
5
|
-
function($gia$$,$callback$jscomp$0$$){setImmediate(()=>{$gia$$.thang=$t$$;$gia$$.nam=$condition$$.nam;async.parallel({savetogiatb:function($callback$$){let $query_delete$$={id_app:$id_app$$,ma_vt:$gia$$.ma_vt};$ma_kho$$&&($query_delete$$.ma_kho=$ma_kho$$);giatb.
|
|
5
|
+
function($gia$$,$callback$jscomp$0$$){setImmediate(()=>{$gia$$.thang=$t$$;$gia$$.nam=$condition$$.nam;async.parallel({savetogiatb:function($callback$$){let $query_delete$$={id_app:$id_app$$,ma_vt:$gia$$.ma_vt};$ma_kho$$&&($query_delete$$.ma_kho=$ma_kho$$);giatb.deleteMany($query_delete$$,function($error$jscomp$0$$){if($error$jscomp$0$$)return $callback$$($error$jscomp$0$$);giatb.create($gia$$,function($error$$,$result$$){if($error$$)return console.log("Loi khi luu vao bang gia trung binh thang vat tu "+
|
|
6
6
|
$gia$$.ma_vt,$error$$),$callback$$($error$$);$callback$$(null,$result$$)})})}},function($error$$){if($error$$)return $callback$jscomp$0$$($error$$);$callback$jscomp$0$$(null)})})},function($error$$){if($error$$)return $callback$jscomp$1$$($error$$);$callback$jscomp$1$$(null)})},function($error$jscomp$1$$){if($error$jscomp$1$$)return $fn$$($error$jscomp$1$$);let $vouchers_x$$={},$vouchers_n$$={},$ma_vts$$=underscore.pluck($bang_gia$$,"ma_vt");async.parallel({xuat:function($callback$jscomp$0$$){setImmediate(()=>
|
|
7
7
|
{let $query_sokho_x$$={id_app:$id_app$$,ngay_ct:{$gte:$tu_ngay$$,$lte:$den_ngay$$},nxt:2,ma_vt:{$in:$ma_vts$$},px_gia_dd:!1};$ma_kho$$&&($query_sokho_x$$.ma_kho=$ma_kho$$);sokho.find($query_sokho_x$$).lean().exec(function($error$jscomp$0$$,$sks$$){if($error$jscomp$0$$)return $callback$jscomp$0$$($error$jscomp$0$$);if(!$sks$$||0===$sks$$.length)return $callback$jscomp$0$$(null,$vouchers_x$$);async.map($sks$$,function($sk$$,$callback$$){let $voucher$$=$vouchers_x$$[$sk$$.id_ct],$ct$$=mongoose.models[$sk$$.ma_ct.toLowerCase()];
|
|
8
|
-
!$voucher$$&&$ct$$?$ct$$.
|
|
8
|
+
!$voucher$$&&$ct$$?$ct$$.findById($sk$$.id_ct,function($error$$,$v$$){if($error$$)return $callback$$($error$$);$v$$?($voucher$$=$v$$,$vouchers_x$$[$sk$$.id_ct]=$voucher$$):(sokho.deleteMany({id_ct:$sk$$.id_ct.toString()},($e$$,$rs$$)=>{console.log("Khong tim thay phieu xuat. chuong trinh da xoa phieu nay khoi sokho",$sk$$.id_ct,"ma_ct",$sk$$.ma_ct,$sk$$.so_ct,$sk$$.ngay_ct,$rs$$)}),socai.deleteMany({id_ct:$sk$$.id_ct.toString()},($e$$,$rs$$)=>{console.log("Khong tim thay phieu xuat. chuong trinh da xoa phieu nay khoi socai",
|
|
9
9
|
$sk$$.id_ct,"ma_ct",$sk$$.ma_ct,$sk$$.so_ct,$sk$$.ngay_ct,$rs$$)}));$callback$$()}):$callback$$()},function($error$$){if($error$$)return console.log("co loi lay phieu xuat",$error$$),$callback$jscomp$0$$($error$$);$callback$jscomp$0$$(null,$vouchers_x$$)})})})},nhap:function($callback$jscomp$0$$){setImmediate(()=>{let $query_sokho_n$$={id_app:$id_app$$,ngay_ct:{$gte:$tu_ngay$$,$lte:$den_ngay$$},nxt:1,ma_vt:{$in:$ma_vts$$},pn_gia_tb:!0,ma_ct:{$ne:"PXC"}};$ma_kho$$&&($query_sokho_n$$.ma_kho=$ma_kho$$);
|
|
10
|
-
sokho.find($query_sokho_n$$,function($error$jscomp$0$$,$sks$$){if($error$jscomp$0$$)return $callback$jscomp$0$$($error$jscomp$0$$);if(!$sks$$||0===$sks$$.length)return $callback$jscomp$0$$(null,$vouchers_n$$);async.map($sks$$,function($sk$$,$callback$$){let $voucher$$=$vouchers_n$$[$sk$$.id_ct],$ct$$=mongoose.models[$sk$$.ma_ct.toLowerCase()];!$voucher$$&&$ct$$?$ct$$.
|
|
11
|
-
$voucher$$):(sokho.
|
|
10
|
+
sokho.find($query_sokho_n$$,function($error$jscomp$0$$,$sks$$){if($error$jscomp$0$$)return $callback$jscomp$0$$($error$jscomp$0$$);if(!$sks$$||0===$sks$$.length)return $callback$jscomp$0$$(null,$vouchers_n$$);async.map($sks$$,function($sk$$,$callback$$){let $voucher$$=$vouchers_n$$[$sk$$.id_ct],$ct$$=mongoose.models[$sk$$.ma_ct.toLowerCase()];!$voucher$$&&$ct$$?$ct$$.findById($sk$$.id_ct,function($error$$,$v$$){if($error$$)return $callback$$($error$$);$v$$?($voucher$$=$v$$,$vouchers_n$$[$sk$$.id_ct]=
|
|
11
|
+
$voucher$$):(sokho.deleteMany({id_ct:$sk$$.id_ct.toString()},($e$$,$rs$$)=>{console.log("Khong tim thay phieu nhap. chuong trinh da xoa phieu nay khoi sokho",$sk$$.id_ct,"ma_ct",$sk$$.ma_ct,$sk$$.so_ct,$sk$$.ngay_ct,$rs$$)}),socai.deleteMany({id_ct:$sk$$.id_ct.toString()},($e$$,$rs$$)=>{console.log("Khong tim thay phieu nhap. chuong trinh da xoa phieu nay khoi socai",$sk$$.id_ct,"ma_ct",$sk$$.ma_ct,$sk$$.so_ct,$sk$$.ngay_ct,$rs$$)}));$callback$$()}):$callback$$()},function($error$$){if($error$$)return console.log("co loi lay phieu nhap",
|
|
12
12
|
$error$$),$callback$jscomp$0$$($error$$);$callback$jscomp$0$$(null,$vouchers_n$$)})})})}},function($error$jscomp$0$$){if($error$jscomp$0$$)return $fn$$($error$jscomp$0$$);async.waterfall([function($callback$jscomp$0$$){async.map(underscore.values($vouchers_x$$),($voucher_x$$,$callback$$)=>{setImmediate(()=>{(async()=>{var $details_details_doi_details_kmc$$=$voucher_x$$.details.filter($d$$=>(!$condition$$.ma_vt||$condition$$.ma_vt===$d$$.ma_vt)&&!$d$$.px_gia_dd&&(!$ma_kho$$||$ma_kho$$===($d$$.ma_kho||
|
|
13
13
|
$voucher_x$$.ma_kho||$voucher_x$$.ma_kho_x)));await Promise.all($details_details_doi_details_kmc$$.map($d$$=>(async()=>{var $gia$$=underscore.find($bang_gia$$,$vt$$=>$d$$.ma_vt===$vt$$.ma_vt);$gia$$=$gia$$?$gia$$.gia:0;let $he_so_qd$$=1,$qd$$=await dmqddvt.findOne({id_app:$voucher_x$$.id_app,ma_vt:$d$$.ma_vt,ma_dvt:$d$$.ma_dvt}).lean();$qd$$&&($he_so_qd$$=$qd$$.mau?$qd$$.tu/$qd$$.mau:$qd$$.ty_le_qd);$d$$.gia_von=$d$$.gia_von_nt=$gia$$*$he_so_qd$$;$d$$.tien_xuat=$d$$.tien_xuat_nt=Math.round($d$$.sl_xuat*
|
|
14
14
|
$d$$.gia_von,0);console.log("update gia trung binh xuat hang",{ma_ct:$voucher_x$$.ma_ct,so_ct:$voucher_x$$.so_ct,ma_vt:$d$$.ma_vt,gia_von:$d$$.gia_von,gia_tb:$gia$$,he_so_qd:$he_so_qd$$})})()));$voucher_x$$.details_doi&&($details_details_doi_details_kmc$$=$voucher_x$$.details_doi.filter($d$$=>(!$condition$$.ma_vt||$condition$$.ma_vt===$d$$.ma_vt)&&!$d$$.px_gia_dd&&(!$ma_kho$$||$ma_kho$$===($d$$.ma_kho||$voucher_x$$.ma_kho||$voucher_x$$.ma_kho_x))),await Promise.all($details_details_doi_details_kmc$$.map($d$$=>
|
|
@@ -20,15 +20,14 @@ $d$$.tien_xuat=$d$$.tien_xuat_nt=Math.round(($d$$.sl_xuat||$d$$.sl_km||0)*$d$$.g
|
|
|
20
20
|
$d$$.gia_von_nt=$gia$jscomp$5_gia_chuan$$*$he_so_qd$$;$d$$.tien_xuat=$d$$.tien_xuat_nt=Math.round(($d$$.sl_xuat||0)*$d$$.gia_von,0);console.log("update gia trung binh khuyen mai",{ma_ct:$voucher_x$$.ma_ct,so_ct:$voucher_x$$.so_ct,ma_vt:$d$$.ma_vt,gia_von:$d$$.gia_von,gia_tb:$gia$jscomp$5_gia_chuan$$,he_so_qd:$he_so_qd$$})})()))})());$voucher_x$$.promotion&&($details_details_doi_details_kmc$$=$voucher_x$$.promotion.filter($d$$=>(!$condition$$.ma_vt||$condition$$.ma_vt===$d$$.ma_vt)&&!$d$$.px_gia_dd&&
|
|
21
21
|
(!$ma_kho$$||$ma_kho$$===($d$$.ma_kho||$voucher_x$$.ma_kho||$voucher_x$$.ma_kho_x))),await Promise.all($details_details_doi_details_kmc$$.map($d$$=>(async()=>{var $gia$jscomp$6_gia_chuan$$=underscore.find($bang_gia$$,$vt$$=>$d$$.ma_vt===$vt$$.ma_vt);$gia$jscomp$6_gia_chuan$$=$gia$jscomp$6_gia_chuan$$?$gia$jscomp$6_gia_chuan$$.gia:0;let $he_so_qd$$=1,$qd$$=await dmqddvt.findOne({id_app:$voucher_x$$.id_app,ma_vt:$d$$.ma_vt,ma_dvt:$d$$.ma_dvt}).lean();$qd$$&&($he_so_qd$$=$qd$$.mau?$qd$$.tu/$qd$$.mau:
|
|
22
22
|
$qd$$.ty_le_qd);$d$$.gia_von_nt=$gia$jscomp$6_gia_chuan$$*$he_so_qd$$;$d$$.gia_von=$d$$.gia_von_nt;$d$$.tien_xuat_nt=Math.round(($d$$.sl_xuat||$d$$.sl_km||0)*$d$$.gia_von,0);$d$$.tien_xuat=$d$$.tien_xuat_nt;console.log("update gia trung binh khuyen mai chung",{ma_ct:$voucher_x$$.ma_ct,so_ct:$voucher_x$$.so_ct,ma_vt:$d$$.ma_vt,gia_von:$d$$.gia_von,gia_tb:$gia$jscomp$6_gia_chuan$$,he_so_qd:$he_so_qd$$})})())));await $voucher_x$$.save();let $voucher_x_data$$=$voucher_x$$.toObject(),$ctrl$$=global.controllers[$voucher_x_data$$.ma_ct.toUpperCase()];
|
|
23
|
-
$ctrl$$&&$ctrl$$.post&&await (async()=>new Promise(($resolve$$,$reject$$)=>{Controller.postData($voucher_x_data$$,$ctrl$$,($e$$,$rs$$)=>{
|
|
24
|
-
(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
[{where:"ma_vt",fields:"ten_vt"}],()=>{$fn$$(null,$bang_gia$$)})})})})})})})})})}else $fn$$("L\u1ed7i: T\u00ednh n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: tu_thang,den_thang,nam,id_app")};
|
|
23
|
+
$ctrl$$&&$ctrl$$.post&&await (async()=>new Promise(($resolve$$,$reject$$)=>{Controller.postData($voucher_x_data$$,$ctrl$$,($e$$,$rs$$)=>{if($e$$)return $reject$$($e$$);$resolve$$($rs$$)})}))()})().then($rs$$=>{$callback$$(null,$rs$$)}).catch($e$$=>{$callback$$($e$$)})})},$error$$=>{$callback$jscomp$0$$($error$$,$vouchers_x$$)})},function($_vouchers_x$$,$callback$jscomp$0$$){async.map(underscore.values($vouchers_n$$),($voucher_n$$,$callback$$)=>{setImmediate(()=>{(async()=>{var $details_doi$$=$voucher_n$$.details.filter($d$$=>
|
|
24
|
+
(!$condition$$.ma_vt||$condition$$.ma_vt===$d$$.ma_vt)&&($d$$.pn_gia_tb||"PNC"===$voucher_n$$.ma_ct&&!$d$$.px_gia_dd||"PKK"===$voucher_n$$.ma_ct&&!$d$$.px_gia_dd)&&(!$ma_kho$$||$ma_kho$$===$d$$.ma_kho||$ma_kho$$===$voucher_n$$.ma_kho||$ma_kho$$===$voucher_n$$.ma_kho_n));await Promise.all($details_doi$$.map($d$$=>(async()=>{var $gia$jscomp$7_gia_chuan$$=underscore.find($bang_gia$$,$vt$$=>$d$$.ma_vt===$vt$$.ma_vt);$gia$jscomp$7_gia_chuan$$=$gia$jscomp$7_gia_chuan$$?$gia$jscomp$7_gia_chuan$$.gia:0;let $he_so_qd$$=
|
|
25
|
+
1,$qd$$=await dmqddvt.findOne({id_app:$vouchers_n$$.id_app,ma_vt:$d$$.ma_vt,ma_dvt:$d$$.ma_dvt}).lean();$qd$$&&($he_so_qd$$=$qd$$.mau?$qd$$.tu/$qd$$.mau:$qd$$.ty_le_qd);$d$$.gia_von_nt=$gia$jscomp$7_gia_chuan$$*$he_so_qd$$;$d$$.gia_von=$d$$.gia_von_nt;"PNC"===$voucher_n$$.ma_ct||"PKK"===$voucher_n$$.ma_ct?($d$$.tien_xuat_nt=Math.round($d$$.sl_xuat*$d$$.gia_von,0),$d$$.tien_xuat=$d$$.tien_xuat_nt):($d$$.tien_nhap_nt=Math.round($d$$.sl_nhap*$d$$.gia_von,0),$d$$.tien_nhap=$d$$.tien_nhap_nt);console.log("update gia trung binh cho phieu nhap gia tb",
|
|
26
|
+
{ma_ct:$vouchers_n$$.ma_ct,so_ct:$vouchers_n$$.so_ct,ma_vt:$d$$.ma_vt,gia_von:$d$$.gia_von,gia_tb:$gia$jscomp$7_gia_chuan$$,he_so_qd:$he_so_qd$$})})()));$voucher_n$$.details_doi&&($details_doi$$=$voucher_n$$.details_doi.filter($d$$=>(!$condition$$.ma_vt||$condition$$.ma_vt===$d$$.ma_vt)&&$d$$.pn_gia_tb&&(!$ma_kho$$||$ma_kho$$===$d$$.ma_kho)),await Promise.all($details_doi$$.map($d$$=>(async()=>{var $gia$jscomp$8_gia_chuan$$=underscore.find($bang_gia$$,$vt$$=>$d$$.ma_vt===$vt$$.ma_vt);$gia$jscomp$8_gia_chuan$$=
|
|
27
|
+
$gia$jscomp$8_gia_chuan$$?$gia$jscomp$8_gia_chuan$$.gia:0;let $he_so_qd$$=1,$qd$$=await dmqddvt.findOne({id_app:$vouchers_n$$.id_app,ma_vt:$d$$.ma_vt,ma_dvt:$d$$.ma_dvt}).lean();$qd$$&&($he_so_qd$$=$qd$$.mau?$qd$$.tu/$qd$$.mau:$qd$$.ty_le_qd);$d$$.gia_von_nt=$gia$jscomp$8_gia_chuan$$*$he_so_qd$$;$d$$.gia_von=$d$$.gia_von_nt;$d$$.tien_xuat_nt=Math.round($d$$.sl_xuat*$d$$.gia_von,0);$d$$.tien_xuat=$d$$.tien_xuat_nt;console.log("update gia trung binh cho phieu nhap gia tb doi hang",{ma_ct:$vouchers_n$$.ma_ct,
|
|
28
|
+
so_ct:$vouchers_n$$.so_ct,ma_vt:$d$$.ma_vt,gia_von:$d$$.gia_von,gia_tb:$gia$jscomp$8_gia_chuan$$,he_so_qd:$he_so_qd$$})})())));await $voucher_n$$.save();let $voucher_n_data$$=$voucher_n$$.toObject(),$ctrl$$=global.controllers[$voucher_n_data$$.ma_ct.toUpperCase()];$ctrl$$&&$ctrl$$.post&&await (async()=>new Promise(($resolve$$,$reject$$)=>{Controller.postData($voucher_n_data$$,$ctrl$$,function($e$$,$rs$$){console.log("posted book",{ma_ct:$vouchers_n$$.ma_ct,so_ct:$vouchers_n$$.so_ct},$e$$);if($e$$)return $reject$$($e$$);
|
|
29
|
+
$resolve$$($rs$$)})}))()})().then($rs$$=>{$callback$$(null,$rs$$)}).catch($e$$=>{$callback$$($e$$)})})},function($error$$){$callback$jscomp$0$$($error$$)})}],function($e$jscomp$1$$){if($e$jscomp$1$$)return $fn$$($e$jscomp$1$$);$e$jscomp$1$$={id_app:$condition$$.id_app,ngay:$den_ngay$$,chenh_lech:1};$condition$$.ma_vt&&($e$jscomp$1$$.ma_vt=$condition$$.ma_vt);$condition$$.ma_kho&&($e$jscomp$1$$.ma_kho=$condition$$.ma_kho);ckvt($e$jscomp$1$$,($e$jscomp$0$$,$rs$jscomp$0$$)=>{if($e$jscomp$0$$)return $fn$$($e$jscomp$0$$);
|
|
30
|
+
$rs$jscomp$0$$=underscore.filter($rs$jscomp$0$$,$r$$=>0!==$r$$.du00&&(0==$r$$.ton00||.001>Math.abs($r$$.ton00)));$vouchers_x$$=underscore.sortBy(underscore.values($vouchers_x$$),$v$$=>-(new Date($v$$.ngay_ct)).getTime());$vouchers_n$$=underscore.sortBy(underscore.values($vouchers_n$$),$v$$=>-(new Date($v$$.ngay_ct)).getTime());let $chung_tu_cap_nhat_chenh_lech$$={};async.map($rs$jscomp$0$$,($vt$$,$callback$$)=>{setImmediate(()=>{let $d_voucher$$=null;($d_voucher$$=underscore.find($vouchers_x$$,$x$$=>
|
|
31
|
+
underscore.find($x$$.details,$vc$$=>{if($vc$$.ma_vt!=$vt$$.ma_vt||$vc$$.px_gia_dd||$ma_kho$$&&$ma_kho$$!==$vc$$.ma_kho&&$ma_kho$$!==$x$$.ma_kho)return!1;$vc$$.tien_xuat_nt+=$vt$$.du00;$vc$$.tien_xuat=Math.round($vc$$.tien_xuat_nt,0);return!0})))||($d_voucher$$=underscore.find($vouchers_n$$,$n$$=>underscore.find($n$$.details,$vc$$=>{if($vc$$.ma_vt!=$vt$$.ma_vt||$vc$$.pn_gia_tb||$ma_kho$$&&$ma_kho$$!==$vc$$.ma_kho&&$ma_kho$$!==$n$$.ma_kho)return!1;$vc$$.tien_nhap_nt-=$vt$$.du00;$vc$$.tien_nhap=Math.round($vc$$.tien_nhap_nt,
|
|
32
|
+
0);return!0})));$d_voucher$$&&($chung_tu_cap_nhat_chenh_lech$$[$d_voucher$$._id.toString()]=$d_voucher$$);$callback$$(null,$d_voucher$$)})},$_vouchers_chenh_lech_e$$=>{if($_vouchers_chenh_lech_e$$)return $fn$$($_vouchers_chenh_lech_e$$);$_vouchers_chenh_lech_e$$=underscore.values($chung_tu_cap_nhat_chenh_lech$$);async.map($_vouchers_chenh_lech_e$$,($voucher$$,$callback$$)=>{setImmediate(()=>{$voucher$$.save($error$$=>{if($error$$)return $callback$$($error$$);$error$$=$voucher$$.toObject();let $ctrl$$=
|
|
33
|
+
global.controllers[$error$$.ma_ct.toUpperCase()];$ctrl$$&&$ctrl$$.post?(console.log("repost voucher",$error$$.ma_ct,$error$$.so_ct,"..."),Controller.postData($error$$,$ctrl$$,($e$$,$rs$$)=>{$callback$$($e$$,$rs$$)})):$callback$$(null)})})},$e$$=>{if($e$$)return $fn$$($e$$);$bang_gia$$.joinModel2($id_app$$,dmvt,[{where:"ma_vt",fields:"ten_vt"}],()=>{$fn$$(null,$bang_gia$$)})})})})})})})})})}else $fn$$("L\u1ed7i: T\u00ednh n\u0103ng n\u00e0y y\u00eau c\u1ea7u c\u00e1c tham s\u1ed1: tu_thang,den_thang,nam,id_app")};
|
package/server/models/approve.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';const App=require("./app"),Options=require("./options"),ngcompile=require("ng-node-compile"),email=require("../libs/email"),utils=require("../libs/utils"),File=require("./file"),underscore=require("underscore"),crypto=require("crypto"),validator=require("validator"),User=require("./user"),moment=require("moment"),participant=require("./participant"),approveSchema=new Schema({id_app:{type:String,required:!0,maxlength:1024},id_ct:{type:String,required:!0,maxlength:1024},ma_ct:{type:String,
|
|
2
|
-
required:!0,maxlength:32},trang_thai:{type:String},user_request:{type:String,required:!0,maxlength:128},user_request_name:{type:String,required:!0,maxlength:1024},user_approves:[{email:{type:String,maxlength:128},name:{type:String,maxlength:1024}}],user_approved:{type:String,maxlength:128},user_approved_name:{type:String,maxlength:1024},date_approved:Date,approved_reason:String,user_denied:{type:String,maxlength:128},user_denied_name:{type:String,maxlength:1024},
|
|
3
|
-
maxlength:4E3},update_after_approve:Schema.Types.Mixed,title:{type:String,maxlength:1024},data:Schema.Types.Mixed,template_content:String,status:{type:Boolean,default:!1},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""},visible_to:{type:Number,default:2},visible_to_users:[String]});approveSchema.index({id_ct:1,id_app:1});approveSchema.index({trang_thai:1});
|
|
4
|
-
approveSchema.index({user_denied:1});approveSchema.index({status:1});approveSchema.index({user_request:"text",user_request_name:"text"},{name:"approve_index"});const model=mongoose.models.approve||mongoose.model("approve",approveSchema);let renderRequests=$requests$$=>$requests$$&&0!==$requests$$.length?`
|
|
2
|
+
required:!0,maxlength:32,trim:!0},trang_thai:{type:String},user_request:{type:String,required:!0,maxlength:128,trim:!0},user_request_name:{type:String,required:!0,maxlength:1024},user_approves:[{email:{type:String,maxlength:128,trim:!0},name:{type:String,maxlength:1024}}],user_approved:{type:String,maxlength:128,trim:!0},user_approved_name:{type:String,maxlength:1024},date_approved:Date,approved_reason:String,user_denied:{type:String,maxlength:128,trim:!0},user_denied_name:{type:String,maxlength:1024},
|
|
3
|
+
date_denied:Date,denied_reason:{type:String,maxlength:4E3},update_after_approve:Schema.Types.Mixed,title:{type:String,maxlength:1024},data:Schema.Types.Mixed,template_content:String,status:{type:Boolean,default:!1},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""},visible_to:{type:Number,default:2},visible_to_users:[String]});approveSchema.index({id_ct:1,id_app:1});approveSchema.index({trang_thai:1});
|
|
4
|
+
approveSchema.index({user_approved:1});approveSchema.index({user_denied:1});approveSchema.index({status:1});approveSchema.index({user_request:"text",user_request_name:"text"},{name:"approve_index"});const model=mongoose.models.approve||mongoose.model("approve",approveSchema);let renderRequests=$requests$$=>$requests$$&&0!==$requests$$.length?`
|
|
5
5
|
<p style='margin-top:50px'>
|
|
6
6
|
<hr/>
|
|
7
7
|
<h5>Danh s\u00e1ch \u0111\u00e3 duy\u1ec7t ho\u1eb7c t\u1eeb ch\u1ed1i</h5>
|
package/server/models/area.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';const areaSchema=new Schema({id_app:{type:String,required:!0},area_type:{type:String,uppercase:!0,maxlength:32},area_code:{type:String,required:!0,uppercase:!0,maxlength:32},area_name:{type:String,required:!0,maxlength:1024},stt:{type:Number,default:0},ma_kho:{type:String,maxlength:32},color:{type:String,maxlength:32},picture:{type:String,maxlength:1024},short_description:{type:String,maxlength:1024},description:{type:String},tinh_thanh:{type:String,maxlength:1024},
|
|
2
|
-
maxlength:1024},address:{type:String,required:!0,maxlength:1024},phone:{type:String,maxlength:1024},email:{type:String,maxlength:1024},active:{type:Boolean,default:!0},location:Schema.Types.Mixed,exfields:Schema.Types.Mixed,coWorking:{type:Boolean},coLiving:{type:Boolean},id_company:String,shared:Boolean,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,
|
|
3
|
-
default:0},visible_to_users:[String],dataview_to:{type:Number,default:0},dataview_to_users:[String]});areaSchema.index({id_app:1,area_type:1,area_name:1,area_code:1,address:1});areaSchema.index({area_name:"text",area_code:"text",address:"text"},{name:"area_index"});areaSchema.index({status:1});areaSchema.index({user_created:1,visible_to:1,visible_to_users:1});const model=mongoose.models.area||mongoose.model("area",areaSchema);module.exports=model;
|
|
1
|
+
'use strict';const areaSchema=new Schema({id_app:{type:String,required:!0},area_type:{type:String,uppercase:!0,maxlength:32,trim:!0},area_code:{type:String,required:!0,uppercase:!0,maxlength:32,trim:!0},area_name:{type:String,required:!0,maxlength:1024},stt:{type:Number,default:0},ma_kho:{type:String,maxlength:32,trim:!0},color:{type:String,maxlength:32},picture:{type:String,maxlength:1024},short_description:{type:String,maxlength:1024},description:{type:String},tinh_thanh:{type:String,maxlength:1024},
|
|
2
|
+
quan_huyen:{type:String,maxlength:1024},address:{type:String,required:!0,maxlength:1024},phone:{type:String,maxlength:1024},email:{type:String,maxlength:1024},active:{type:Boolean,default:!0},location:Schema.Types.Mixed,exfields:Schema.Types.Mixed,coWorking:{type:Boolean},coLiving:{type:Boolean},id_company:String,shared:Boolean,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,
|
|
3
|
+
default:""},visible_to:{type:Number,default:0},visible_to_users:[String],dataview_to:{type:Number,default:0},dataview_to_users:[String]});areaSchema.index({id_app:1,area_type:1,area_name:1,area_code:1,address:1});areaSchema.index({area_name:"text",area_code:"text",address:"text"},{name:"area_index"});areaSchema.index({status:1});areaSchema.index({user_created:1,visible_to:1,visible_to_users:1});const model=mongoose.models.area||mongoose.model("area",areaSchema);module.exports=model;
|
package/server/models/assbuy.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';const assbuySchema=new Schema({id_app:String,creator:{type:String,required:!0},id:{type:String},id_sell:{type:String,required:!0},token:{type:String,required:!0,lowercase:!0},nguyen_gia:{type:Number},denom:{type:String,required:!0,lowercase:!0},so_luong_ban:{type:Number},gia_ban:{type:Number},so_luong:{type:Number,required:!0},gia_mua:{type:Number,required:!0},tong_gia_tri:{type:Number},exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,
|
|
2
|
-
date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assbuySchema.index({id_app:1});assbuySchema.index({creator:1});assbuySchema.index({id:1});assbuySchema.index({id_sell:1});assbuySchema.index({denom:1});assbuySchema.index({token:1});assbuySchema.index({status:1});assbuySchema.index({user_created:1});assbuySchema.index({creator:"text",id_sell:"text",token:"text",denom:"text"},{name:"assbuy_index2"});
|
|
1
|
+
'use strict';const assbuySchema=new Schema({id_app:String,creator:{type:String,required:!0},id:{type:String,trim:!0},id_sell:{type:String,required:!0},token:{type:String,required:!0,lowercase:!0},nguyen_gia:{type:Number},denom:{type:String,required:!0,lowercase:!0,trim:!0},so_luong_ban:{type:Number},gia_ban:{type:Number},so_luong:{type:Number,required:!0},gia_mua:{type:Number,required:!0},tong_gia_tri:{type:Number},exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,
|
|
2
|
+
default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assbuySchema.index({id_app:1});assbuySchema.index({creator:1});assbuySchema.index({id:1});assbuySchema.index({id_sell:1});assbuySchema.index({denom:1});assbuySchema.index({token:1});assbuySchema.index({status:1});assbuySchema.index({user_created:1});assbuySchema.index({creator:"text",id_sell:"text",token:"text",denom:"text"},{name:"assbuy_index2"});
|
|
3
3
|
const model=mongoose.models.assbuy||mongoose.model("assbuy",assbuySchema);model.on("index",async function($err$$){$err$$?console.error("assbuy index error",$err$$):console.info("assbuy indexing complete")});module.exports=model;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';const asscashwithdrawSchema=new Schema({id_app:String,creator:{type:String,required:!0},id:{type:String},token:{type:String,required:!0,lowercase:!0},amount:{type:Number,required:!0},require_date:Date,payer:{type:String},payment_date:Date,trang_thai:String,note:String,ten_ngan_hang:String,ten_tk:String,so_tk:String,exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},
|
|
2
|
-
default:""},user_updated:{type:String,default:""}});asscashwithdrawSchema.index({id_app:1});asscashwithdrawSchema.index({creator:1});asscashwithdrawSchema.index({id:1});asscashwithdrawSchema.index({payer:1});asscashwithdrawSchema.index({token:1});asscashwithdrawSchema.index({require_date:-1});asscashwithdrawSchema.index({payment_date:-1});asscashwithdrawSchema.index({trang_thai:1});asscashwithdrawSchema.index({status:1});asscashwithdrawSchema.index({user_created:1});
|
|
1
|
+
'use strict';const asscashwithdrawSchema=new Schema({id_app:String,creator:{type:String,required:!0,trim:!0},id:{type:String,trim:!0},token:{type:String,required:!0,lowercase:!0,trim:!0},amount:{type:Number,required:!0},require_date:Date,payer:{type:String,trim:!0},payment_date:Date,trang_thai:String,note:String,ten_ngan_hang:String,ten_tk:String,so_tk:String,exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},
|
|
2
|
+
user_created:{type:String,default:""},user_updated:{type:String,default:""}});asscashwithdrawSchema.index({id_app:1});asscashwithdrawSchema.index({creator:1});asscashwithdrawSchema.index({id:1});asscashwithdrawSchema.index({payer:1});asscashwithdrawSchema.index({token:1});asscashwithdrawSchema.index({require_date:-1});asscashwithdrawSchema.index({payment_date:-1});asscashwithdrawSchema.index({trang_thai:1});asscashwithdrawSchema.index({status:1});asscashwithdrawSchema.index({user_created:1});
|
|
3
3
|
asscashwithdrawSchema.index({creator:"text",token:"text",payer:"text",note:"text"},{name:"asscashwithdraw_index2"});const model=mongoose.models.asscashwithdraw||mongoose.model("asscashwithdraw",asscashwithdrawSchema);model.on("index",async function($err$$){$err$$?console.error("asscashwithdraw index error",$err$$):console.info("asscashwithdraw indexing complete")});module.exports=model;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict';const assinvestmentSchema=new Schema({id_app:String,so_hd:{required:!0,type:String,set:function($so_hd$$){this._previous_so_hd=this.so_hd;return $so_hd$$}},ngay_hd:{type:Date,default:Date.now},creator:{type:String,required:!0},id:{type:String},id_product:{type:String},ten_san_pham:{type:String},id_period:{type:String,required:!0},ten_ky_han:{type:String},product_token:{type:String,lowercase:!0},token:{type:String,lowercase:!0},co_phan:Boolean,
|
|
2
|
-
required:!0},tong_gia_tri:{type:Number},lai_suat_cam_ket:{type:Number},ky_tinh_lai:{type:Number},ngay_phat_hanh:{type:Date},ky_han:{type:Number},ngay_dao_han:{type:Date},cho_phep_rut_von:{type:Boolean},lai_suat_truoc_han:{type:Number},tg_xu_ly_rut_von:{type:Number},cho_phep_chuyen_nhuong:{type:Boolean},denom:{type:String},da_dao_han:{type:Boolean},trang_thai:{type:String,default:"1"},thong_tin_hop_dong:Schema.Types.Mixed,exfields:Schema.Types.Mixed,
|
|
3
|
-
default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assinvestmentSchema.index({id_app:1});assinvestmentSchema.index({creator:1});assinvestmentSchema.index({id:1});assinvestmentSchema.index({id_product:1});assinvestmentSchema.index({ten_san_pham:1});assinvestmentSchema.index({product_token:1});assinvestmentSchema.index({co_phan:1});assinvestmentSchema.index({id_period:1});
|
|
4
|
-
assinvestmentSchema.index({cho_phep_rut_von:1});assinvestmentSchema.index({cho_phep_chuyen_nhuong:1});assinvestmentSchema.index({da_dao_han:1});assinvestmentSchema.index({denom:1});assinvestmentSchema.index({token:1});assinvestmentSchema.index({status:1});assinvestmentSchema.index({user_created:1});assinvestmentSchema.index({creator:"text",product_token:"text",token:"text",ten_san_pham:"text",ten_ky_han:"text",denom:"text"},{name:"assinvestment_index2"});
|
|
1
|
+
'use strict';const assinvestmentSchema=new Schema({id_app:String,so_hd:{required:!0,type:String,set:function($so_hd$$){this._previous_so_hd=this.so_hd;return $so_hd$$},trim:!0},ngay_hd:{type:Date,default:Date.now},creator:{type:String,required:!0,trim:!0},id:{type:String,trim:!0},id_product:{type:String,trim:!0},ten_san_pham:{type:String},id_period:{type:String,required:!0,trim:!0},ten_ky_han:{type:String},product_token:{type:String,lowercase:!0,trim:!0},token:{type:String,lowercase:!0,trim:!0},co_phan:Boolean,
|
|
2
|
+
lai_da_tra:Number,gia:{type:Number},so_luong:{type:Number,required:!0},tong_gia_tri:{type:Number},lai_suat_cam_ket:{type:Number},ky_tinh_lai:{type:Number},ngay_phat_hanh:{type:Date},ky_han:{type:Number},ngay_dao_han:{type:Date},cho_phep_rut_von:{type:Boolean},lai_suat_truoc_han:{type:Number},tg_xu_ly_rut_von:{type:Number},cho_phep_chuyen_nhuong:{type:Boolean},denom:{type:String,trim:!0},da_dao_han:{type:Boolean},trang_thai:{type:String,default:"1"},thong_tin_hop_dong:Schema.Types.Mixed,exfields:Schema.Types.Mixed,
|
|
3
|
+
status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assinvestmentSchema.index({id_app:1});assinvestmentSchema.index({creator:1});assinvestmentSchema.index({id:1});assinvestmentSchema.index({id_product:1});assinvestmentSchema.index({ten_san_pham:1});assinvestmentSchema.index({product_token:1});assinvestmentSchema.index({co_phan:1});assinvestmentSchema.index({id_period:1});
|
|
4
|
+
assinvestmentSchema.index({ten_ky_han:1});assinvestmentSchema.index({cho_phep_rut_von:1});assinvestmentSchema.index({cho_phep_chuyen_nhuong:1});assinvestmentSchema.index({da_dao_han:1});assinvestmentSchema.index({denom:1});assinvestmentSchema.index({token:1});assinvestmentSchema.index({status:1});assinvestmentSchema.index({user_created:1});assinvestmentSchema.index({creator:"text",product_token:"text",token:"text",ten_san_pham:"text",ten_ky_han:"text",denom:"text"},{name:"assinvestment_index2"});
|
|
5
5
|
assinvestmentSchema.pre("save",function($next$$){if(!this.so_hd)return $next$$();const $self$$=this;this.isNew||this.so_hd!=this._previous_so_hd?mongoose.models.customer.countDocuments({id_app:this.id_app,so_hd:this.so_hd},($e$$,$count$$)=>{0<$count$$?$next$$(Error(`S\u1ed1 h\u1ee3p \u0111\u1ed3ng '${$self$$.so_hd}' \u0111\u00e3 t\u1ed3n t\u1ea1i`)):$next$$()}):$next$$()});const model=mongoose.models.assinvestment||mongoose.model("assinvestment",assinvestmentSchema);
|
|
6
6
|
model.on("index",async function($err$$){$err$$?console.error("AssInvestmnet index error",$err$$):console.info("AssInvestmnet indexing complete")});
|
|
7
7
|
model.getPercentOfSteps=$steps$$=>{let $owners$$=[];$steps$$.filter($s$$=>"4"==$s$$.trang_thai||"5"==$s$$.trang_thai).sort(($a$$,$b$$)=>$a$$.stt-$b$$.stt).forEach($s$$=>{let $owner$$={code:$s$$.code,name:$s$$.name,sl_slot:$s$$.sl_slot,gt_slot:$s$$.gt_slot,dillution:$s$$.dillution,raise:$s$$.raise,percent:$s$$.dillution||100,investment:$s$$.raise||$s$$.valuation};$owners$$.forEach($o$$=>{$o$$.percent*=1-$s$$.dillution/100});$owners$$.push($owner$$);$owners$$.forEach($o$$=>{$o$$.valuation=Math.round($s$$.valuation*
|
package/server/models/asskey.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';const asskeySchema=new Schema({id_app:String,name:String,username:{type:String,required:!0,maxlength:1024},address:{type:String,required:!0,maxlength:2024},mnemonic:String,private_key:String,note:String,asset:{type:String,uppercase:!0},exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});asskeySchema.index({id_app:1});
|
|
1
|
+
'use strict';const asskeySchema=new Schema({id_app:String,name:String,username:{type:String,required:!0,maxlength:1024,trim:!0},address:{type:String,required:!0,maxlength:2024,trim:!0},mnemonic:String,private_key:String,note:String,asset:{type:String,uppercase:!0,trim:!0},exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});asskeySchema.index({id_app:1});
|
|
2
2
|
asskeySchema.index({username:1,address:1});asskeySchema.index({note:1});asskeySchema.index({name:1});asskeySchema.index({status:1});asskeySchema.index({user_created:1});asskeySchema.index({username:"text",address:"text",note:"text",name:"text"},{name:"asskey_index"});const model=mongoose.models.asskey||mongoose.model("asskey",asskeySchema);model.on("index",async function($err$$){$err$$?console.error("asskey index error",$err$$):console.info("asskey indexing complete")});module.exports=model;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';const assneedtobuySchema=new Schema({id_app:String,creator:{type:String,required:!0},id:{type:String},id_product:{type:String},product_token:{type:String,lowercase:!0},ten_san_pham:{type:String},id_period:{type:String,required:!0},ten_ky_han:{type:String},ky_han:Number,gia_goc:Number,lai_suat_cam_ket:Number,ten_lh_dt:String,so_luong:Number,thoi_gian_con_lai:Number,gia_mua:Number,denom:{type:String,lowercase:!0},ngay_het_han:Date,trang_thai:String,
|
|
2
|
-
default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assneedtobuySchema.index({id_app:1});assneedtobuySchema.index({creator:1});assneedtobuySchema.index({id:1});assneedtobuySchema.index({id_product:1});assneedtobuySchema.index({product_token:1});assneedtobuySchema.index({ten_san_pham:1});assneedtobuySchema.index({id_period:1});assneedtobuySchema.index({ten_ky_han:1});
|
|
3
|
-
assneedtobuySchema.index({gia_goc:1});assneedtobuySchema.index({lai_suat_cam_ket:1});assneedtobuySchema.index({ten_lh_dt:1});assneedtobuySchema.index({so_luong:1});assneedtobuySchema.index({ngay_het_han:1});assneedtobuySchema.index({denom:1});assneedtobuySchema.index({trang_thai:1});assneedtobuySchema.index({status:1});assneedtobuySchema.index({user_created:1});assneedtobuySchema.index({creator:"text",ten_san_pham:"text",ten_ky_han:"text",denom:"text"},{name:"assneedtobuy_index2"});
|
|
1
|
+
'use strict';const assneedtobuySchema=new Schema({id_app:String,creator:{type:String,required:!0,trim:!0},id:{type:String,trim:!0},id_product:{type:String,trim:!0},product_token:{type:String,lowercase:!0,trim:!0},ten_san_pham:{type:String},id_period:{type:String,required:!0,trim:!0},ten_ky_han:{type:String},ky_han:Number,gia_goc:Number,lai_suat_cam_ket:Number,ten_lh_dt:String,so_luong:Number,thoi_gian_con_lai:Number,gia_mua:Number,denom:{type:String,lowercase:!0,trim:!0},ngay_het_han:Date,trang_thai:String,
|
|
2
|
+
exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assneedtobuySchema.index({id_app:1});assneedtobuySchema.index({creator:1});assneedtobuySchema.index({id:1});assneedtobuySchema.index({id_product:1});assneedtobuySchema.index({product_token:1});assneedtobuySchema.index({ten_san_pham:1});assneedtobuySchema.index({id_period:1});assneedtobuySchema.index({ten_ky_han:1});
|
|
3
|
+
assneedtobuySchema.index({ky_han:1});assneedtobuySchema.index({gia_goc:1});assneedtobuySchema.index({lai_suat_cam_ket:1});assneedtobuySchema.index({ten_lh_dt:1});assneedtobuySchema.index({so_luong:1});assneedtobuySchema.index({ngay_het_han:1});assneedtobuySchema.index({denom:1});assneedtobuySchema.index({trang_thai:1});assneedtobuySchema.index({status:1});assneedtobuySchema.index({user_created:1});assneedtobuySchema.index({creator:"text",ten_san_pham:"text",ten_ky_han:"text",denom:"text"},{name:"assneedtobuy_index2"});
|
|
4
4
|
const model=mongoose.models.assneedtobuy||mongoose.model("assneedtobuy",assneedtobuySchema);model.on("index",async function($err$$){$err$$?console.error("assneedtobuy index error",$err$$):console.info("assneedtobuy indexing complete")});module.exports=model;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict';const assperiodSchema=new Schema({id_app:String,creator:{type:String},id:{type:String},ten_ky_han:{type:String},id_product:{type:String},ten_san_pham:{type:String},product_token:{type:String,lowercase:!0},gia:{type:Number},lai_suat_cam_ket:{type:Number},lai_suat_truoc_han:{type:Number},ky_han:{type:Number},ky_tinh_lai:{type:Number},chia_loi_nhuan:Boolean,loi_nhuan_duoc_chia:Number,ngay_chia_loi_nhuan:Date,lai_suat_thoi_gian_con_lai:Number,tong_so_token:{type:Number},
|
|
2
|
-
cho_phep_rut_von:{type:Boolean},tg_xu_ly_rut_von:{type:Number,default:0},cho_phep_chuyen_nhuong:{type:Boolean},hoat_dong:{type:Boolean},denom:{type:String},co_phan:Boolean,goi_dau_tu:Boolean,ngay_phat_hanh:Date,id_rpt:String,lai_suat_tang_them_so_huu_token:Number,token_so_huu:String,so_luong_so_huu:Number,so_ngay_dau_tu_toi_thieu:Number,tru_lai_da_tra:Boolean,trang_thai:String,visible_to:{type:Number,default:0},visible_to_users:[String],exfields:Schema.Types.Mixed,
|
|
3
|
-
date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assperiodSchema.index({id_app:1});assperiodSchema.index({creator:1});assperiodSchema.index({id:1});assperiodSchema.index({ten_ky_han:1});assperiodSchema.index({id_product:1});assperiodSchema.index({product_token:1});assperiodSchema.index({visible_to:1});assperiodSchema.index({visible_to_users:1});assperiodSchema.index({ten_san_pham:1});
|
|
4
|
-
assperiodSchema.index({ngay_phat_hanh:-1});assperiodSchema.index({cho_phep_rut_von:1});assperiodSchema.index({cho_phep_chuyen_nhuong:1});assperiodSchema.index({hoat_dong:1});assperiodSchema.index({denom:1});assperiodSchema.index({trang_thai:1});assperiodSchema.index({status:1});assperiodSchema.index({user_created:1});assperiodSchema.index({creator:"text",ten_san_pham:"text",ten_ky_han:"text",denom:"text"},{name:"assperiod_index2"});
|
|
1
|
+
'use strict';const assperiodSchema=new Schema({id_app:String,creator:{type:String,trim:!0},id:{type:String,trim:!0},ten_ky_han:{type:String},id_product:{type:String,trim:!0},ten_san_pham:{type:String},product_token:{type:String,lowercase:!0,trim:!0},gia:{type:Number},lai_suat_cam_ket:{type:Number},lai_suat_truoc_han:{type:Number},ky_han:{type:Number},ky_tinh_lai:{type:Number},chia_loi_nhuan:Boolean,loi_nhuan_duoc_chia:Number,ngay_chia_loi_nhuan:Date,lai_suat_thoi_gian_con_lai:Number,tong_so_token:{type:Number},
|
|
2
|
+
da_dau_tu:{type:Number},cho_phep_rut_von:{type:Boolean},tg_xu_ly_rut_von:{type:Number,default:0},cho_phep_chuyen_nhuong:{type:Boolean},hoat_dong:{type:Boolean},denom:{type:String,trim:!0},co_phan:Boolean,goi_dau_tu:Boolean,ngay_phat_hanh:Date,id_rpt:String,lai_suat_tang_them_so_huu_token:Number,token_so_huu:String,so_luong_so_huu:Number,so_ngay_dau_tu_toi_thieu:Number,tru_lai_da_tra:Boolean,trang_thai:String,visible_to:{type:Number,default:0},visible_to_users:[String],exfields:Schema.Types.Mixed,
|
|
3
|
+
status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assperiodSchema.index({id_app:1});assperiodSchema.index({creator:1});assperiodSchema.index({id:1});assperiodSchema.index({ten_ky_han:1});assperiodSchema.index({id_product:1});assperiodSchema.index({product_token:1});assperiodSchema.index({visible_to:1});assperiodSchema.index({visible_to_users:1});assperiodSchema.index({ten_san_pham:1});
|
|
4
|
+
assperiodSchema.index({co_phan:1});assperiodSchema.index({ngay_phat_hanh:-1});assperiodSchema.index({cho_phep_rut_von:1});assperiodSchema.index({cho_phep_chuyen_nhuong:1});assperiodSchema.index({hoat_dong:1});assperiodSchema.index({denom:1});assperiodSchema.index({trang_thai:1});assperiodSchema.index({status:1});assperiodSchema.index({user_created:1});assperiodSchema.index({creator:"text",ten_san_pham:"text",ten_ky_han:"text",denom:"text"},{name:"assperiod_index2"});
|
|
5
5
|
const model=mongoose.models.assperiod||mongoose.model("assperiod",assperiodSchema);model.on("index",async function($err$$){$err$$?console.error("AssPeriod index error",$err$$):console.info("AssPeriod indexing complete")});module.exports=model;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';const assproductSchema=new Schema({id_app:String,creator:{type:String,required:!0},id:{type:String},ten_san_pham:{type:String,required:!0},mieu_ta:{type:String},tong_dien_tich:{type:String},chu_dau_tu:{type:String},gia_tri_hien_tai:{type:String},dia_chi:{type:String},hien_trang:{type:String},vi_tri:{type:String},thiet_ke:{type:String},tien_nghi:{type:String},hinh_anh:{type:String},video:{type:String},duoc_chuyen_thanh_cp:{type:Boolean},co_phan:Boolean,token:{type:String,
|
|
2
|
-
so_luong:Number,so_luong_goi_dau_tu:Number,tong_gia_tri_goi_dau_tu:Number,da_dau_tu:Number,gia_tri_da_dau_tu:Number,trang_thai:String,ma_loai:String,visible_to:{type:Number,default:0},visible_to_users:[String],exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assproductSchema.index({id_app:1});
|
|
3
|
-
assproductSchema.index({id:1});assproductSchema.index({ten_san_pham:1});assproductSchema.index({duoc_chuyen_thanh_cp:1});assproductSchema.index({token:1});assproductSchema.index({ma_loai:1});assproductSchema.index({co_phan:1});assproductSchema.index({trang_thai:1});assproductSchema.index({visible_to:1});assproductSchema.index({visible_to_users:1});assproductSchema.index({status:1});assproductSchema.index({user_created:1});
|
|
1
|
+
'use strict';const assproductSchema=new Schema({id_app:String,creator:{type:String,required:!0,trim:!0},id:{type:String,trim:!0},ten_san_pham:{type:String,required:!0},mieu_ta:{type:String},tong_dien_tich:{type:String},chu_dau_tu:{type:String},gia_tri_hien_tai:{type:String},dia_chi:{type:String},hien_trang:{type:String},vi_tri:{type:String},thiet_ke:{type:String},tien_nghi:{type:String},hinh_anh:{type:String},video:{type:String},duoc_chuyen_thanh_cp:{type:Boolean},co_phan:Boolean,token:{type:String,
|
|
2
|
+
required:!0,lowercase:!0,trim:!0},so_luong:Number,so_luong_goi_dau_tu:Number,tong_gia_tri_goi_dau_tu:Number,da_dau_tu:Number,gia_tri_da_dau_tu:Number,trang_thai:String,ma_loai:String,visible_to:{type:Number,default:0},visible_to_users:[String],exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assproductSchema.index({id_app:1});
|
|
3
|
+
assproductSchema.index({creator:1});assproductSchema.index({id:1});assproductSchema.index({ten_san_pham:1});assproductSchema.index({duoc_chuyen_thanh_cp:1});assproductSchema.index({token:1});assproductSchema.index({ma_loai:1});assproductSchema.index({co_phan:1});assproductSchema.index({trang_thai:1});assproductSchema.index({visible_to:1});assproductSchema.index({visible_to_users:1});assproductSchema.index({status:1});assproductSchema.index({user_created:1});
|
|
4
4
|
assproductSchema.index({creator:"text",ten_san_pham:"text",mieu_ta:"text",token:"text",ma_loai:"text"},{name:"assproduct_index3"});const model=mongoose.models.assproduct||mongoose.model("assproduct",assproductSchema);model.on("index",async function($err$$){$err$$?console.error("AssProduct index error",$err$$):console.info("AssProduct indexing complete")});module.exports=model;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';const assprofitsharingSchema=new Schema({id_app:String,creator:{type:String,required:!0},id:{type:String},id_product:{type:String,required:!0},ten_san_pham:{type:String},token:{type:String,lowercase:!0},id_period:String,denom:{type:String,required:!0},da_chia_loi_nhuan:Boolean,loi_nhuan_duoc_chia:Number,ngay_chia_loi_nhuan:Date,trang_thai:String,exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},
|
|
2
|
-
user_created:{type:String,default:""},user_updated:{type:String,default:""}});assprofitsharingSchema.index({id_app:1});assprofitsharingSchema.index({creator:1});assprofitsharingSchema.index({id:1});assprofitsharingSchema.index({id_product:1});assprofitsharingSchema.index({id_period:1});assprofitsharingSchema.index({token:1});assprofitsharingSchema.index({ten_san_pham:1});assprofitsharingSchema.index({denom:1});assprofitsharingSchema.index({trang_thai:1});
|
|
3
|
-
assprofitsharingSchema.index({creator:"text",ten_san_pham:"text",ten_ky_han:"text",denom:"text"},{name:"assprofitsharing_index2"});const model=mongoose.models.assprofitsharing||mongoose.model("assprofitsharing",assprofitsharingSchema);model.on("index",async function($err$$){$err$$?console.error("assprofitsharing index error",$err$$):console.info("assprofitsharing indexing complete")});module.exports=model;
|
|
1
|
+
'use strict';const assprofitsharingSchema=new Schema({id_app:String,creator:{type:String,required:!0,trim:!0},id:{type:String,trim:!0},id_product:{type:String,required:!0,trim:!0},ten_san_pham:{type:String},token:{type:String,lowercase:!0,trim:!0},id_period:String,denom:{type:String,required:!0,trim:!0},da_chia_loi_nhuan:Boolean,loi_nhuan_duoc_chia:Number,ngay_chia_loi_nhuan:Date,trang_thai:String,exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},
|
|
2
|
+
date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assprofitsharingSchema.index({id_app:1});assprofitsharingSchema.index({creator:1});assprofitsharingSchema.index({id:1});assprofitsharingSchema.index({id_product:1});assprofitsharingSchema.index({id_period:1});assprofitsharingSchema.index({token:1});assprofitsharingSchema.index({ten_san_pham:1});assprofitsharingSchema.index({denom:1});assprofitsharingSchema.index({trang_thai:1});
|
|
3
|
+
assprofitsharingSchema.index({status:1});assprofitsharingSchema.index({user_created:1});assprofitsharingSchema.index({creator:"text",ten_san_pham:"text",ten_ky_han:"text",denom:"text"},{name:"assprofitsharing_index2"});const model=mongoose.models.assprofitsharing||mongoose.model("assprofitsharing",assprofitsharingSchema);model.on("index",async function($err$$){$err$$?console.error("assprofitsharing index error",$err$$):console.info("assprofitsharing indexing complete")});module.exports=model;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';const assreceiverSchema=new Schema({id_app:String,name:{type:String,maxlength:1024,required:!0},address:{type:String,required:!0,maxlength:2024},note:{type:String},exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assreceiverSchema.index({id_app:1});assreceiverSchema.index({address:1});assreceiverSchema.index({name:1});
|
|
1
|
+
'use strict';const assreceiverSchema=new Schema({id_app:String,name:{type:String,maxlength:1024,required:!0},address:{type:String,required:!0,maxlength:2024,trim:!0},note:{type:String},exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assreceiverSchema.index({id_app:1});assreceiverSchema.index({address:1});assreceiverSchema.index({name:1});
|
|
2
2
|
assreceiverSchema.index({note:1});assreceiverSchema.index({status:1});assreceiverSchema.index({user_created:1});assreceiverSchema.index({address:"text",name:"text",note:"text"},{name:"assreceiver_index2"});const model=mongoose.models.assreceiver||mongoose.model("assreceiver",assreceiverSchema);model.on("index",async function($err$$){$err$$?console.error("assreceiver index error",$err$$):console.info("assreceiver indexing complete")});module.exports=model;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';const assrequestSchema=new Schema({id_app:String,receiver_name:String,receiver_address:{type:String,required:!0},request_id:{type:String,required:!0},amount:{type:Number,required:!0},denom:{type:String,required:!0,lowercase:!0},order_id:{type:String,required:!0},order_info:{type:String,required:!0},trang_thai:{type:String,default:"0"},sender_address:String,sender_name:String,sender_user:String,sender_date:Date,transaction:Schema.Types.Mixed,return_url:String,
|
|
2
|
-
exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assrequestSchema.index({id_app:1});assrequestSchema.index({sender_address:1});assrequestSchema.index({sender_name:1});assrequestSchema.index({sender_user:1});assrequestSchema.index({sender_date:1});assrequestSchema.index({request_id:1});assrequestSchema.index({denom:1});
|
|
3
|
-
assrequestSchema.index({order_info:1});assrequestSchema.index({receiver_name:1});assrequestSchema.index({receiver_address:1});assrequestSchema.index({status:1});assrequestSchema.index({user_created:1});assrequestSchema.index({trang_thai:1});assrequestSchema.index({receiver_address:"text",order_id:"text",order_info:"text",receiver_name:"text",sender_name:"text"},{name:"assrequest_index2"});const model=mongoose.models.assrequest||mongoose.model("assrequest",assrequestSchema);
|
|
1
|
+
'use strict';const assrequestSchema=new Schema({id_app:String,receiver_name:String,receiver_address:{type:String,required:!0,trim:!0},request_id:{type:String,required:!0,trim:!0},amount:{type:Number,required:!0},denom:{type:String,required:!0,lowercase:!0,trim:!0},order_id:{type:String,required:!0,trim:!0},order_info:{type:String,required:!0},trang_thai:{type:String,default:"0"},sender_address:String,sender_name:String,sender_user:String,sender_date:Date,transaction:Schema.Types.Mixed,return_url:String,
|
|
2
|
+
notify_url:String,payment_url:String,exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});assrequestSchema.index({id_app:1});assrequestSchema.index({sender_address:1});assrequestSchema.index({sender_name:1});assrequestSchema.index({sender_user:1});assrequestSchema.index({sender_date:1});assrequestSchema.index({request_id:1});assrequestSchema.index({denom:1});
|
|
3
|
+
assrequestSchema.index({order_id:1});assrequestSchema.index({order_info:1});assrequestSchema.index({receiver_name:1});assrequestSchema.index({receiver_address:1});assrequestSchema.index({status:1});assrequestSchema.index({user_created:1});assrequestSchema.index({trang_thai:1});assrequestSchema.index({receiver_address:"text",order_id:"text",order_info:"text",receiver_name:"text",sender_name:"text"},{name:"assrequest_index2"});const model=mongoose.models.assrequest||mongoose.model("assrequest",assrequestSchema);
|
|
4
4
|
model.on("index",async function($err$$){$err$$?console.error("assrequest index error",$err$$):console.info("assrequest indexing complete")});module.exports=model;
|
package/server/models/asssell.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';const asssellSchema=new Schema({id_app:String,creator:{type:String,required:!0},id:{type:String},id_product:{type:String},ten_san_pham:{type:String},product_token:{type:String,lowercase:!0},id_period:{type:String},ten_ky_han:{type:String},ten_lh_dt:String,ky_han:Number,token:{type:String,required:!0,lowercase:!0},gia_goc:{type:Number},lai_suat_cam_ket:Number,denom:{type:String,required:!0,lowercase:!0},so_luong:{type:Number},
|
|
2
|
-
required:!0},buyer:String,id_need_to_buy:String,fee:Number,exchange_address:String,exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});asssellSchema.index({id_app:1});asssellSchema.index({creator:1});asssellSchema.index({id:1});asssellSchema.index({denom:1});
|
|
3
|
-
asssellSchema.index({
|
|
4
|
-
const model=mongoose.models.asssell||mongoose.model("asssell",asssellSchema);model.on("index",async function($err$$){$err$$?console.error("asssell index error",$err$$):console.info("asssell indexing complete")});module.exports=model;
|
|
1
|
+
'use strict';const asssellSchema=new Schema({id_app:String,creator:{type:String,required:!0,trim:!0},id:{type:String,trim:!0},id_product:{type:String,trim:!0},ten_san_pham:{type:String},product_token:{type:String,lowercase:!0,trim:!0},id_period:{type:String,trim:!0},ten_ky_han:{type:String,trim:!0},ten_lh_dt:String,ky_han:Number,token:{type:String,required:!0,lowercase:!0,trim:!0},gia_goc:{type:Number},lai_suat_cam_ket:Number,denom:{type:String,required:!0,lowercase:!0,trim:!0},so_luong:{type:Number},
|
|
2
|
+
gia_ban:{type:Number},tong_gia_tri:{type:Number},ngay_het_han:{type:Date,required:!0},buyer:String,id_need_to_buy:String,fee:Number,exchange_address:String,exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});asssellSchema.index({id_app:1});asssellSchema.index({creator:1});asssellSchema.index({id:1});asssellSchema.index({denom:1});
|
|
3
|
+
asssellSchema.index({token:1});asssellSchema.index({id_product:1});asssellSchema.index({ten_san_pham:1});asssellSchema.index({product_token:1});asssellSchema.index({id_period:1});asssellSchema.index({ky_han:1});asssellSchema.index({gia_goc:1});asssellSchema.index({lai_suat_cam_ket:1});asssellSchema.index({ten_lh_dt:1});asssellSchema.index({ngay_het_han:-1});asssellSchema.index({status:1});asssellSchema.index({user_created:1});
|
|
4
|
+
asssellSchema.index({creator:"text",token:"text",denom:"text",ten_san_pham:"text",ten_ky_han:"text"},{name:"asssell_index2"});const model=mongoose.models.asssell||mongoose.model("asssell",asssellSchema);model.on("index",async function($err$$){$err$$?console.error("asssell index error",$err$$):console.info("asssell indexing complete")});module.exports=model;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';const asstransferSchema=new Schema({id_app:String,txhash:String,sender_address:{type:String,required:!0},sender_name:{type:String},receiver_name:{type:String},receiver_address:{type:String,required:!0},receiver_users:[],amount:{type:Number,required:!0},denom:{type:String,required:!0,lowercase:!0},memo:{type:String},request_id:{type:String},so1_id:{type:String},trang_thai:{type:String},transaction:Schema.Types.Mixed,exfields:Schema.Types.Mixed,
|
|
2
|
-
default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});asstransferSchema.index({id_app:1});asstransferSchema.index({txhash:1},{unique:!0});asstransferSchema.index({sender_address:1});asstransferSchema.index({sender_name:1});asstransferSchema.index({receiver_address:1});asstransferSchema.index({receiver_name:1});asstransferSchema.index({request_id:1});asstransferSchema.index({so1_id:1});
|
|
3
|
-
asstransferSchema.index({denom:1});asstransferSchema.index({status:1});asstransferSchema.index({user_created:1});asstransferSchema.index({trang_thai:1});asstransferSchema.index({receiver_address:"text",sender_address:"text",memo:"text",sender_name:"text",receiver_name:"text"},{name:"asstransfer_index2"});const model=mongoose.models.asstransfer||mongoose.model("asstransfer",asstransferSchema);
|
|
4
|
-
module.exports=model;
|
|
1
|
+
'use strict';const asstransferSchema=new Schema({id_app:String,txhash:String,sender_address:{type:String,required:!0,trim:!0},sender_name:{type:String,trim:!0},receiver_name:{type:String,trim:!0},receiver_address:{type:String,required:!0,trim:!0},receiver_users:[],amount:{type:Number,required:!0},denom:{type:String,required:!0,lowercase:!0,trim:!0},memo:{type:String},request_id:{type:String,trim:!0},so1_id:{type:String,trim:!0},trang_thai:{type:String},transaction:Schema.Types.Mixed,exfields:Schema.Types.Mixed,
|
|
2
|
+
status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});asstransferSchema.index({id_app:1});asstransferSchema.index({txhash:1},{unique:!0});asstransferSchema.index({sender_address:1});asstransferSchema.index({sender_name:1});asstransferSchema.index({receiver_address:1});asstransferSchema.index({receiver_name:1});asstransferSchema.index({request_id:1});asstransferSchema.index({so1_id:1});
|
|
3
|
+
asstransferSchema.index({memo:1});asstransferSchema.index({denom:1});asstransferSchema.index({status:1});asstransferSchema.index({user_created:1});asstransferSchema.index({trang_thai:1});asstransferSchema.index({receiver_address:"text",sender_address:"text",memo:"text",sender_name:"text",receiver_name:"text"},{name:"asstransfer_index2"});const model=mongoose.models.asstransfer||mongoose.model("asstransfer",asstransferSchema);
|
|
4
|
+
model.on("index",async function($err$$){$err$$?console.error("asstransfer index error",$err$$):console.info("asstransfer indexing complete")});module.exports=model;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';const asswithdrawSchema=new Schema({id_app:String,creator:{type:String,required:!0},id:{type:String},token:{type:String,required:!0,lowercase:!0},so_luong:{type:Number,required:!0},gia:{type:Number,default:0},von:{type:Number,default:0},lai_cam_ket:{type:Number,default:0},lai_thuong:{type:Number,default:0},ngay:{type:Date},denom:{type:String,lowercase:!0,required:!0},exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},
|
|
2
|
-
default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});asswithdrawSchema.index({id_app:1});asswithdrawSchema.index({creator:1});asswithdrawSchema.index({id:1});asswithdrawSchema.index({denom:1});asswithdrawSchema.index({token:1});asswithdrawSchema.index({status:1});asswithdrawSchema.index({user_created:1});asswithdrawSchema.index({creator:"text",token:"text",denom:"text"},{name:"asswithdraw_index2"});
|
|
1
|
+
'use strict';const asswithdrawSchema=new Schema({id_app:String,creator:{type:String,required:!0,trim:!0},id:{type:String,trim:!0},token:{type:String,required:!0,lowercase:!0,trim:!0},so_luong:{type:Number,required:!0},gia:{type:Number,default:0},von:{type:Number,default:0},lai_cam_ket:{type:Number,default:0},lai_thuong:{type:Number,default:0},ngay:{type:Date},denom:{type:String,lowercase:!0,required:!0,trim:!0},exfields:Schema.Types.Mixed,status:{type:Boolean,default:!0},date_created:{type:Date,default:Date.now},
|
|
2
|
+
date_updated:{type:Date,default:Date.now},user_created:{type:String,default:""},user_updated:{type:String,default:""}});asswithdrawSchema.index({id_app:1});asswithdrawSchema.index({creator:1});asswithdrawSchema.index({id:1});asswithdrawSchema.index({denom:1});asswithdrawSchema.index({token:1});asswithdrawSchema.index({status:1});asswithdrawSchema.index({user_created:1});asswithdrawSchema.index({creator:"text",token:"text",denom:"text"},{name:"asswithdraw_index2"});
|
|
3
3
|
const model=mongoose.models.asswithdraw||mongoose.model("asswithdraw",asswithdrawSchema);model.on("index",async function($err$$){$err$$?console.error("asswithdraw index error",$err$$):console.info("asswithdraw indexing complete")});module.exports=model;
|