biz9-logic 4.9.62 → 4.9.68
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/biz9_config +1 -1
- package/index.js +96 -35
- package/package.json +1 -1
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -199,14 +199,31 @@ class Type {
|
|
|
199
199
|
static APP_LINK_TYPE_CMS='cms';
|
|
200
200
|
|
|
201
201
|
//field
|
|
202
|
-
static
|
|
202
|
+
static ASC='asc';
|
|
203
|
+
static BLANK='blank';
|
|
204
|
+
static CART_ITEM_LIST='cart_item_list';
|
|
205
|
+
static CART_SUB_ITEM_LIST='cart_sub_item_list';
|
|
203
206
|
static DATA_TYPE='data_type';
|
|
207
|
+
static DESC='desc';
|
|
204
208
|
static DATE_CREATE='date_create';
|
|
205
209
|
static DATE_SAVE='date_save';
|
|
210
|
+
static ID='id';
|
|
211
|
+
static N_A='n/a';
|
|
212
|
+
static USER='user';
|
|
213
|
+
static USER_ID='user_id';
|
|
214
|
+
static CART_ITEM_LIST='cart_item_list';
|
|
215
|
+
static CART_SUB_ITEM_LIST='cart_sub_item_list';
|
|
216
|
+
static ORDER_ITEM_LIST='order_item_list';
|
|
217
|
+
static ORDER_SUB_ITEM_LIST='order_sub_item_list';
|
|
206
218
|
static PARENT_ID='parent_id';
|
|
219
|
+
static PARENT_ITEM='parent_item';
|
|
207
220
|
static PARENT_DATA_TYPE='parent_data_type';
|
|
208
221
|
static SETTING_VISIBLE='setting_visible';
|
|
209
222
|
static SOURCE='source';
|
|
223
|
+
static SOURCE_ID='source_id';
|
|
224
|
+
static SOURCE_PARENT_ID='source_parent_id';
|
|
225
|
+
static TITLE='title';
|
|
226
|
+
static TITLE_URL='title_url';
|
|
210
227
|
|
|
211
228
|
//page
|
|
212
229
|
static PAGE_ABOUT='about';
|
|
@@ -299,7 +316,6 @@ class Type {
|
|
|
299
316
|
{title:Type.get_title(Type.STAT_VIEW),type:Type.STAT_VIEW,label:Type.get_title(Type.STAT_VIEW),value:Type.STAT_VIEW},
|
|
300
317
|
]
|
|
301
318
|
};
|
|
302
|
-
|
|
303
319
|
static get_data_type_list = () =>{
|
|
304
320
|
return [
|
|
305
321
|
{title:Type.get_title(DataType.BLOG_POST),type:DataType.BLOG_POST,label:Type.get_title(DataType.BLOG_POST),value:DataType.BLOG_POST},
|
|
@@ -342,8 +358,7 @@ class Type {
|
|
|
342
358
|
{title:Type.get_title(Type.APP_LINK_TYPE_APPLE_STORE),type:Type.APP_LINK_TYPE_APPLE_STORE,label:Type.get_title(Type.APP_LINK_TYPE_APPLE_STORE),value:Type.APP_LINK_TYPE_APPLE_STORE},
|
|
343
359
|
]
|
|
344
360
|
};
|
|
345
|
-
|
|
346
|
-
|
|
361
|
+
//9_get_title
|
|
347
362
|
static get_title = (type,option)=>{
|
|
348
363
|
/* option
|
|
349
364
|
* get_lowercase = ex. true,false / def. false
|
|
@@ -355,65 +370,71 @@ class Type {
|
|
|
355
370
|
option = option ? option : {get_lowercase:false,get_plural:false,get_url:false};
|
|
356
371
|
switch(type){
|
|
357
372
|
case Type.STAT_CART:
|
|
358
|
-
|
|
373
|
+
r_type = "Cart";
|
|
359
374
|
break;
|
|
360
375
|
case Type.STAT_CART_ITEM:
|
|
361
|
-
|
|
376
|
+
r_type = "Cart Item";
|
|
362
377
|
break;
|
|
363
378
|
case Type.STAT_CART_SUB_ITEM:
|
|
364
|
-
|
|
379
|
+
r_type = "Cart Sub Item";
|
|
365
380
|
break;
|
|
366
381
|
case Type.STAT_FAVORITE:
|
|
367
|
-
|
|
382
|
+
r_type = "Favorite";
|
|
368
383
|
break;
|
|
369
384
|
case Type.STAT_LIKE:
|
|
370
|
-
|
|
385
|
+
r_type = "Like";
|
|
371
386
|
break;
|
|
372
387
|
case Type.STAT_LOGIN:
|
|
373
|
-
|
|
388
|
+
r_type = "Login";
|
|
374
389
|
break;
|
|
375
390
|
case Type.STAT_ORDER:
|
|
376
|
-
|
|
391
|
+
r_type = "Order";
|
|
377
392
|
break;
|
|
378
393
|
case Type.STAT_ORDER_ITEM:
|
|
379
|
-
|
|
394
|
+
r_type = "Order Item";
|
|
380
395
|
break;
|
|
381
396
|
case Type.STAT_ORDER_SUB_ITEM:
|
|
382
|
-
|
|
397
|
+
r_type = "Order Sub Item";
|
|
383
398
|
break;
|
|
384
399
|
case Type.STAT_ORDER_PAYMENT:
|
|
385
|
-
|
|
400
|
+
r_type = "Order Payment";
|
|
386
401
|
break;
|
|
387
402
|
case Type.STAT_REGISTER:
|
|
388
|
-
|
|
403
|
+
r_type = "Register";
|
|
389
404
|
break;
|
|
390
405
|
case Type.STAT_REVIEW:
|
|
391
|
-
|
|
406
|
+
r_type = "Review";
|
|
392
407
|
break;
|
|
393
408
|
case Type.STAT_VIEW:
|
|
394
|
-
|
|
409
|
+
r_type = "View";
|
|
395
410
|
break;
|
|
396
411
|
case Type.APP_ENV_TEST:
|
|
397
|
-
|
|
412
|
+
r_type = "Testing";
|
|
398
413
|
break;
|
|
399
414
|
case Type.APP_ENV_STAGE:
|
|
400
|
-
|
|
415
|
+
r_type = "Staging";
|
|
401
416
|
break;
|
|
402
417
|
case Type.APP_ENV_PROD:
|
|
403
|
-
|
|
418
|
+
r_type = "Production";
|
|
404
419
|
break;
|
|
405
420
|
case Type.APP_LINK_TYPE_WEBSITE:
|
|
406
|
-
|
|
421
|
+
r_type = "Website";
|
|
407
422
|
break;
|
|
408
423
|
case Type.APP_LINK_TYPE_GOOGLE_PLAY:
|
|
409
|
-
|
|
424
|
+
r_type = "Google Play";
|
|
410
425
|
break;
|
|
411
426
|
case Type.APP_LINK_TYPE_APPLE_STORE:
|
|
412
|
-
|
|
427
|
+
r_type = "Apple Store";
|
|
413
428
|
break;
|
|
414
429
|
case Type.APP_LINK_TYPE_CMS:
|
|
415
|
-
|
|
430
|
+
r_type = "Content Management System";
|
|
416
431
|
break;
|
|
432
|
+
|
|
433
|
+
case Type.ID:
|
|
434
|
+
r_type = "ID";
|
|
435
|
+
case Type.N_A:
|
|
436
|
+
r_type = "N/A";
|
|
437
|
+
|
|
417
438
|
case Type.PAGE_ABOUT:
|
|
418
439
|
case Type.PAGE_BLOG_POST:
|
|
419
440
|
case Type.PAGE_BLOG_POST_DETAIL:
|
|
@@ -492,7 +513,10 @@ class Type {
|
|
|
492
513
|
r_type = r_type.replace(" ","_").toLowerCase();
|
|
493
514
|
}
|
|
494
515
|
return r_type;
|
|
495
|
-
}
|
|
516
|
+
};
|
|
517
|
+
static get_type_title = (data_type) => {
|
|
518
|
+
return String(data_type.replaceAll('_',' ').replaceAll('dt','').replace('biz','')).trim();
|
|
519
|
+
};
|
|
496
520
|
}
|
|
497
521
|
class Stat_Logic {
|
|
498
522
|
static get_new = (parent_data_type,parent_id,stat_type,user_id,post_data) => {
|
|
@@ -512,7 +536,18 @@ class Stat_Logic {
|
|
|
512
536
|
let filter_stat = {};
|
|
513
537
|
for(const prop in post_data) {
|
|
514
538
|
const value = post_data[prop];
|
|
515
|
-
if (!Array.isArray(value)
|
|
539
|
+
if (!Array.isArray(value)
|
|
540
|
+
&& prop != Type.SOURCE
|
|
541
|
+
&& prop != Type.DATE_CREATE
|
|
542
|
+
&& prop != Type.DATE_SAVE
|
|
543
|
+
&& prop != Type.DATA_TYPE
|
|
544
|
+
&& prop != Type.CART_ITEM_LIST
|
|
545
|
+
&& prop != Type.CART_SUB_ITEM_LIST
|
|
546
|
+
&& prop != Type.ORDER_ITEM_LIST
|
|
547
|
+
&& prop != Type.ORDER_SUB_ITEM_LIST
|
|
548
|
+
&& prop != Type.SOURCE
|
|
549
|
+
&& prop != Type.SOURCE_ID
|
|
550
|
+
&& prop != Type.ID) {
|
|
516
551
|
filter_stat[prop] = post_data[prop];
|
|
517
552
|
}
|
|
518
553
|
}
|
|
@@ -576,6 +611,17 @@ class Order_Logic {
|
|
|
576
611
|
grand_total:cart.grand_total,
|
|
577
612
|
order_item_list:[]
|
|
578
613
|
});
|
|
614
|
+
for(const key in cart) {
|
|
615
|
+
if(!Str.check_is_null(cart[key])
|
|
616
|
+
&& key != Type.ID && key != Type.DATA_TYPE
|
|
617
|
+
&& key != Type.PARENT_ITEM && key != Type.USER
|
|
618
|
+
&& key != Type.CART_ITEM_LIST && key != Type.CART_SUB_ITEM_LIST
|
|
619
|
+
&& key != Type.ORDER_ITEM_LIST && key != Type.ORDER_SUB_ITEM_LIST
|
|
620
|
+
&& key != Type.SOURCE && key != Type.SOURCE_ID
|
|
621
|
+
&& key != Type.DATE_CREATE && key != Type.DATE_SAVE){
|
|
622
|
+
order[key] = cart[key];
|
|
623
|
+
}
|
|
624
|
+
}
|
|
579
625
|
if(option.get_payment_plan){
|
|
580
626
|
order.payment_plan = option.payment_plan;
|
|
581
627
|
order.payment_status = option.payment_plan_status;
|
|
@@ -590,6 +636,17 @@ class Order_Logic {
|
|
|
590
636
|
cost:cart_item.cost?cart_item.cost:0,
|
|
591
637
|
order_sub_item_list:[]
|
|
592
638
|
});
|
|
639
|
+
for(const key in cart_item){
|
|
640
|
+
if(!Str.check_is_null(cart_item[key])
|
|
641
|
+
&& key != Type.ID && key != Type.DATA_TYPE
|
|
642
|
+
&& key != Type.PARENT_ITEM && key != Type.USER
|
|
643
|
+
&& key != Type.CART_ITEM_LIST && key != Type.CART_SUB_ITEM_LIST
|
|
644
|
+
&& key != Type.ORDER_ITEM_LIST && key != Type.ORDER_SUB_ITEM_LIST
|
|
645
|
+
&& key != Type.SOURCE && key != Type.SOURCE_ID
|
|
646
|
+
&& key != Type.DATE_CREATE && key != Type.DATE_SAVE){
|
|
647
|
+
order_item[key] = cart_item[key];
|
|
648
|
+
}
|
|
649
|
+
}
|
|
593
650
|
cart_item.cart_sub_item_list.forEach(cart_sub_item => {
|
|
594
651
|
let order_sub_item = DataItem.get_new(DataType.ORDER_SUB_ITEM,0,{
|
|
595
652
|
order_number:order.order_number,
|
|
@@ -599,6 +656,17 @@ class Order_Logic {
|
|
|
599
656
|
quanity:cart_sub_item.quanity?cart_sub_item.quanity:0,
|
|
600
657
|
cost:cart_sub_item.cost?cart_sub_item.cost:0
|
|
601
658
|
})
|
|
659
|
+
for(const key in cart_sub_item){
|
|
660
|
+
if(!Str.check_is_null(cart_sub_item[key])
|
|
661
|
+
&& key != Type.ID && key != Type.DATA_TYPE
|
|
662
|
+
&& key != Type.PARENT_ITEM && key != Type.USER
|
|
663
|
+
&& key != Type.CART_ITEM_LIST && key != Type.CART_SUB_ITEM_LIST
|
|
664
|
+
&& key != Type.ORDER_ITEM_LIST && key != Type.ORDER_SUB_ITEM_LIST
|
|
665
|
+
&& key != Type.SOURCE && key != Type.SOURCE_ID
|
|
666
|
+
&& key != Type.DATE_CREATE && key != Type.DATE_SAVE){
|
|
667
|
+
order_sub_item[key] = cart_sub_item[key];
|
|
668
|
+
}
|
|
669
|
+
}
|
|
602
670
|
order_item.order_sub_item_list.push(order_sub_item);
|
|
603
671
|
});
|
|
604
672
|
order.order_item_list.push(order_item);
|
|
@@ -1744,7 +1812,7 @@ class App_Logic {
|
|
|
1744
1812
|
return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
|
|
1745
1813
|
}
|
|
1746
1814
|
static get_not_found = (data_type,id,option) =>{
|
|
1747
|
-
option=option?option:{
|
|
1815
|
+
option=option?option:{};
|
|
1748
1816
|
if(data_type != DataType.USER){
|
|
1749
1817
|
if(!id){
|
|
1750
1818
|
id=0;
|
|
@@ -1756,9 +1824,6 @@ class App_Logic {
|
|
|
1756
1824
|
item.title_url = Str.get_title_url(item.title);
|
|
1757
1825
|
item.images = [];
|
|
1758
1826
|
item.items = [];
|
|
1759
|
-
if(option.app_id){
|
|
1760
|
-
item.app_id = option.app_id;
|
|
1761
|
-
}
|
|
1762
1827
|
return item;
|
|
1763
1828
|
}else{
|
|
1764
1829
|
let user = User_Logic.get_test("",{get_blank:true})
|
|
@@ -1769,9 +1834,6 @@ class App_Logic {
|
|
|
1769
1834
|
user.title_url = Str.get_title_url(user.title);
|
|
1770
1835
|
user.images = [];
|
|
1771
1836
|
user.items = [];
|
|
1772
|
-
if(option.app_id){
|
|
1773
|
-
user.app_id = option.app_id;
|
|
1774
|
-
}
|
|
1775
1837
|
return user;
|
|
1776
1838
|
}
|
|
1777
1839
|
|
|
@@ -1831,8 +1893,7 @@ class App_Logic {
|
|
|
1831
1893
|
item_count:item_count?item_count:0,
|
|
1832
1894
|
page_count:page_count?page_count:1,
|
|
1833
1895
|
filter:filter?filter:{},
|
|
1834
|
-
data_list:data_list?data_list:[]
|
|
1835
|
-
app_id:app_id?app_id:null,
|
|
1896
|
+
data_list:data_list?data_list:[]
|
|
1836
1897
|
}
|
|
1837
1898
|
}
|
|
1838
1899
|
}
|