biz9-logic 10.0.25 → 10.0.29
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 +206 -150
- package/package.json +1 -1
- package/test.js +13 -11
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -68,7 +68,7 @@ class Item_Logic {
|
|
|
68
68
|
return child_obj;
|
|
69
69
|
};
|
|
70
70
|
static get_test = (title,data_type,id,option)=>{
|
|
71
|
-
data_type = data_type ? data_type :
|
|
71
|
+
data_type = data_type ? data_type : Type.DATA_BLANK;
|
|
72
72
|
id = id ? id : 0;
|
|
73
73
|
option = Field_Logic.get_option(data_type,option?option:{});
|
|
74
74
|
let item = DataItem.get_new(data_type,0,Field_Logic.get_test(title,option));
|
|
@@ -150,7 +150,7 @@ class Title {
|
|
|
150
150
|
class Demo_Logic {
|
|
151
151
|
static get_new_type = (title,option) => {
|
|
152
152
|
title = !Str.check_is_null(title)?title:Title.TYPE+" " +Num.get_id(999);
|
|
153
|
-
option = option ? option : {get_category:false,category_count:6,categorys:'',category_data_type:
|
|
153
|
+
option = option ? option : {get_category:false,category_count:6,categorys:'',category_data_type:Type.DATA_BLANK,get_item:false,items:'',item_data_type:Type.DATA_BLANK,item_count:6}; const item = Item_Logic.get_new(title,Type.DATA_TYPE); //category
|
|
154
154
|
if(option.get_category){
|
|
155
155
|
item.categorys = [];
|
|
156
156
|
let category_titles = [];
|
|
@@ -188,7 +188,7 @@ class Demo_Logic {
|
|
|
188
188
|
cat_item.items = [];
|
|
189
189
|
}
|
|
190
190
|
let child_item = Item_Logic.get_new(child_item_title,option.item_data_type);
|
|
191
|
-
if(option.item_data_type ==
|
|
191
|
+
if(option.item_data_type == Type.DATA_PRODUCT){
|
|
192
192
|
child_item.cost = Num.get_id(9000);
|
|
193
193
|
child_item.old_cost = Num.get_id(90000);
|
|
194
194
|
}
|
|
@@ -214,6 +214,41 @@ class Type {
|
|
|
214
214
|
static APP_LINK_TYPE_APPLE_STORE='apple_store';
|
|
215
215
|
static APP_LINK_TYPE_CMS='cms';
|
|
216
216
|
|
|
217
|
+
//data
|
|
218
|
+
static DATA_APP='app_biz';
|
|
219
|
+
static DATA_BLANK='blank_biz';
|
|
220
|
+
static DATA_BLOG_POST='blog_post_biz';
|
|
221
|
+
static DATA_CART_ITEM="cart_item_biz";
|
|
222
|
+
static DATA_CART="cart_biz";
|
|
223
|
+
static DATA_CART_ITEM="cart_item_biz";
|
|
224
|
+
static DATA_CART_SUB_ITEM="cart_sub_item_biz";
|
|
225
|
+
static DATA_CATEGORY='category_biz';
|
|
226
|
+
static DATA_CUSTOM_FIELD='custom_field_biz';
|
|
227
|
+
static DATA_CONTENT='content_biz';
|
|
228
|
+
static DATA_EVENT='event_biz';
|
|
229
|
+
static DATA_GROUP='group_biz';
|
|
230
|
+
static DATA_FAQ='faq_biz';
|
|
231
|
+
static DATA_FAVORITE='favorite_biz';
|
|
232
|
+
static DATA_FILE='file_biz';
|
|
233
|
+
static DATA_GALLERY='gallery_biz';
|
|
234
|
+
static DATA_IMAGE='image_biz';
|
|
235
|
+
static DATA_ITEM='item_biz';
|
|
236
|
+
static DATA_LINK='link_biz';
|
|
237
|
+
static DATA_ORDER="order_biz";
|
|
238
|
+
static DATA_ORDER_ITEM="order_item_biz";
|
|
239
|
+
static DATA_ORDER_SUB_ITEM="order_sub_item_biz";
|
|
240
|
+
static DATA_ORDER_PAYMENT="order_payment_biz";
|
|
241
|
+
static DATA_PRODUCT='product_biz';
|
|
242
|
+
static DATA_PAGE='page_biz';
|
|
243
|
+
static DATA_REVIEW='review_biz';
|
|
244
|
+
static DATA_SERVICE='service_biz';
|
|
245
|
+
static DATA_SECURITY='security_biz';
|
|
246
|
+
static DATA_STAT='stat_biz';
|
|
247
|
+
static DATA_TEMPLATE='template_biz';
|
|
248
|
+
static DATA_TYPE='type_biz';
|
|
249
|
+
static DATA_USER='user_biz';
|
|
250
|
+
static DATA_VIDEO='video_biz';
|
|
251
|
+
|
|
217
252
|
//field
|
|
218
253
|
static FIELD_AUTHOR = 'author';
|
|
219
254
|
static FIELD_CATEGORY = 'category';
|
|
@@ -271,6 +306,7 @@ class Type {
|
|
|
271
306
|
static TITLE_COUNT='count';
|
|
272
307
|
static TITLE_GROUP='group';
|
|
273
308
|
static TITLE_N_A='n/a';
|
|
309
|
+
static TITLE_IMAGES='images';
|
|
274
310
|
static TITLE_ITEMS='items';
|
|
275
311
|
static TITLE_OBJ='obj';
|
|
276
312
|
static TITLE_ORDER_ITEMS='order_items';
|
|
@@ -423,30 +459,30 @@ class Type {
|
|
|
423
459
|
};
|
|
424
460
|
static get_data_types = () =>{
|
|
425
461
|
return [
|
|
426
|
-
{title:Type.get_title(
|
|
427
|
-
{title:Type.get_title(
|
|
428
|
-
{title:Type.get_title(
|
|
429
|
-
{title:Type.get_title(
|
|
430
|
-
{title:Type.get_title(
|
|
431
|
-
{title:Type.get_title(
|
|
432
|
-
{title:Type.get_title(
|
|
433
|
-
{title:Type.get_title(
|
|
434
|
-
{title:Type.get_title(
|
|
435
|
-
{title:Type.get_title(
|
|
462
|
+
{title:Type.get_title(Type.DATA_BLOG_POST),type:Type.DATA_BLOG_POST,label:Type.get_title(Type.DATA_BLOG_POST),value:Type.DATA_BLOG_POST},
|
|
463
|
+
{title:Type.get_title(Type.DATA_CATEGORY),type:Type.DATA_CATEGORY,label:Type.get_title(Type.DATA_CATEGORY),value:Type.DATA_CATEGORY},
|
|
464
|
+
{title:Type.get_title(Type.DATA_CONTENT),type:Type.DATA_CONTENT,label:Type.get_title(Type.DATA_CONTENT),value:Type.DATA_CONTENT},
|
|
465
|
+
{title:Type.get_title(Type.DATA_EVENT),type:Type.DATA_EVENT,label:Type.get_title(Type.DATA_EVENT),value:Type.DATA_EVENT},
|
|
466
|
+
{title:Type.get_title(Type.DATA_FAQ),type:Type.DATA_FAQ,label:Type.get_title(Type.DATA_FAQ),value:Type.DATA_FAQ},
|
|
467
|
+
{title:Type.get_title(Type.DATA_GALLERY),type:Type.DATA_GALLERY,label:Type.get_title(Type.DATA_GALLERY),value:Type.DATA_GALLERY},
|
|
468
|
+
{title:Type.get_title(Type.DATA_USER),type:Type.DATA_USER,label:Type.get_title(Type.DATA_USER),value:Type.DATA_USER},
|
|
469
|
+
{title:Type.get_title(Type.DATA_PAGE),type:Type.DATA_PAGE,label:Type.get_title(Type.DATA_PAGE),value:Type.DATA_PAGE},
|
|
470
|
+
{title:Type.get_title(Type.DATA_PRODUCT),type:Type.DATA_PRODUCT,label:Type.get_title(Type.DATA_PRODUCT),value:Type.DATA_PRODUCT},
|
|
471
|
+
{title:Type.get_title(Type.DATA_SERVICE),type:Type.DATA_SERVICE,label:Type.get_title(Type.DATA_SERVICE),value:Type.DATA_SERVICE}
|
|
436
472
|
]
|
|
437
473
|
};
|
|
438
474
|
static get_types = () =>{
|
|
439
475
|
return [
|
|
440
|
-
{title:Type.get_title(
|
|
441
|
-
{title:Type.get_title(
|
|
442
|
-
{title:Type.get_title(
|
|
443
|
-
{title:Type.get_title(
|
|
444
|
-
{title:Type.get_title(
|
|
445
|
-
{title:Type.get_title(
|
|
446
|
-
{title:Type.get_title(
|
|
447
|
-
{title:Type.get_title(
|
|
448
|
-
{title:Type.get_title(
|
|
449
|
-
{title:Type.get_title(
|
|
476
|
+
{title:Type.get_title(Type.DATA_BLOG_POST),type:Type.DATA_BLOG_POST,label:Type.get_title(Type.DATA_BLOG_POST),value:Type.DATA_BLOG_POST},
|
|
477
|
+
{title:Type.get_title(Type.DATA_CATEGORY),type:Type.DATA_CATEGORY,label:Type.get_title(Type.DATA_CATEGORY),value:Type.DATA_CATEGORY},
|
|
478
|
+
{title:Type.get_title(Type.DATA_CONTENT),type:Type.DATA_CONTENT,label:Type.get_title(Type.DATA_CONTENT),value:Type.DATA_CONTENT},
|
|
479
|
+
{title:Type.get_title(Type.DATA_EVENT),type:Type.DATA_EVENT,label:Type.get_title(Type.DATA_EVENT),value:Type.DATA_EVENT},
|
|
480
|
+
{title:Type.get_title(Type.DATA_GALLERY),type:Type.DATA_GALLERY,label:Type.get_title(Type.DATA_GALLERY),value:Type.DATA_GALLERY},
|
|
481
|
+
{title:Type.get_title(Type.DATA_USER),type:Type.DATA_USER,label:Type.get_title(Type.DATA_USER),value:Type.DATA_USER},
|
|
482
|
+
{title:Type.get_title(Type.DATA_PAGE),type:Type.DATA_PAGE,label:Type.get_title(Type.DATA_PAGE),value:Type.DATA_PAGE},
|
|
483
|
+
{title:Type.get_title(Type.DATA_PRODUCT),type:Type.DATA_PRODUCT,label:Type.get_title(Type.DATA_PRODUCT),value:Type.DATA_PRODUCT},
|
|
484
|
+
{title:Type.get_title(Type.DATA_SERVICE),type:Type.DATA_SERVICE,label:Type.get_title(Type.DATA_SERVICE),value:Type.DATA_SERVICE},
|
|
485
|
+
{title:Type.get_title(Type.DATA_TYPE),type:Type.DATA_TYPE,label:Type.get_title(Type.DATA_TYPE),value:Type.DATA_TYPE}
|
|
450
486
|
]
|
|
451
487
|
};
|
|
452
488
|
static get_app_environments = () =>{
|
|
@@ -574,39 +610,39 @@ class Type {
|
|
|
574
610
|
case Type.ORDER_PAYMENT_METHOD_CASH:
|
|
575
611
|
case Type.ORDER_PAYMENT_METHOD_OTHER:
|
|
576
612
|
case Type.ORDER_PAYMENT_METHOD_TEST:
|
|
577
|
-
case
|
|
578
|
-
case
|
|
579
|
-
case
|
|
580
|
-
case
|
|
581
|
-
case
|
|
582
|
-
case
|
|
583
|
-
case
|
|
584
|
-
case
|
|
585
|
-
case
|
|
586
|
-
case
|
|
587
|
-
case
|
|
588
|
-
case
|
|
589
|
-
case
|
|
590
|
-
case
|
|
591
|
-
case
|
|
592
|
-
case
|
|
593
|
-
case
|
|
594
|
-
case
|
|
595
|
-
case
|
|
596
|
-
case
|
|
597
|
-
case
|
|
598
|
-
case
|
|
599
|
-
case
|
|
600
|
-
case
|
|
601
|
-
case
|
|
602
|
-
case
|
|
603
|
-
case
|
|
604
|
-
case
|
|
605
|
-
case
|
|
606
|
-
case
|
|
607
|
-
case
|
|
608
|
-
case
|
|
609
|
-
case
|
|
613
|
+
case Type.DATA_APP:
|
|
614
|
+
case Type.DATA_BLANK:
|
|
615
|
+
case Type.DATA_BLOG_POST:
|
|
616
|
+
case Type.DATA_CART:
|
|
617
|
+
case Type.DATA_CART_ITEM:
|
|
618
|
+
case Type.DATA_CART_SUB_ITEM:
|
|
619
|
+
case Type.DATA_CATEGORY:
|
|
620
|
+
case Type.DATA_CUSTOM_FIELD:
|
|
621
|
+
case Type.DATA_CONTENT:
|
|
622
|
+
case Type.DATA_EVENT:
|
|
623
|
+
case Type.DATA_FAQ:
|
|
624
|
+
case Type.DATA_FAVORITE:
|
|
625
|
+
case Type.DATA_FILE:
|
|
626
|
+
case Type.DATA_GALLERY:
|
|
627
|
+
case Type.DATA_GROUP:
|
|
628
|
+
case Type.DATA_ITEM_MAP:
|
|
629
|
+
case Type.DATA_ITEM:
|
|
630
|
+
case Type.DATA_LINK:
|
|
631
|
+
case Type.DATA_ORDER:
|
|
632
|
+
case Type.DATA_ORDER_ITEM:
|
|
633
|
+
case Type.DATA_ORDER_SUB_ITEM:
|
|
634
|
+
case Type.DATA_ORDER_PAYMENT:
|
|
635
|
+
case Type.DATA_PRODUCT:
|
|
636
|
+
case Type.DATA_IMAGE:
|
|
637
|
+
case Type.DATA_PAGE:
|
|
638
|
+
case Type.DATA_REVIEW:
|
|
639
|
+
case Type.DATA_SERVICE:
|
|
640
|
+
case Type.DATA_SECURITY:
|
|
641
|
+
case Type.DATA_STAT:
|
|
642
|
+
case Type.DATA_TEMPLATE:
|
|
643
|
+
case Type.DATA_TYPE:
|
|
644
|
+
case Type.DATA_USER:
|
|
645
|
+
case Type.DATA_VIDEO:
|
|
610
646
|
r_type = String(Str.get_title(type.replaceAll('_',' ').replaceAll('dt','').replace('biz',''))).trim();
|
|
611
647
|
break;
|
|
612
648
|
default:
|
|
@@ -629,11 +665,11 @@ class Type {
|
|
|
629
665
|
};
|
|
630
666
|
}
|
|
631
667
|
class Stat_Logic {
|
|
632
|
-
static get_new = (parent_data_type,parent_id,
|
|
633
|
-
let new_stat = DataItem.get_new(
|
|
668
|
+
static get_new = (parent_data_type,parent_id,type,user_id,post_data) => {
|
|
669
|
+
let new_stat = DataItem.get_new(Type.DATA_STAT,0,
|
|
634
670
|
{
|
|
635
671
|
user_id:user_id,
|
|
636
|
-
|
|
672
|
+
type:type,
|
|
637
673
|
parent_data_type:parent_data_type,
|
|
638
674
|
parent_id:parent_id
|
|
639
675
|
});
|
|
@@ -667,8 +703,8 @@ class Stat_Logic {
|
|
|
667
703
|
class Page_Logic {
|
|
668
704
|
static get_test = (title,option) =>{
|
|
669
705
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
670
|
-
option = Field_Logic.get_option(
|
|
671
|
-
let page = DataItem.get_new(
|
|
706
|
+
option = Field_Logic.get_option(Type.DATA_PAGE,option?option:{});
|
|
707
|
+
let page = DataItem.get_new(Type.DATA_PAGE,0,Field_Logic.get_test(title,option));
|
|
672
708
|
if(option.get_section){
|
|
673
709
|
page.items = Sub_Item_Logic.get_test_sections(page,page,option);
|
|
674
710
|
page = Sub_Item_Logic.bind_parent_child_items(page,page.items);
|
|
@@ -676,7 +712,7 @@ static get_test = (title,option) =>{
|
|
|
676
712
|
return page;
|
|
677
713
|
};
|
|
678
714
|
static get_test_items = (option) =>{
|
|
679
|
-
option = Field_Logic.get_option(
|
|
715
|
+
option = Field_Logic.get_option(Type.DATA_PAGE,option?option:{});
|
|
680
716
|
let items = [];
|
|
681
717
|
for(let a=0;a<parseInt(option.page_count)+1;a++){
|
|
682
718
|
items.push(Page_Logic.get_test( "Page " +parseInt(a+1)? !option.get_blank : "",option));
|
|
@@ -687,7 +723,7 @@ static get_test = (title,option) =>{
|
|
|
687
723
|
class Order_Logic {
|
|
688
724
|
static get_new = (cart,option) => {
|
|
689
725
|
option = option?option:{get_payment_plan:false,payment_plan:Title.ORDER_PAYMENT_PLAN_1};
|
|
690
|
-
let order = DataItem.get_new(
|
|
726
|
+
let order = DataItem.get_new(Type.DATA_ORDER,0,{
|
|
691
727
|
order_number:Title.ORDER_NUMBER + Num.get_id(99999),
|
|
692
728
|
parent_data_type:cart.parent_data_type,
|
|
693
729
|
user_id:cart.user_id,
|
|
@@ -711,7 +747,7 @@ class Order_Logic {
|
|
|
711
747
|
order.payment_plan = option.payment_plan;
|
|
712
748
|
}
|
|
713
749
|
cart.cart_items.forEach(cart_item => {
|
|
714
|
-
let order_item = DataItem.get_new(
|
|
750
|
+
let order_item = DataItem.get_new(Type.DATA_ORDER_ITEM,0,{
|
|
715
751
|
order_number:order.order_number,
|
|
716
752
|
parent_data_type:cart_item.parent_data_type,
|
|
717
753
|
parent_id:cart_item.parent_id,
|
|
@@ -732,7 +768,7 @@ class Order_Logic {
|
|
|
732
768
|
}
|
|
733
769
|
}
|
|
734
770
|
cart_item.cart_sub_items.forEach(cart_sub_item => {
|
|
735
|
-
let order_sub_item = DataItem.get_new(
|
|
771
|
+
let order_sub_item = DataItem.get_new(Type.DATA_ORDER_SUB_ITEM,0,{
|
|
736
772
|
order_number:order.order_number,
|
|
737
773
|
parent_data_type:cart_sub_item.parent_data_type,
|
|
738
774
|
parent_id:cart_sub_item.parent_id,
|
|
@@ -758,7 +794,7 @@ class Order_Logic {
|
|
|
758
794
|
return order;
|
|
759
795
|
};
|
|
760
796
|
static get_new_order_payment = (order_number,payment_method_type,payment_amount) => {
|
|
761
|
-
return DataItem.get_new(
|
|
797
|
+
return DataItem.get_new(Type.DATA_ORDER_PAYMENT,0,
|
|
762
798
|
{
|
|
763
799
|
order_number:order_number,
|
|
764
800
|
payment_method_type:payment_method_type,
|
|
@@ -788,13 +824,13 @@ class Order_Logic {
|
|
|
788
824
|
}
|
|
789
825
|
class Cart_Logic {
|
|
790
826
|
static get_new = (parent_data_type,user_id) => {
|
|
791
|
-
return DataItem.get_new(
|
|
827
|
+
return DataItem.get_new(Type.DATA_CART,0,{user_id:user_id,cart_number:Title.CART_NUMBER + Num.get_id(99999),parent_data_type:parent_data_type,grand_total:0,cart_items:[]});
|
|
792
828
|
};
|
|
793
829
|
static get_new_cart_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
|
|
794
|
-
return DataItem.get_new(
|
|
830
|
+
return DataItem.get_new(Type.DATA_CART_ITEM,0,{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,quanity:quanity?quanity:0,cost:cost?cost:0,cart_sub_items:[]});
|
|
795
831
|
};
|
|
796
832
|
static get_new_cart_sub_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
|
|
797
|
-
return DataItem.get_new(
|
|
833
|
+
return DataItem.get_new(Type.DATA_CART_SUB_ITEM,0,{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,quanity:quanity?quanity:0,cost:cost?cost:0});
|
|
798
834
|
};
|
|
799
835
|
static get_total = (cart) => {
|
|
800
836
|
let grand_total = 0;
|
|
@@ -819,7 +855,7 @@ class Cart_Logic {
|
|
|
819
855
|
class Product_Logic {
|
|
820
856
|
static get_new = (title,type,category,option) => {
|
|
821
857
|
option = option ? option : {};
|
|
822
|
-
const item = Item_Logic.get_new(title,
|
|
858
|
+
const item = Item_Logic.get_new(title,Type.DATA_PRODUCT);
|
|
823
859
|
item.type = type;
|
|
824
860
|
item.category = category = category?category:"";
|
|
825
861
|
return item;
|
|
@@ -856,8 +892,8 @@ static get_new = (title,type,category,option) => {
|
|
|
856
892
|
};
|
|
857
893
|
static get_test = (title,option) =>{
|
|
858
894
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
859
|
-
option = Field_Logic.get_option(
|
|
860
|
-
let product = DataItem.get_new(
|
|
895
|
+
option = Field_Logic.get_option(Type.DATA_PRODUCT,option?option:{});
|
|
896
|
+
let product = DataItem.get_new(Type.DATA_PRODUCT,0,Field_Logic.get_test(title,option));
|
|
861
897
|
if(option.get_blank ==false){
|
|
862
898
|
product.cost = Field_Logic.get_test_cost();
|
|
863
899
|
product.old_cost = Field_Logic.get_test_cost();
|
|
@@ -882,8 +918,8 @@ static get_new = (title,type,category,option) => {
|
|
|
882
918
|
};
|
|
883
919
|
static get_test_cart = (cart_number,user_id,option) =>{
|
|
884
920
|
[cart_number,option] = ield_Logic.get_option_title(cart_number,option);
|
|
885
|
-
option = Field_Logic.get_option(
|
|
886
|
-
let cart = DataItem.get_new(
|
|
921
|
+
option = Field_Logic.get_option(Type.DATA_CART,option?option:{});
|
|
922
|
+
let cart = DataItem.get_new(Type.DATA_CART,Num.get_guid(),Field_Logic.get_test(cart_number,option));
|
|
887
923
|
cart.user_id = user_id;
|
|
888
924
|
cart.cart_number = cart_number;
|
|
889
925
|
if(option.get_cart_item){
|
|
@@ -899,7 +935,7 @@ static get_new = (title,type,category,option) => {
|
|
|
899
935
|
return cart;
|
|
900
936
|
};
|
|
901
937
|
static get_test_items = (option) =>{
|
|
902
|
-
option = Field_Logic.get_option(
|
|
938
|
+
option = Field_Logic.get_option(Type.DATA_PRODUCT,option?option:{});
|
|
903
939
|
let items = [];
|
|
904
940
|
for(let a=0;a<option.product_count+1;a++){
|
|
905
941
|
items.push(Product_Logic.get_test("Product "+String(parseInt(a+1)),option));
|
|
@@ -907,9 +943,9 @@ static get_new = (title,type,category,option) => {
|
|
|
907
943
|
return items;
|
|
908
944
|
}
|
|
909
945
|
static get_test_items_by_category = (option) =>{
|
|
910
|
-
option = Field_Logic.get_option(
|
|
946
|
+
option = Field_Logic.get_option(Type.DATA_PRODUCT,option?option:{});
|
|
911
947
|
let products = [];
|
|
912
|
-
let categorys = Category_Logic.get_type_categorys(
|
|
948
|
+
let categorys = Category_Logic.get_type_categorys(Type.DATA_PRODUCT,option.category_count);
|
|
913
949
|
let item_count = 0;
|
|
914
950
|
for(let a=0;a<categorys.length;a++){
|
|
915
951
|
for(let b=0;b<option.product_count;b++){
|
|
@@ -948,8 +984,8 @@ class Service_Logic {
|
|
|
948
984
|
};
|
|
949
985
|
static get_test = (title,option) =>{
|
|
950
986
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
951
|
-
option = Field_Logic.get_option(
|
|
952
|
-
let service = DataItem.get_new(
|
|
987
|
+
option = Field_Logic.get_option(Type.DATA_SERVICE,option?option:{});
|
|
988
|
+
let service = DataItem.get_new(Type.DATA_SERVICE,0,Field_Logic.get_test(title,option));
|
|
953
989
|
service.cost = Field_Logic.get_test_cost();
|
|
954
990
|
service.old_cost = Field_Logic.get_test_cost();
|
|
955
991
|
service.type = "Type "+String(Num.get_id());
|
|
@@ -962,7 +998,7 @@ class Service_Logic {
|
|
|
962
998
|
return service;
|
|
963
999
|
};
|
|
964
1000
|
static get_test_items = (option) =>{
|
|
965
|
-
option = Field_Logic.get_option(
|
|
1001
|
+
option = Field_Logic.get_option(Type.DATA_SERVICE,option?option:{});
|
|
966
1002
|
let items = [];
|
|
967
1003
|
for(let a=0;a<parseInt(option.service_count)+1;a++){
|
|
968
1004
|
items.push(Service_Logic.get_test("Service "+String(parseInt(a+1)),option));
|
|
@@ -970,9 +1006,9 @@ class Service_Logic {
|
|
|
970
1006
|
return items;
|
|
971
1007
|
}
|
|
972
1008
|
static get_test_items_by_category = (option) =>{
|
|
973
|
-
option = Field_Logic.get_option(
|
|
1009
|
+
option = Field_Logic.get_option(Type.DATA_SERVICE,option?option:{});
|
|
974
1010
|
let services = [];
|
|
975
|
-
let categorys = Category_Logic.get_type_categorys(
|
|
1011
|
+
let categorys = Category_Logic.get_type_categorys(Type.DATA_SERVICE,option.category_count);
|
|
976
1012
|
let item_count = 0;
|
|
977
1013
|
for(let a=0;a<categorys.length;a++){
|
|
978
1014
|
for(let b=0;b<parseInt(option.service_count);b++){
|
|
@@ -988,8 +1024,8 @@ class Service_Logic {
|
|
|
988
1024
|
class Content_Logic {
|
|
989
1025
|
static get_test = (title,option) =>{
|
|
990
1026
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
991
|
-
option = Field_Logic.get_option(
|
|
992
|
-
let content = DataItem.get_new(
|
|
1027
|
+
option = Field_Logic.get_option(Type.DATA_CONTENT,option?option:{});
|
|
1028
|
+
let content = DataItem.get_new(Type.DATA_CONTENT,0,Field_Logic.get_test(title,option));
|
|
993
1029
|
if(option.get_item){
|
|
994
1030
|
content.items = Sub_Item_Logic.get_test_sections(content,content,option);
|
|
995
1031
|
if(option.get_item_bind){
|
|
@@ -999,7 +1035,7 @@ class Content_Logic {
|
|
|
999
1035
|
return content;
|
|
1000
1036
|
};
|
|
1001
1037
|
static get_test_items = (option) =>{
|
|
1002
|
-
option = Field_Logic.get_option(
|
|
1038
|
+
option = Field_Logic.get_option(Type.DATA_CONTENT,option?option:{});
|
|
1003
1039
|
let items = [];
|
|
1004
1040
|
for(let a=0;a<parseInt(option.content_count)+1;a++){
|
|
1005
1041
|
items.push(Content_Logic.get_test("Content " +String(parseInt(a+1)),option));
|
|
@@ -1007,9 +1043,9 @@ class Content_Logic {
|
|
|
1007
1043
|
return items;
|
|
1008
1044
|
}
|
|
1009
1045
|
static get_test_items_by_category = (option) =>{
|
|
1010
|
-
option = Field_Logic.get_option(
|
|
1046
|
+
option = Field_Logic.get_option(Type.DATA_CONTENT,option?option:{});
|
|
1011
1047
|
let contents = [];
|
|
1012
|
-
let categorys = Category_Logic.get_type_categorys(
|
|
1048
|
+
let categorys = Category_Logic.get_type_categorys(Type.DATA_CONTENT,option.category_count);
|
|
1013
1049
|
let item_count = 0;
|
|
1014
1050
|
for(let a=0;a<categorys.length;a++){
|
|
1015
1051
|
for(let b=0;b<parseInt(option.content_count);b++){
|
|
@@ -1025,16 +1061,16 @@ class Content_Logic {
|
|
|
1025
1061
|
class Template_Logic {
|
|
1026
1062
|
static get_test = (title,option) =>{
|
|
1027
1063
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1028
|
-
option = Field_Logic.get_option(
|
|
1029
|
-
let template = DataItem.get_new(
|
|
1064
|
+
option = Field_Logic.get_option(Type.DATA_TEMPLATE,option?option:{});
|
|
1065
|
+
let template = DataItem.get_new(Type.DATA_TEMPLATE,0,Field_Logic.get_test(title,option));
|
|
1030
1066
|
return template;
|
|
1031
1067
|
};
|
|
1032
1068
|
}
|
|
1033
1069
|
class Blog_Post_Logic {
|
|
1034
1070
|
static get_test = (title,option) =>{
|
|
1035
1071
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1036
|
-
option = Field_Logic.get_option(
|
|
1037
|
-
let blog_post = DataItem.get_new(
|
|
1072
|
+
option = Field_Logic.get_option(Type.DATA_BLOG_POST,option?option:{});
|
|
1073
|
+
let blog_post = DataItem.get_new(Type.DATA_BLOG_POST,0,Field_Logic.get_test(title,option));
|
|
1038
1074
|
if(!option.get_blank){
|
|
1039
1075
|
blog_post.author="First Name "+ Num.get_id();
|
|
1040
1076
|
blog_post.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id(), " Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
|
|
@@ -1048,7 +1084,7 @@ class Blog_Post_Logic {
|
|
|
1048
1084
|
return blog_post;
|
|
1049
1085
|
};
|
|
1050
1086
|
static get_test_items = (option) =>{
|
|
1051
|
-
option = Field_Logic.get_option(
|
|
1087
|
+
option = Field_Logic.get_option(Type.DATA_BLOG_POST,option?option:{});
|
|
1052
1088
|
let items = [];
|
|
1053
1089
|
for(let a=0;a<parseInt(option.blog_post_count)+1;a++){
|
|
1054
1090
|
items.push(Blog_Post_Logic.get_test("Blog Post " +String(parseInt(a+1)),option));
|
|
@@ -1056,9 +1092,9 @@ class Blog_Post_Logic {
|
|
|
1056
1092
|
return items;
|
|
1057
1093
|
}
|
|
1058
1094
|
static get_test_items_by_category = (option) =>{
|
|
1059
|
-
option = Field_Logic.get_option(
|
|
1095
|
+
option = Field_Logic.get_option(Type.DATA_BLOG_POST,option?option:{});
|
|
1060
1096
|
let blog_posts = [];
|
|
1061
|
-
let categorys = Category_Logic.get_type_categorys(
|
|
1097
|
+
let categorys = Category_Logic.get_type_categorys(Type.DATA_BLOG_POST,option.category_count);
|
|
1062
1098
|
let item_count = 0;
|
|
1063
1099
|
for(let a=0;a<categorys.length;a++){
|
|
1064
1100
|
for(let b=0;b<parseInt(option.blog_post_count);b++){
|
|
@@ -1074,8 +1110,8 @@ class Blog_Post_Logic {
|
|
|
1074
1110
|
class Gallery_Logic {
|
|
1075
1111
|
static get_test = (title,option) =>{
|
|
1076
1112
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1077
|
-
option = Field_Logic.get_option(
|
|
1078
|
-
let gallery = DataItem.get_new(
|
|
1113
|
+
option = Field_Logic.get_option(Type.DATA_GALLERY,option?option:{});
|
|
1114
|
+
let gallery = DataItem.get_new(Type.DATA_GALLERY,0,Field_Logic.get_test(title,option));
|
|
1079
1115
|
if(!option.get_blank){
|
|
1080
1116
|
gallery.date = String(String(Num.get_id(2030)) + "-" + String(Num.get_id(13)) + "-" + String(Num.get_id(30))).trim();
|
|
1081
1117
|
gallery.time = String(Num.get_id(24)) + ":" + String(Num.get_id(59));
|
|
@@ -1119,8 +1155,8 @@ class Event_Logic {
|
|
|
1119
1155
|
};
|
|
1120
1156
|
static get_test = (title,option) =>{
|
|
1121
1157
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1122
|
-
option = Field_Logic.get_option(
|
|
1123
|
-
let event = DataItem.get_new(
|
|
1158
|
+
option = Field_Logic.get_option(Type.DATA_EVENT,option?option:{});
|
|
1159
|
+
let event = DataItem.get_new(Type.DATA_EVENT,0,Field_Logic.get_test(title,option));
|
|
1124
1160
|
if(!option.get_blank){
|
|
1125
1161
|
event.cost = Field_Logic.get_test_cost();
|
|
1126
1162
|
event.old_cost = Field_Logic.get_test_cost();
|
|
@@ -1150,7 +1186,7 @@ class Event_Logic {
|
|
|
1150
1186
|
return event;
|
|
1151
1187
|
};
|
|
1152
1188
|
static get_test_items = (option) =>{
|
|
1153
|
-
option = Field_Logic.get_option(
|
|
1189
|
+
option = Field_Logic.get_option(Type.DATA_EVENT,option?option:{});
|
|
1154
1190
|
let items = [];
|
|
1155
1191
|
for(let a=0;a<parseInt(option.event_count)+1;a++){
|
|
1156
1192
|
items.push(Event_Logic.get_test("Event "+String(parseInt(a+1)),option));
|
|
@@ -1158,9 +1194,9 @@ class Event_Logic {
|
|
|
1158
1194
|
return items;
|
|
1159
1195
|
}
|
|
1160
1196
|
static get_test_items_by_category = (option) =>{
|
|
1161
|
-
option = Field_Logic.get_option(
|
|
1197
|
+
option = Field_Logic.get_option(Type.DATA_EVENT,option?option:{});
|
|
1162
1198
|
let events = [];
|
|
1163
|
-
let categorys = Category_Logic.get_type_categorys(
|
|
1199
|
+
let categorys = Category_Logic.get_type_categorys(Type.DATA_EVENT,option.category_count);
|
|
1164
1200
|
let item_count = 0;
|
|
1165
1201
|
for(let a=0;a<categorys.length;a++){
|
|
1166
1202
|
for(let b=0;b<parseInt(option.event_count);b++){
|
|
@@ -1358,7 +1394,7 @@ class Field_Logic {
|
|
|
1358
1394
|
return item;
|
|
1359
1395
|
};
|
|
1360
1396
|
static get_option(data_type,option){
|
|
1361
|
-
data_type = data_type ? data_type :
|
|
1397
|
+
data_type = data_type ? data_type : Type.DATA_BLANK;
|
|
1362
1398
|
option = !Obj.check_is_empty(option) ? option : {get_value:false,get_item:false,get_image:false,item_count:9,value_count:9};
|
|
1363
1399
|
option.generate_id = option.generate_id ? option.generate_id : false;
|
|
1364
1400
|
option.get_image = option.get_image ? true : false;
|
|
@@ -1372,36 +1408,36 @@ class Field_Logic {
|
|
|
1372
1408
|
option.category_count = option.category_count ? option.category_count : 9;
|
|
1373
1409
|
option.category_title = option.category_title ? option.category_title : "";
|
|
1374
1410
|
option.fields = option.fields ? option.fields : [];
|
|
1375
|
-
if(option.data_type==
|
|
1411
|
+
if(option.data_type==Type.DATA_PAGE){
|
|
1376
1412
|
option.page_count = option.page_count ? option.page_count : 9;
|
|
1377
1413
|
option.section_count = option.section_count ? option.section_count : 9;
|
|
1378
1414
|
option.get_section = option.get_section ? true : false;
|
|
1379
1415
|
}
|
|
1380
|
-
if(data_type==
|
|
1416
|
+
if(data_type==Type.DATA_PRODUCT){
|
|
1381
1417
|
option.product_count = option.product_count ? option.product_count : 9;
|
|
1382
1418
|
}
|
|
1383
|
-
if(data_type==
|
|
1419
|
+
if(data_type==Type.DATA_SERVICE){
|
|
1384
1420
|
option.service_count = option.service_count ? option.service_count : 9;
|
|
1385
1421
|
}
|
|
1386
|
-
if(data_type==
|
|
1422
|
+
if(data_type==Type.DATA_BLOG_POST){
|
|
1387
1423
|
option.blog_post_count = option.blog_post_count ? option.blog_post_count : 9;
|
|
1388
1424
|
}
|
|
1389
|
-
if(data_type==
|
|
1425
|
+
if(data_type==Type.DATA_EVENT){
|
|
1390
1426
|
option.event_count = option.event_count ? option.event_count : 9;
|
|
1391
1427
|
}
|
|
1392
|
-
if(data_type==
|
|
1428
|
+
if(data_type==Type.DATA_FAQ){
|
|
1393
1429
|
option.question_count = option.question_count ? option.question_count : 9;
|
|
1394
1430
|
}
|
|
1395
|
-
if(data_type==
|
|
1431
|
+
if(data_type==Type.DATA_CONTENT){
|
|
1396
1432
|
option.content_count = option.content_count ? option.content_count : 9;
|
|
1397
1433
|
}
|
|
1398
|
-
if(data_type==
|
|
1434
|
+
if(data_type==Type.DATA_SUB_ITEM){
|
|
1399
1435
|
option.item_count = option.item_count ? option.item_count : 9;
|
|
1400
1436
|
}
|
|
1401
|
-
if(data_type==
|
|
1437
|
+
if(data_type==Type.DATA_USER){
|
|
1402
1438
|
option.user_count = option.user_count ? option.user_count : 9;
|
|
1403
1439
|
}
|
|
1404
|
-
if(data_type==
|
|
1440
|
+
if(data_type==Type.DATA_CART){
|
|
1405
1441
|
option.category_title = option.category_title ? option.category_title : "";
|
|
1406
1442
|
option.value_count = option.value_count ? option.value_count : 9;
|
|
1407
1443
|
option.get_cart_item = option.get_cart_item ? option.get_cart_item : false;
|
|
@@ -1409,13 +1445,13 @@ class Field_Logic {
|
|
|
1409
1445
|
option.get_cart_sub_item = option.get_cart_sub_item ? option.get_cart_sub_item : false;
|
|
1410
1446
|
option.cart_sub_item_count = option.cart_sub_item_count ? option.cart_sub_item_count : 3;
|
|
1411
1447
|
}
|
|
1412
|
-
if(data_type==
|
|
1448
|
+
if(data_type==Type.DATA_CART_ITEM){
|
|
1413
1449
|
option.category_title = option.category_title ? option.category_title : "";
|
|
1414
1450
|
option.value_count = option.value_count ? option.value_count : 9;
|
|
1415
1451
|
option.get_cart_sub_item = option.get_cart_sub_item ? option.get_cart_sub_item : false;
|
|
1416
1452
|
option.cart_sub_item_count = option.cart_sub_item_count ? option.cart_sub_item_count : 1;
|
|
1417
1453
|
}
|
|
1418
|
-
if(data_type==
|
|
1454
|
+
if(data_type==Type.DATA_ORDER){
|
|
1419
1455
|
option.category_title = option.category_title ? option.category_title : "";
|
|
1420
1456
|
option.value_count = option.value_count ? option.value_count : 9;
|
|
1421
1457
|
option.get_order_item = option.get_order_item ? option.get_order_item : false;
|
|
@@ -1423,7 +1459,7 @@ class Field_Logic {
|
|
|
1423
1459
|
option.get_order_sub_item = option.get_order_sub_item ? option.get_order_sub_item : false;
|
|
1424
1460
|
option.order_sub_item_count = option.order_sub_item_count ? option.order_sub_item_count : 3;
|
|
1425
1461
|
}
|
|
1426
|
-
if(data_type==
|
|
1462
|
+
if(data_type==Type.DATA_ORDER_ITEM){
|
|
1427
1463
|
option.category_title = option.category_title ? option.category_title : "";
|
|
1428
1464
|
option.value_count = option.value_count ? option.value_count : 9;
|
|
1429
1465
|
option.get_order_sub_item = option.get_order_sub_item ? option.get_order_sub_item : false;
|
|
@@ -1499,7 +1535,8 @@ class Field_Logic {
|
|
|
1499
1535
|
return option;
|
|
1500
1536
|
}
|
|
1501
1537
|
}
|
|
1502
|
-
|
|
1538
|
+
/*
|
|
1539
|
+
class Type.DATA_{
|
|
1503
1540
|
static APP='app_biz';
|
|
1504
1541
|
static BLANK='blank_biz';
|
|
1505
1542
|
static BLOG_POST='blog_post_biz';
|
|
@@ -1534,9 +1571,10 @@ class DataType {
|
|
|
1534
1571
|
static USER='user_biz';
|
|
1535
1572
|
static VIDEO='video_biz';
|
|
1536
1573
|
}
|
|
1574
|
+
*/
|
|
1537
1575
|
class Favorite_Logic {
|
|
1538
1576
|
static get_new = (parent_data_type,parent_id,user_id) =>{
|
|
1539
|
-
return DataItem.get_new(
|
|
1577
|
+
return DataItem.get_new(Type.DATA_FAVORITE,0,{
|
|
1540
1578
|
parent_data_type:parent_data_type,
|
|
1541
1579
|
parent_id:parent_id,
|
|
1542
1580
|
user_id:user_id
|
|
@@ -1560,7 +1598,7 @@ class Favorite_Logic {
|
|
|
1560
1598
|
}
|
|
1561
1599
|
class Review_Logic {
|
|
1562
1600
|
static get_new = (parent_data_type,parent_id,user_id,title,comment,rating) =>{
|
|
1563
|
-
return DataItem.get_new(
|
|
1601
|
+
return DataItem.get_new(Type.DATA_REVIEW,0,{
|
|
1564
1602
|
parent_data_type:parent_data_type,
|
|
1565
1603
|
parent_id:parent_id,
|
|
1566
1604
|
user_id:user_id,
|
|
@@ -1584,8 +1622,8 @@ class Review_Logic {
|
|
|
1584
1622
|
] };
|
|
1585
1623
|
}
|
|
1586
1624
|
static get_test = (item_data_type,item_id,user_id,option) =>{
|
|
1587
|
-
option = Field_Logic.get_option(
|
|
1588
|
-
let review = DataItem.get_new(
|
|
1625
|
+
option = Field_Logic.get_option(Type.DATA_REVIEW,option?option:{});
|
|
1626
|
+
let review = DataItem.get_new(Type.DATA_REVIEW,0);
|
|
1589
1627
|
if(!option.get_blank){
|
|
1590
1628
|
review.title = 'Title ' + Num.get_id();
|
|
1591
1629
|
review.item_data_type = item_data_type;
|
|
@@ -1616,18 +1654,18 @@ class Admin_Logic {
|
|
|
1616
1654
|
static get_new = (title,option) =>{
|
|
1617
1655
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1618
1656
|
return DataItem.get_new_full_item(
|
|
1619
|
-
DataItem.get_new(
|
|
1620
|
-
DataItem.get_new(
|
|
1621
|
-
DataItem.get_new(
|
|
1657
|
+
DataItem.get_new(Type.DATA_ADMIN,0),
|
|
1658
|
+
DataItem.get_new(Type.DATA_ADMIN,0),
|
|
1659
|
+
DataItem.get_new(Type.DATA_ADMIN,0),{
|
|
1622
1660
|
title:title,
|
|
1623
1661
|
email:"",
|
|
1624
1662
|
});
|
|
1625
1663
|
};
|
|
1626
1664
|
static get_test = (title,option) =>{
|
|
1627
1665
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1628
|
-
option = Field_Logic.get_option(
|
|
1629
|
-
let item = DataItem.get_new(
|
|
1630
|
-
let admin = DataItem.get_new(
|
|
1666
|
+
option = Field_Logic.get_option(Type.DATA_ADMIN,option?option:{});
|
|
1667
|
+
let item = DataItem.get_new(Type.DATA_ADMIN,0);
|
|
1668
|
+
let admin = DataItem.get_new(Type.DATA_ADMIN,0,Field_Logic.get_test(title,option));
|
|
1631
1669
|
if(!option.get_blank){
|
|
1632
1670
|
admin.email="ceo@admin"+Num.get_id()+".com";
|
|
1633
1671
|
admin.password="1234567";
|
|
@@ -1657,22 +1695,22 @@ class DataItem {
|
|
|
1657
1695
|
class Category_Logic {
|
|
1658
1696
|
static get_new = (title,type,category,option) => {
|
|
1659
1697
|
option = option ? option : {};
|
|
1660
|
-
const item = Item_Logic.get_new(title,
|
|
1698
|
+
const item = Item_Logic.get_new(title,Type.DATA_CATEGORY);
|
|
1661
1699
|
item.type = type;
|
|
1662
1700
|
item.category = category = category?category:"";
|
|
1663
1701
|
return item;
|
|
1664
1702
|
};
|
|
1665
1703
|
static get_test = (title,option) =>{
|
|
1666
1704
|
title = (title) ? title : "Category 1";
|
|
1667
|
-
option = Field_Logic.get_option(
|
|
1668
|
-
let category = DataItem.get_new(
|
|
1705
|
+
option = Field_Logic.get_option(Type.DATA_CATEGORY,option?option:{});
|
|
1706
|
+
let category = DataItem.get_new(Type.DATA_CATEGORY,0,Field_Logic.get_test(title,option));
|
|
1669
1707
|
if(option.get_item){
|
|
1670
1708
|
category.items = Sub_Item_Logic.get_test_items(category,category,option);
|
|
1671
1709
|
}
|
|
1672
1710
|
return category;
|
|
1673
1711
|
};
|
|
1674
1712
|
static get_test_items = (option) =>{
|
|
1675
|
-
option = Field_Logic.get_option(
|
|
1713
|
+
option = Field_Logic.get_option(Type.DATA_CATEGORY,option);
|
|
1676
1714
|
let items = [];
|
|
1677
1715
|
for(let a=0;a<option.category_count;a++){
|
|
1678
1716
|
items.push(Category_Logic.get_test("Category " +String(parseInt(a+1)),option));
|
|
@@ -1680,10 +1718,10 @@ class Category_Logic {
|
|
|
1680
1718
|
return items;
|
|
1681
1719
|
}
|
|
1682
1720
|
static get_test_items_by_type = (type,option) =>{
|
|
1683
|
-
option = Field_Logic.get_option(
|
|
1721
|
+
option = Field_Logic.get_option(Type.DATA_CATEGORY,option);
|
|
1684
1722
|
let categorys = [];
|
|
1685
1723
|
for(let a=0;a<option.category_count;a++){
|
|
1686
|
-
let category = DataItem.get_new(
|
|
1724
|
+
let category = DataItem.get_new(Type.DATA_CATEGORY,0,Field_Logic.get_test("Category " +String(parseInt(a+1)),option));
|
|
1687
1725
|
category.type = type;
|
|
1688
1726
|
categorys.push(category);
|
|
1689
1727
|
}
|
|
@@ -1775,11 +1813,11 @@ class User_Logic {
|
|
|
1775
1813
|
|
|
1776
1814
|
}
|
|
1777
1815
|
static get_guest(){
|
|
1778
|
-
return DataItem.get_new(
|
|
1816
|
+
return DataItem.get_new(Type.DATA_USER,0,{is_guest:true,title_url:'guest',first_name:'Guest',last_name:'User',email:'guest@email.com',title:"Guest",country:"United States"});
|
|
1779
1817
|
}
|
|
1780
1818
|
static get_request_user(req){
|
|
1781
1819
|
if(!req || !req.session.user){
|
|
1782
|
-
let user=DataItem.get_new(
|
|
1820
|
+
let user=DataItem.get_new(Type.DATA_USER,Num.get_id(9999999),{is_guest:true});
|
|
1783
1821
|
req.session.user=user;
|
|
1784
1822
|
}
|
|
1785
1823
|
return req.session.user;
|
|
@@ -1793,8 +1831,8 @@ class User_Logic {
|
|
|
1793
1831
|
}
|
|
1794
1832
|
static get_test = (title,option) =>{
|
|
1795
1833
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1796
|
-
option = Field_Logic.get_option(
|
|
1797
|
-
let user = DataItem.get_new(
|
|
1834
|
+
option = Field_Logic.get_option(Type.DATA_USER,option?option:{});
|
|
1835
|
+
let user = DataItem.get_new(Type.DATA_USER,0,
|
|
1798
1836
|
Field_Logic.get_test(title,option));
|
|
1799
1837
|
if(option.get_blank){
|
|
1800
1838
|
user.first_name="";
|
|
@@ -1816,7 +1854,7 @@ class User_Logic {
|
|
|
1816
1854
|
return user;
|
|
1817
1855
|
};
|
|
1818
1856
|
static get_test_items = (option) =>{
|
|
1819
|
-
option = Field_Logic.get_option(
|
|
1857
|
+
option = Field_Logic.get_option(Type.DATA_USER,option?option:{});
|
|
1820
1858
|
let items = [];
|
|
1821
1859
|
for(let a=0;a<option.user_count+1;a++){
|
|
1822
1860
|
items.push(User_Logic.get_test("User " +String(parseInt(a+1)),option));
|
|
@@ -1826,14 +1864,14 @@ class User_Logic {
|
|
|
1826
1864
|
}
|
|
1827
1865
|
class Sub_Item_Logic {
|
|
1828
1866
|
static get_test(title,parent_item,top_item,option){
|
|
1829
|
-
option = Field_Logic.get_option(
|
|
1867
|
+
option = Field_Logic.get_option(Type.DATA_ITEM,option?option:{});
|
|
1830
1868
|
let item_title =title;
|
|
1831
1869
|
let item = DataItem.get_new(
|
|
1832
|
-
|
|
1870
|
+
Type.DATA_ITEM,0, {
|
|
1833
1871
|
top_id:top_item.id?top_item.id:0,
|
|
1834
|
-
top_data_type:top_item.data_type?top_item.data_type:
|
|
1872
|
+
top_data_type:top_item.data_type?top_item.data_type:Type.DATA_BLANK,
|
|
1835
1873
|
parent_id:parent_item.id?parent_item.id:0,
|
|
1836
|
-
parent_data_type:parent_item.data_type?parent_item.data_type:
|
|
1874
|
+
parent_data_type:parent_item.data_type?parent_item.data_type:Type.DATA_BLANK,
|
|
1837
1875
|
title:item_title,
|
|
1838
1876
|
title_url:Str.get_title_url(item_title),
|
|
1839
1877
|
description:"Description "+String(Num.get_id()),
|
|
@@ -1846,7 +1884,7 @@ class Sub_Item_Logic {
|
|
|
1846
1884
|
return item;
|
|
1847
1885
|
}
|
|
1848
1886
|
static get_test_items(parent_item,top_item,option){
|
|
1849
|
-
option = Field_Logic.get_option(
|
|
1887
|
+
option = Field_Logic.get_option(Type.DATA_SUB_ITEM,option?option:{});
|
|
1850
1888
|
let items = [];
|
|
1851
1889
|
for(let a=0;a<option.item_count;a++){
|
|
1852
1890
|
let item_title ="Item " + String(parseInt(a+1));
|
|
@@ -1913,8 +1951,8 @@ class App_Logic {
|
|
|
1913
1951
|
return get_cloud_url_main(app_id,url,action_url,param);
|
|
1914
1952
|
};
|
|
1915
1953
|
static get_new = (title,user_id,type,option) =>{
|
|
1916
|
-
option = Field_Logic.get_option(
|
|
1917
|
-
let app = DataItem.get_new(
|
|
1954
|
+
option = Field_Logic.get_option(Type.DATA_APP,option?option:{});
|
|
1955
|
+
let app = DataItem.get_new(Type.DATA_APP,0);
|
|
1918
1956
|
app.title = title;
|
|
1919
1957
|
app.user_id = user_id;
|
|
1920
1958
|
app.type = type;
|
|
@@ -1923,9 +1961,27 @@ class App_Logic {
|
|
|
1923
1961
|
static get_search = (data_type,filter,sort_by,page_current,page_size) => {
|
|
1924
1962
|
return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
|
|
1925
1963
|
}
|
|
1964
|
+
static get_join = (type,search,field,image,title) => {
|
|
1965
|
+
type = type ? type : Type.TITLE_ITEMS;
|
|
1966
|
+
search = search ? search : App_Logic.get_search(Type.DATA_BLANK,{},{},1,0);
|
|
1967
|
+
field = field ? field : {};
|
|
1968
|
+
image = image ? image : {};
|
|
1969
|
+
title = title ? title : '';
|
|
1970
|
+
return {type:type,search:search,field:field,image:image,title:title};
|
|
1971
|
+
}
|
|
1972
|
+
static get_foreign = (type,foreign_data_type,foreign_field,parent_field,field,image,title) => {
|
|
1973
|
+
type = type ? type : Type.TITLE_ITEMS;
|
|
1974
|
+
foreign_data_type = foreign_data_type ? foreign_data_type : DataType.BLANK;
|
|
1975
|
+
foreign_field = foreign_field ? foreign_field : Type.FIELD_PARENT_ID;
|
|
1976
|
+
parent_field = parent_field ? parent_field : parent_field;
|
|
1977
|
+
field = field ? field : {};
|
|
1978
|
+
image = image ? image : {};
|
|
1979
|
+
title = title ? title : '';
|
|
1980
|
+
return {type:type,foreign_data_type:foreign_data_type,parent_field:parent_field,field:field,image:image,title:title};
|
|
1981
|
+
}
|
|
1926
1982
|
static get_not_found = (data_type,id,option) =>{
|
|
1927
1983
|
option=option?option:{};
|
|
1928
|
-
if(data_type !=
|
|
1984
|
+
if(data_type != Type.DATA_USER){
|
|
1929
1985
|
if(!id){
|
|
1930
1986
|
id=0;
|
|
1931
1987
|
}
|
|
@@ -1955,7 +2011,7 @@ class App_Logic {
|
|
|
1955
2011
|
if(search.data_type){
|
|
1956
2012
|
url = url + "&data_type="+search.data_type;
|
|
1957
2013
|
}else{
|
|
1958
|
-
url = url + "&data_type="+
|
|
2014
|
+
url = url + "&data_type="+Type.DATA_BLANK;
|
|
1959
2015
|
}
|
|
1960
2016
|
if(search.sort_by_key){
|
|
1961
2017
|
url = url + "&sort_by_key="+search.sort_by_key;
|
|
@@ -2001,7 +2057,7 @@ class App_Logic {
|
|
|
2001
2057
|
static get_data_search_result = (app_id,data_type,item_count,page_count,filter,items,option) =>{
|
|
2002
2058
|
return{
|
|
2003
2059
|
option:option?option:{},
|
|
2004
|
-
data_type:data_type?data_type:
|
|
2060
|
+
data_type:data_type?data_type:Type.DATA_BLANK,
|
|
2005
2061
|
item_count:item_count?item_count:0,
|
|
2006
2062
|
page_count:page_count?page_count:1,
|
|
2007
2063
|
filter:filter?filter:{},
|
|
@@ -2026,7 +2082,7 @@ class File_Logic {
|
|
|
2026
2082
|
return host+"/"+size + "_"+file_filename+param;
|
|
2027
2083
|
}
|
|
2028
2084
|
static get_new_by_base64 = (item_file) =>{
|
|
2029
|
-
let item = DataItem.get_new(
|
|
2085
|
+
let item = DataItem.get_new(Type.DATA_FILE,0,item_file);
|
|
2030
2086
|
item.extension = !Str.check_is_null(Str.get_file_type_from_base64(item.file_data)) ? Str.get_file_type_from_base64(item.file_data).extension : 'txt';
|
|
2031
2087
|
item.file_filename = !Str.check_is_null(Str.get_file_type_from_base64(item.file_data)) ? Str.get_guid()+ "." + item.extension : 'not_found.txt';
|
|
2032
2088
|
item.buffer = !Str.check_is_null(Str.get_file_type_from_base64(item_file.file_data)) ? Buffer.from(item_file.file_data.split(';base64,').pop(), 'base64') : null;
|
|
@@ -2050,7 +2106,7 @@ class Image_Logic {
|
|
|
2050
2106
|
return host+"/"+size + "_"+image_filename+param;
|
|
2051
2107
|
}
|
|
2052
2108
|
static get_new_by_base64 = (item_image) =>{
|
|
2053
|
-
let item = DataItem.get_new(
|
|
2109
|
+
let item = DataItem.get_new(Type.DATA_IMAGE,0,item_image);
|
|
2054
2110
|
item.extension = !Str.check_is_null(Str.get_file_type_from_base64(item.image_data)) ? Str.get_file_type_from_base64(item.image_data).extension : 'jpeg';
|
|
2055
2111
|
item.image_filename = !Str.check_is_null(Str.get_file_type_from_base64(item.image_data)) ? Str.get_guid()+ "." + item.extension : 'not_found.jpeg';
|
|
2056
2112
|
item.buffer = !Str.check_is_null(Str.get_file_type_from_base64(item_image.image_data)) ? Buffer.from(item_image.image_data.split(';base64,').pop(), 'base64') : null;
|
|
@@ -2112,6 +2168,7 @@ class Url {
|
|
|
2112
2168
|
static CART_POST="item/cart_post";
|
|
2113
2169
|
//cms
|
|
2114
2170
|
static CMS_DEMO_POST="cms/demo_post";
|
|
2171
|
+
static CMS_GET="cms/get";
|
|
2115
2172
|
static CMS_POST="cms/post";
|
|
2116
2173
|
static CMS_ITEM_PARENT_TOP_TYPE_CATEGORY="cms/item_parent_top_type_category";
|
|
2117
2174
|
static CMS_SEARCH_ITEM_TYPE_CATEGORY="cms/search_item_type_category";
|
|
@@ -2194,7 +2251,6 @@ module.exports = {
|
|
|
2194
2251
|
Category_Logic,
|
|
2195
2252
|
Content_Logic,
|
|
2196
2253
|
DataItem,
|
|
2197
|
-
DataType,
|
|
2198
2254
|
Demo_Logic,
|
|
2199
2255
|
Event_Logic,
|
|
2200
2256
|
File_Logic,
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const series = require('async-series');
|
|
2
|
-
const {DataItem,
|
|
2
|
+
const {DataItem,Type,App_Logic} = require('./index');
|
|
3
3
|
const {Log,Num,Str,Obj} = require('biz9-utility');
|
|
4
4
|
const {Scriptz}= require('biz9-scriptz');
|
|
5
5
|
|
|
@@ -31,11 +31,13 @@ describe("connect", () => {
|
|
|
31
31
|
series([
|
|
32
32
|
function(call) {
|
|
33
33
|
console.log('CONNECT-BASE-START');
|
|
34
|
-
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
let
|
|
38
|
-
|
|
34
|
+
// -->
|
|
35
|
+
let parent_item = DataItem.get_new(Type.DATA_PRODUCT,0);
|
|
36
|
+
// -->
|
|
37
|
+
let join = App_Logic.get_join({},'','',{});
|
|
38
|
+
// -->
|
|
39
|
+
Log.w('99_join',join);
|
|
40
|
+
//Log.w('99_result',parent_item);
|
|
39
41
|
|
|
40
42
|
|
|
41
43
|
//Log.w('Title',Type.get_title(Type.ORDER_STATUS_NEW));
|
|
@@ -54,7 +56,7 @@ describe("connect", () => {
|
|
|
54
56
|
/*
|
|
55
57
|
function(call) {
|
|
56
58
|
console.log('CONNECT-CMS-DEMO-START');
|
|
57
|
-
let category_type =
|
|
59
|
+
let category_type = Type.DATA_PRODUCT;
|
|
58
60
|
let category_count = 12;
|
|
59
61
|
let item_count = 500;
|
|
60
62
|
|
|
@@ -82,11 +84,11 @@ describe("connect", () => {
|
|
|
82
84
|
/*
|
|
83
85
|
function(call) {
|
|
84
86
|
//console.log('CONNECT-START');
|
|
85
|
-
//let post_cart = Cart_Logic.get_new(
|
|
87
|
+
//let post_cart = Cart_Logic.get_new(Type.DATA_PRODUCT,0,);
|
|
86
88
|
//let post_cart_list = [];
|
|
87
|
-
//let post_cart_item = Cart_Logic.get_new_cart_item(
|
|
88
|
-
//let post_cart_sub_item = Cart_Logic.get_new_cart_sub_item(
|
|
89
|
-
//let post_cart_sub_item_2 = Cart_Logic.get_new_cart_sub_item(
|
|
89
|
+
//let post_cart_item = Cart_Logic.get_new_cart_item(Type.DATA_PRODUCT,123,post_cart.cart_number,1,30);
|
|
90
|
+
//let post_cart_sub_item = Cart_Logic.get_new_cart_sub_item(Type.DATA_PRODUCT,1234,post_cart.cart_number,1,10);
|
|
91
|
+
//let post_cart_sub_item_2 = Cart_Logic.get_new_cart_sub_item(Type.DATA_PRODUCT,1234,post_cart.cart_number,1,30);
|
|
90
92
|
//post_cart_item.cart_sub_item_list.push(post_cart_sub_item);
|
|
91
93
|
//post_cart_item.cart_sub_item_list.push(post_cart_sub_item_2);
|
|
92
94
|
//post_cart.cart_item_list.push(post_cart_item);
|