biz9-logic 10.0.24 → 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 +207 -154
- 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';
|
|
@@ -237,6 +272,7 @@ class Type {
|
|
|
237
272
|
static FIELD_ROLE = 'role';
|
|
238
273
|
static FIELD_SOURCE='source';
|
|
239
274
|
static FIELD_SOURCE_DATA_TYPE='source_data_type';
|
|
275
|
+
static FIELD_SOURCE_KEY='source_key';
|
|
240
276
|
static FIELD_SOURCE_ID='source_id';
|
|
241
277
|
static FIELD_SOURCE_PARENT_ID='source_parent_id';
|
|
242
278
|
static FIELD_SETTING_VISIBLE = 'setting_visible';
|
|
@@ -270,6 +306,7 @@ class Type {
|
|
|
270
306
|
static TITLE_COUNT='count';
|
|
271
307
|
static TITLE_GROUP='group';
|
|
272
308
|
static TITLE_N_A='n/a';
|
|
309
|
+
static TITLE_IMAGES='images';
|
|
273
310
|
static TITLE_ITEMS='items';
|
|
274
311
|
static TITLE_OBJ='obj';
|
|
275
312
|
static TITLE_ORDER_ITEMS='order_items';
|
|
@@ -422,30 +459,30 @@ class Type {
|
|
|
422
459
|
};
|
|
423
460
|
static get_data_types = () =>{
|
|
424
461
|
return [
|
|
425
|
-
{title:Type.get_title(
|
|
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(
|
|
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}
|
|
435
472
|
]
|
|
436
473
|
};
|
|
437
474
|
static get_types = () =>{
|
|
438
475
|
return [
|
|
439
|
-
{title:Type.get_title(
|
|
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(
|
|
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}
|
|
449
486
|
]
|
|
450
487
|
};
|
|
451
488
|
static get_app_environments = () =>{
|
|
@@ -573,39 +610,39 @@ class Type {
|
|
|
573
610
|
case Type.ORDER_PAYMENT_METHOD_CASH:
|
|
574
611
|
case Type.ORDER_PAYMENT_METHOD_OTHER:
|
|
575
612
|
case Type.ORDER_PAYMENT_METHOD_TEST:
|
|
576
|
-
case
|
|
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
|
|
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:
|
|
609
646
|
r_type = String(Str.get_title(type.replaceAll('_',' ').replaceAll('dt','').replace('biz',''))).trim();
|
|
610
647
|
break;
|
|
611
648
|
default:
|
|
@@ -628,11 +665,11 @@ class Type {
|
|
|
628
665
|
};
|
|
629
666
|
}
|
|
630
667
|
class Stat_Logic {
|
|
631
|
-
static get_new = (parent_data_type,parent_id,
|
|
632
|
-
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,
|
|
633
670
|
{
|
|
634
671
|
user_id:user_id,
|
|
635
|
-
|
|
672
|
+
type:type,
|
|
636
673
|
parent_data_type:parent_data_type,
|
|
637
674
|
parent_id:parent_id
|
|
638
675
|
});
|
|
@@ -666,8 +703,8 @@ class Stat_Logic {
|
|
|
666
703
|
class Page_Logic {
|
|
667
704
|
static get_test = (title,option) =>{
|
|
668
705
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
669
|
-
option = Field_Logic.get_option(
|
|
670
|
-
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));
|
|
671
708
|
if(option.get_section){
|
|
672
709
|
page.items = Sub_Item_Logic.get_test_sections(page,page,option);
|
|
673
710
|
page = Sub_Item_Logic.bind_parent_child_items(page,page.items);
|
|
@@ -675,7 +712,7 @@ static get_test = (title,option) =>{
|
|
|
675
712
|
return page;
|
|
676
713
|
};
|
|
677
714
|
static get_test_items = (option) =>{
|
|
678
|
-
option = Field_Logic.get_option(
|
|
715
|
+
option = Field_Logic.get_option(Type.DATA_PAGE,option?option:{});
|
|
679
716
|
let items = [];
|
|
680
717
|
for(let a=0;a<parseInt(option.page_count)+1;a++){
|
|
681
718
|
items.push(Page_Logic.get_test( "Page " +parseInt(a+1)? !option.get_blank : "",option));
|
|
@@ -686,7 +723,7 @@ static get_test = (title,option) =>{
|
|
|
686
723
|
class Order_Logic {
|
|
687
724
|
static get_new = (cart,option) => {
|
|
688
725
|
option = option?option:{get_payment_plan:false,payment_plan:Title.ORDER_PAYMENT_PLAN_1};
|
|
689
|
-
let order = DataItem.get_new(
|
|
726
|
+
let order = DataItem.get_new(Type.DATA_ORDER,0,{
|
|
690
727
|
order_number:Title.ORDER_NUMBER + Num.get_id(99999),
|
|
691
728
|
parent_data_type:cart.parent_data_type,
|
|
692
729
|
user_id:cart.user_id,
|
|
@@ -710,7 +747,7 @@ class Order_Logic {
|
|
|
710
747
|
order.payment_plan = option.payment_plan;
|
|
711
748
|
}
|
|
712
749
|
cart.cart_items.forEach(cart_item => {
|
|
713
|
-
let order_item = DataItem.get_new(
|
|
750
|
+
let order_item = DataItem.get_new(Type.DATA_ORDER_ITEM,0,{
|
|
714
751
|
order_number:order.order_number,
|
|
715
752
|
parent_data_type:cart_item.parent_data_type,
|
|
716
753
|
parent_id:cart_item.parent_id,
|
|
@@ -731,7 +768,7 @@ class Order_Logic {
|
|
|
731
768
|
}
|
|
732
769
|
}
|
|
733
770
|
cart_item.cart_sub_items.forEach(cart_sub_item => {
|
|
734
|
-
let order_sub_item = DataItem.get_new(
|
|
771
|
+
let order_sub_item = DataItem.get_new(Type.DATA_ORDER_SUB_ITEM,0,{
|
|
735
772
|
order_number:order.order_number,
|
|
736
773
|
parent_data_type:cart_sub_item.parent_data_type,
|
|
737
774
|
parent_id:cart_sub_item.parent_id,
|
|
@@ -757,7 +794,7 @@ class Order_Logic {
|
|
|
757
794
|
return order;
|
|
758
795
|
};
|
|
759
796
|
static get_new_order_payment = (order_number,payment_method_type,payment_amount) => {
|
|
760
|
-
return DataItem.get_new(
|
|
797
|
+
return DataItem.get_new(Type.DATA_ORDER_PAYMENT,0,
|
|
761
798
|
{
|
|
762
799
|
order_number:order_number,
|
|
763
800
|
payment_method_type:payment_method_type,
|
|
@@ -787,13 +824,13 @@ class Order_Logic {
|
|
|
787
824
|
}
|
|
788
825
|
class Cart_Logic {
|
|
789
826
|
static get_new = (parent_data_type,user_id) => {
|
|
790
|
-
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:[]});
|
|
791
828
|
};
|
|
792
829
|
static get_new_cart_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
|
|
793
|
-
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:[]});
|
|
794
831
|
};
|
|
795
832
|
static get_new_cart_sub_item = (parent_data_type,parent_id,cart_number,quanity,cost) =>{
|
|
796
|
-
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});
|
|
797
834
|
};
|
|
798
835
|
static get_total = (cart) => {
|
|
799
836
|
let grand_total = 0;
|
|
@@ -818,7 +855,7 @@ class Cart_Logic {
|
|
|
818
855
|
class Product_Logic {
|
|
819
856
|
static get_new = (title,type,category,option) => {
|
|
820
857
|
option = option ? option : {};
|
|
821
|
-
const item = Item_Logic.get_new(title,
|
|
858
|
+
const item = Item_Logic.get_new(title,Type.DATA_PRODUCT);
|
|
822
859
|
item.type = type;
|
|
823
860
|
item.category = category = category?category:"";
|
|
824
861
|
return item;
|
|
@@ -855,8 +892,8 @@ static get_new = (title,type,category,option) => {
|
|
|
855
892
|
};
|
|
856
893
|
static get_test = (title,option) =>{
|
|
857
894
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
858
|
-
option = Field_Logic.get_option(
|
|
859
|
-
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));
|
|
860
897
|
if(option.get_blank ==false){
|
|
861
898
|
product.cost = Field_Logic.get_test_cost();
|
|
862
899
|
product.old_cost = Field_Logic.get_test_cost();
|
|
@@ -881,8 +918,8 @@ static get_new = (title,type,category,option) => {
|
|
|
881
918
|
};
|
|
882
919
|
static get_test_cart = (cart_number,user_id,option) =>{
|
|
883
920
|
[cart_number,option] = ield_Logic.get_option_title(cart_number,option);
|
|
884
|
-
option = Field_Logic.get_option(
|
|
885
|
-
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));
|
|
886
923
|
cart.user_id = user_id;
|
|
887
924
|
cart.cart_number = cart_number;
|
|
888
925
|
if(option.get_cart_item){
|
|
@@ -898,7 +935,7 @@ static get_new = (title,type,category,option) => {
|
|
|
898
935
|
return cart;
|
|
899
936
|
};
|
|
900
937
|
static get_test_items = (option) =>{
|
|
901
|
-
option = Field_Logic.get_option(
|
|
938
|
+
option = Field_Logic.get_option(Type.DATA_PRODUCT,option?option:{});
|
|
902
939
|
let items = [];
|
|
903
940
|
for(let a=0;a<option.product_count+1;a++){
|
|
904
941
|
items.push(Product_Logic.get_test("Product "+String(parseInt(a+1)),option));
|
|
@@ -906,9 +943,9 @@ static get_new = (title,type,category,option) => {
|
|
|
906
943
|
return items;
|
|
907
944
|
}
|
|
908
945
|
static get_test_items_by_category = (option) =>{
|
|
909
|
-
option = Field_Logic.get_option(
|
|
946
|
+
option = Field_Logic.get_option(Type.DATA_PRODUCT,option?option:{});
|
|
910
947
|
let products = [];
|
|
911
|
-
let categorys = Category_Logic.get_type_categorys(
|
|
948
|
+
let categorys = Category_Logic.get_type_categorys(Type.DATA_PRODUCT,option.category_count);
|
|
912
949
|
let item_count = 0;
|
|
913
950
|
for(let a=0;a<categorys.length;a++){
|
|
914
951
|
for(let b=0;b<option.product_count;b++){
|
|
@@ -947,8 +984,8 @@ class Service_Logic {
|
|
|
947
984
|
};
|
|
948
985
|
static get_test = (title,option) =>{
|
|
949
986
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
950
|
-
option = Field_Logic.get_option(
|
|
951
|
-
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));
|
|
952
989
|
service.cost = Field_Logic.get_test_cost();
|
|
953
990
|
service.old_cost = Field_Logic.get_test_cost();
|
|
954
991
|
service.type = "Type "+String(Num.get_id());
|
|
@@ -961,7 +998,7 @@ class Service_Logic {
|
|
|
961
998
|
return service;
|
|
962
999
|
};
|
|
963
1000
|
static get_test_items = (option) =>{
|
|
964
|
-
option = Field_Logic.get_option(
|
|
1001
|
+
option = Field_Logic.get_option(Type.DATA_SERVICE,option?option:{});
|
|
965
1002
|
let items = [];
|
|
966
1003
|
for(let a=0;a<parseInt(option.service_count)+1;a++){
|
|
967
1004
|
items.push(Service_Logic.get_test("Service "+String(parseInt(a+1)),option));
|
|
@@ -969,9 +1006,9 @@ class Service_Logic {
|
|
|
969
1006
|
return items;
|
|
970
1007
|
}
|
|
971
1008
|
static get_test_items_by_category = (option) =>{
|
|
972
|
-
option = Field_Logic.get_option(
|
|
1009
|
+
option = Field_Logic.get_option(Type.DATA_SERVICE,option?option:{});
|
|
973
1010
|
let services = [];
|
|
974
|
-
let categorys = Category_Logic.get_type_categorys(
|
|
1011
|
+
let categorys = Category_Logic.get_type_categorys(Type.DATA_SERVICE,option.category_count);
|
|
975
1012
|
let item_count = 0;
|
|
976
1013
|
for(let a=0;a<categorys.length;a++){
|
|
977
1014
|
for(let b=0;b<parseInt(option.service_count);b++){
|
|
@@ -987,8 +1024,8 @@ class Service_Logic {
|
|
|
987
1024
|
class Content_Logic {
|
|
988
1025
|
static get_test = (title,option) =>{
|
|
989
1026
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
990
|
-
option = Field_Logic.get_option(
|
|
991
|
-
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));
|
|
992
1029
|
if(option.get_item){
|
|
993
1030
|
content.items = Sub_Item_Logic.get_test_sections(content,content,option);
|
|
994
1031
|
if(option.get_item_bind){
|
|
@@ -998,7 +1035,7 @@ class Content_Logic {
|
|
|
998
1035
|
return content;
|
|
999
1036
|
};
|
|
1000
1037
|
static get_test_items = (option) =>{
|
|
1001
|
-
option = Field_Logic.get_option(
|
|
1038
|
+
option = Field_Logic.get_option(Type.DATA_CONTENT,option?option:{});
|
|
1002
1039
|
let items = [];
|
|
1003
1040
|
for(let a=0;a<parseInt(option.content_count)+1;a++){
|
|
1004
1041
|
items.push(Content_Logic.get_test("Content " +String(parseInt(a+1)),option));
|
|
@@ -1006,9 +1043,9 @@ class Content_Logic {
|
|
|
1006
1043
|
return items;
|
|
1007
1044
|
}
|
|
1008
1045
|
static get_test_items_by_category = (option) =>{
|
|
1009
|
-
option = Field_Logic.get_option(
|
|
1046
|
+
option = Field_Logic.get_option(Type.DATA_CONTENT,option?option:{});
|
|
1010
1047
|
let contents = [];
|
|
1011
|
-
let categorys = Category_Logic.get_type_categorys(
|
|
1048
|
+
let categorys = Category_Logic.get_type_categorys(Type.DATA_CONTENT,option.category_count);
|
|
1012
1049
|
let item_count = 0;
|
|
1013
1050
|
for(let a=0;a<categorys.length;a++){
|
|
1014
1051
|
for(let b=0;b<parseInt(option.content_count);b++){
|
|
@@ -1024,16 +1061,16 @@ class Content_Logic {
|
|
|
1024
1061
|
class Template_Logic {
|
|
1025
1062
|
static get_test = (title,option) =>{
|
|
1026
1063
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1027
|
-
option = Field_Logic.get_option(
|
|
1028
|
-
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));
|
|
1029
1066
|
return template;
|
|
1030
1067
|
};
|
|
1031
1068
|
}
|
|
1032
1069
|
class Blog_Post_Logic {
|
|
1033
1070
|
static get_test = (title,option) =>{
|
|
1034
1071
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1035
|
-
option = Field_Logic.get_option(
|
|
1036
|
-
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));
|
|
1037
1074
|
if(!option.get_blank){
|
|
1038
1075
|
blog_post.author="First Name "+ Num.get_id();
|
|
1039
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();
|
|
@@ -1047,7 +1084,7 @@ class Blog_Post_Logic {
|
|
|
1047
1084
|
return blog_post;
|
|
1048
1085
|
};
|
|
1049
1086
|
static get_test_items = (option) =>{
|
|
1050
|
-
option = Field_Logic.get_option(
|
|
1087
|
+
option = Field_Logic.get_option(Type.DATA_BLOG_POST,option?option:{});
|
|
1051
1088
|
let items = [];
|
|
1052
1089
|
for(let a=0;a<parseInt(option.blog_post_count)+1;a++){
|
|
1053
1090
|
items.push(Blog_Post_Logic.get_test("Blog Post " +String(parseInt(a+1)),option));
|
|
@@ -1055,9 +1092,9 @@ class Blog_Post_Logic {
|
|
|
1055
1092
|
return items;
|
|
1056
1093
|
}
|
|
1057
1094
|
static get_test_items_by_category = (option) =>{
|
|
1058
|
-
option = Field_Logic.get_option(
|
|
1095
|
+
option = Field_Logic.get_option(Type.DATA_BLOG_POST,option?option:{});
|
|
1059
1096
|
let blog_posts = [];
|
|
1060
|
-
let categorys = Category_Logic.get_type_categorys(
|
|
1097
|
+
let categorys = Category_Logic.get_type_categorys(Type.DATA_BLOG_POST,option.category_count);
|
|
1061
1098
|
let item_count = 0;
|
|
1062
1099
|
for(let a=0;a<categorys.length;a++){
|
|
1063
1100
|
for(let b=0;b<parseInt(option.blog_post_count);b++){
|
|
@@ -1073,8 +1110,8 @@ class Blog_Post_Logic {
|
|
|
1073
1110
|
class Gallery_Logic {
|
|
1074
1111
|
static get_test = (title,option) =>{
|
|
1075
1112
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1076
|
-
option = Field_Logic.get_option(
|
|
1077
|
-
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));
|
|
1078
1115
|
if(!option.get_blank){
|
|
1079
1116
|
gallery.date = String(String(Num.get_id(2030)) + "-" + String(Num.get_id(13)) + "-" + String(Num.get_id(30))).trim();
|
|
1080
1117
|
gallery.time = String(Num.get_id(24)) + ":" + String(Num.get_id(59));
|
|
@@ -1118,8 +1155,8 @@ class Event_Logic {
|
|
|
1118
1155
|
};
|
|
1119
1156
|
static get_test = (title,option) =>{
|
|
1120
1157
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1121
|
-
option = Field_Logic.get_option(
|
|
1122
|
-
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));
|
|
1123
1160
|
if(!option.get_blank){
|
|
1124
1161
|
event.cost = Field_Logic.get_test_cost();
|
|
1125
1162
|
event.old_cost = Field_Logic.get_test_cost();
|
|
@@ -1149,7 +1186,7 @@ class Event_Logic {
|
|
|
1149
1186
|
return event;
|
|
1150
1187
|
};
|
|
1151
1188
|
static get_test_items = (option) =>{
|
|
1152
|
-
option = Field_Logic.get_option(
|
|
1189
|
+
option = Field_Logic.get_option(Type.DATA_EVENT,option?option:{});
|
|
1153
1190
|
let items = [];
|
|
1154
1191
|
for(let a=0;a<parseInt(option.event_count)+1;a++){
|
|
1155
1192
|
items.push(Event_Logic.get_test("Event "+String(parseInt(a+1)),option));
|
|
@@ -1157,9 +1194,9 @@ class Event_Logic {
|
|
|
1157
1194
|
return items;
|
|
1158
1195
|
}
|
|
1159
1196
|
static get_test_items_by_category = (option) =>{
|
|
1160
|
-
option = Field_Logic.get_option(
|
|
1197
|
+
option = Field_Logic.get_option(Type.DATA_EVENT,option?option:{});
|
|
1161
1198
|
let events = [];
|
|
1162
|
-
let categorys = Category_Logic.get_type_categorys(
|
|
1199
|
+
let categorys = Category_Logic.get_type_categorys(Type.DATA_EVENT,option.category_count);
|
|
1163
1200
|
let item_count = 0;
|
|
1164
1201
|
for(let a=0;a<categorys.length;a++){
|
|
1165
1202
|
for(let b=0;b<parseInt(option.event_count);b++){
|
|
@@ -1357,7 +1394,7 @@ class Field_Logic {
|
|
|
1357
1394
|
return item;
|
|
1358
1395
|
};
|
|
1359
1396
|
static get_option(data_type,option){
|
|
1360
|
-
data_type = data_type ? data_type :
|
|
1397
|
+
data_type = data_type ? data_type : Type.DATA_BLANK;
|
|
1361
1398
|
option = !Obj.check_is_empty(option) ? option : {get_value:false,get_item:false,get_image:false,item_count:9,value_count:9};
|
|
1362
1399
|
option.generate_id = option.generate_id ? option.generate_id : false;
|
|
1363
1400
|
option.get_image = option.get_image ? true : false;
|
|
@@ -1371,36 +1408,36 @@ class Field_Logic {
|
|
|
1371
1408
|
option.category_count = option.category_count ? option.category_count : 9;
|
|
1372
1409
|
option.category_title = option.category_title ? option.category_title : "";
|
|
1373
1410
|
option.fields = option.fields ? option.fields : [];
|
|
1374
|
-
if(option.data_type==
|
|
1411
|
+
if(option.data_type==Type.DATA_PAGE){
|
|
1375
1412
|
option.page_count = option.page_count ? option.page_count : 9;
|
|
1376
1413
|
option.section_count = option.section_count ? option.section_count : 9;
|
|
1377
1414
|
option.get_section = option.get_section ? true : false;
|
|
1378
1415
|
}
|
|
1379
|
-
if(data_type==
|
|
1416
|
+
if(data_type==Type.DATA_PRODUCT){
|
|
1380
1417
|
option.product_count = option.product_count ? option.product_count : 9;
|
|
1381
1418
|
}
|
|
1382
|
-
if(data_type==
|
|
1419
|
+
if(data_type==Type.DATA_SERVICE){
|
|
1383
1420
|
option.service_count = option.service_count ? option.service_count : 9;
|
|
1384
1421
|
}
|
|
1385
|
-
if(data_type==
|
|
1422
|
+
if(data_type==Type.DATA_BLOG_POST){
|
|
1386
1423
|
option.blog_post_count = option.blog_post_count ? option.blog_post_count : 9;
|
|
1387
1424
|
}
|
|
1388
|
-
if(data_type==
|
|
1425
|
+
if(data_type==Type.DATA_EVENT){
|
|
1389
1426
|
option.event_count = option.event_count ? option.event_count : 9;
|
|
1390
1427
|
}
|
|
1391
|
-
if(data_type==
|
|
1428
|
+
if(data_type==Type.DATA_FAQ){
|
|
1392
1429
|
option.question_count = option.question_count ? option.question_count : 9;
|
|
1393
1430
|
}
|
|
1394
|
-
if(data_type==
|
|
1431
|
+
if(data_type==Type.DATA_CONTENT){
|
|
1395
1432
|
option.content_count = option.content_count ? option.content_count : 9;
|
|
1396
1433
|
}
|
|
1397
|
-
if(data_type==
|
|
1434
|
+
if(data_type==Type.DATA_SUB_ITEM){
|
|
1398
1435
|
option.item_count = option.item_count ? option.item_count : 9;
|
|
1399
1436
|
}
|
|
1400
|
-
if(data_type==
|
|
1437
|
+
if(data_type==Type.DATA_USER){
|
|
1401
1438
|
option.user_count = option.user_count ? option.user_count : 9;
|
|
1402
1439
|
}
|
|
1403
|
-
if(data_type==
|
|
1440
|
+
if(data_type==Type.DATA_CART){
|
|
1404
1441
|
option.category_title = option.category_title ? option.category_title : "";
|
|
1405
1442
|
option.value_count = option.value_count ? option.value_count : 9;
|
|
1406
1443
|
option.get_cart_item = option.get_cart_item ? option.get_cart_item : false;
|
|
@@ -1408,13 +1445,13 @@ class Field_Logic {
|
|
|
1408
1445
|
option.get_cart_sub_item = option.get_cart_sub_item ? option.get_cart_sub_item : false;
|
|
1409
1446
|
option.cart_sub_item_count = option.cart_sub_item_count ? option.cart_sub_item_count : 3;
|
|
1410
1447
|
}
|
|
1411
|
-
if(data_type==
|
|
1448
|
+
if(data_type==Type.DATA_CART_ITEM){
|
|
1412
1449
|
option.category_title = option.category_title ? option.category_title : "";
|
|
1413
1450
|
option.value_count = option.value_count ? option.value_count : 9;
|
|
1414
1451
|
option.get_cart_sub_item = option.get_cart_sub_item ? option.get_cart_sub_item : false;
|
|
1415
1452
|
option.cart_sub_item_count = option.cart_sub_item_count ? option.cart_sub_item_count : 1;
|
|
1416
1453
|
}
|
|
1417
|
-
if(data_type==
|
|
1454
|
+
if(data_type==Type.DATA_ORDER){
|
|
1418
1455
|
option.category_title = option.category_title ? option.category_title : "";
|
|
1419
1456
|
option.value_count = option.value_count ? option.value_count : 9;
|
|
1420
1457
|
option.get_order_item = option.get_order_item ? option.get_order_item : false;
|
|
@@ -1422,7 +1459,7 @@ class Field_Logic {
|
|
|
1422
1459
|
option.get_order_sub_item = option.get_order_sub_item ? option.get_order_sub_item : false;
|
|
1423
1460
|
option.order_sub_item_count = option.order_sub_item_count ? option.order_sub_item_count : 3;
|
|
1424
1461
|
}
|
|
1425
|
-
if(data_type==
|
|
1462
|
+
if(data_type==Type.DATA_ORDER_ITEM){
|
|
1426
1463
|
option.category_title = option.category_title ? option.category_title : "";
|
|
1427
1464
|
option.value_count = option.value_count ? option.value_count : 9;
|
|
1428
1465
|
option.get_order_sub_item = option.get_order_sub_item ? option.get_order_sub_item : false;
|
|
@@ -1498,7 +1535,8 @@ class Field_Logic {
|
|
|
1498
1535
|
return option;
|
|
1499
1536
|
}
|
|
1500
1537
|
}
|
|
1501
|
-
|
|
1538
|
+
/*
|
|
1539
|
+
class Type.DATA_{
|
|
1502
1540
|
static APP='app_biz';
|
|
1503
1541
|
static BLANK='blank_biz';
|
|
1504
1542
|
static BLOG_POST='blog_post_biz';
|
|
@@ -1533,9 +1571,10 @@ class DataType {
|
|
|
1533
1571
|
static USER='user_biz';
|
|
1534
1572
|
static VIDEO='video_biz';
|
|
1535
1573
|
}
|
|
1574
|
+
*/
|
|
1536
1575
|
class Favorite_Logic {
|
|
1537
1576
|
static get_new = (parent_data_type,parent_id,user_id) =>{
|
|
1538
|
-
return DataItem.get_new(
|
|
1577
|
+
return DataItem.get_new(Type.DATA_FAVORITE,0,{
|
|
1539
1578
|
parent_data_type:parent_data_type,
|
|
1540
1579
|
parent_id:parent_id,
|
|
1541
1580
|
user_id:user_id
|
|
@@ -1559,7 +1598,7 @@ class Favorite_Logic {
|
|
|
1559
1598
|
}
|
|
1560
1599
|
class Review_Logic {
|
|
1561
1600
|
static get_new = (parent_data_type,parent_id,user_id,title,comment,rating) =>{
|
|
1562
|
-
return DataItem.get_new(
|
|
1601
|
+
return DataItem.get_new(Type.DATA_REVIEW,0,{
|
|
1563
1602
|
parent_data_type:parent_data_type,
|
|
1564
1603
|
parent_id:parent_id,
|
|
1565
1604
|
user_id:user_id,
|
|
@@ -1583,8 +1622,8 @@ class Review_Logic {
|
|
|
1583
1622
|
] };
|
|
1584
1623
|
}
|
|
1585
1624
|
static get_test = (item_data_type,item_id,user_id,option) =>{
|
|
1586
|
-
option = Field_Logic.get_option(
|
|
1587
|
-
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);
|
|
1588
1627
|
if(!option.get_blank){
|
|
1589
1628
|
review.title = 'Title ' + Num.get_id();
|
|
1590
1629
|
review.item_data_type = item_data_type;
|
|
@@ -1615,18 +1654,18 @@ class Admin_Logic {
|
|
|
1615
1654
|
static get_new = (title,option) =>{
|
|
1616
1655
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1617
1656
|
return DataItem.get_new_full_item(
|
|
1618
|
-
DataItem.get_new(
|
|
1619
|
-
DataItem.get_new(
|
|
1620
|
-
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),{
|
|
1621
1660
|
title:title,
|
|
1622
1661
|
email:"",
|
|
1623
1662
|
});
|
|
1624
1663
|
};
|
|
1625
1664
|
static get_test = (title,option) =>{
|
|
1626
1665
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1627
|
-
option = Field_Logic.get_option(
|
|
1628
|
-
let item = DataItem.get_new(
|
|
1629
|
-
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));
|
|
1630
1669
|
if(!option.get_blank){
|
|
1631
1670
|
admin.email="ceo@admin"+Num.get_id()+".com";
|
|
1632
1671
|
admin.password="1234567";
|
|
@@ -1656,22 +1695,22 @@ class DataItem {
|
|
|
1656
1695
|
class Category_Logic {
|
|
1657
1696
|
static get_new = (title,type,category,option) => {
|
|
1658
1697
|
option = option ? option : {};
|
|
1659
|
-
const item = Item_Logic.get_new(title,
|
|
1698
|
+
const item = Item_Logic.get_new(title,Type.DATA_CATEGORY);
|
|
1660
1699
|
item.type = type;
|
|
1661
1700
|
item.category = category = category?category:"";
|
|
1662
1701
|
return item;
|
|
1663
1702
|
};
|
|
1664
1703
|
static get_test = (title,option) =>{
|
|
1665
1704
|
title = (title) ? title : "Category 1";
|
|
1666
|
-
option = Field_Logic.get_option(
|
|
1667
|
-
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));
|
|
1668
1707
|
if(option.get_item){
|
|
1669
1708
|
category.items = Sub_Item_Logic.get_test_items(category,category,option);
|
|
1670
1709
|
}
|
|
1671
1710
|
return category;
|
|
1672
1711
|
};
|
|
1673
1712
|
static get_test_items = (option) =>{
|
|
1674
|
-
option = Field_Logic.get_option(
|
|
1713
|
+
option = Field_Logic.get_option(Type.DATA_CATEGORY,option);
|
|
1675
1714
|
let items = [];
|
|
1676
1715
|
for(let a=0;a<option.category_count;a++){
|
|
1677
1716
|
items.push(Category_Logic.get_test("Category " +String(parseInt(a+1)),option));
|
|
@@ -1679,10 +1718,10 @@ class Category_Logic {
|
|
|
1679
1718
|
return items;
|
|
1680
1719
|
}
|
|
1681
1720
|
static get_test_items_by_type = (type,option) =>{
|
|
1682
|
-
option = Field_Logic.get_option(
|
|
1721
|
+
option = Field_Logic.get_option(Type.DATA_CATEGORY,option);
|
|
1683
1722
|
let categorys = [];
|
|
1684
1723
|
for(let a=0;a<option.category_count;a++){
|
|
1685
|
-
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));
|
|
1686
1725
|
category.type = type;
|
|
1687
1726
|
categorys.push(category);
|
|
1688
1727
|
}
|
|
@@ -1774,11 +1813,11 @@ class User_Logic {
|
|
|
1774
1813
|
|
|
1775
1814
|
}
|
|
1776
1815
|
static get_guest(){
|
|
1777
|
-
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"});
|
|
1778
1817
|
}
|
|
1779
1818
|
static get_request_user(req){
|
|
1780
1819
|
if(!req || !req.session.user){
|
|
1781
|
-
let user=DataItem.get_new(
|
|
1820
|
+
let user=DataItem.get_new(Type.DATA_USER,Num.get_id(9999999),{is_guest:true});
|
|
1782
1821
|
req.session.user=user;
|
|
1783
1822
|
}
|
|
1784
1823
|
return req.session.user;
|
|
@@ -1792,8 +1831,8 @@ class User_Logic {
|
|
|
1792
1831
|
}
|
|
1793
1832
|
static get_test = (title,option) =>{
|
|
1794
1833
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
1795
|
-
option = Field_Logic.get_option(
|
|
1796
|
-
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,
|
|
1797
1836
|
Field_Logic.get_test(title,option));
|
|
1798
1837
|
if(option.get_blank){
|
|
1799
1838
|
user.first_name="";
|
|
@@ -1815,7 +1854,7 @@ class User_Logic {
|
|
|
1815
1854
|
return user;
|
|
1816
1855
|
};
|
|
1817
1856
|
static get_test_items = (option) =>{
|
|
1818
|
-
option = Field_Logic.get_option(
|
|
1857
|
+
option = Field_Logic.get_option(Type.DATA_USER,option?option:{});
|
|
1819
1858
|
let items = [];
|
|
1820
1859
|
for(let a=0;a<option.user_count+1;a++){
|
|
1821
1860
|
items.push(User_Logic.get_test("User " +String(parseInt(a+1)),option));
|
|
@@ -1825,14 +1864,14 @@ class User_Logic {
|
|
|
1825
1864
|
}
|
|
1826
1865
|
class Sub_Item_Logic {
|
|
1827
1866
|
static get_test(title,parent_item,top_item,option){
|
|
1828
|
-
option = Field_Logic.get_option(
|
|
1867
|
+
option = Field_Logic.get_option(Type.DATA_ITEM,option?option:{});
|
|
1829
1868
|
let item_title =title;
|
|
1830
1869
|
let item = DataItem.get_new(
|
|
1831
|
-
|
|
1870
|
+
Type.DATA_ITEM,0, {
|
|
1832
1871
|
top_id:top_item.id?top_item.id:0,
|
|
1833
|
-
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,
|
|
1834
1873
|
parent_id:parent_item.id?parent_item.id:0,
|
|
1835
|
-
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,
|
|
1836
1875
|
title:item_title,
|
|
1837
1876
|
title_url:Str.get_title_url(item_title),
|
|
1838
1877
|
description:"Description "+String(Num.get_id()),
|
|
@@ -1845,7 +1884,7 @@ class Sub_Item_Logic {
|
|
|
1845
1884
|
return item;
|
|
1846
1885
|
}
|
|
1847
1886
|
static get_test_items(parent_item,top_item,option){
|
|
1848
|
-
option = Field_Logic.get_option(
|
|
1887
|
+
option = Field_Logic.get_option(Type.DATA_SUB_ITEM,option?option:{});
|
|
1849
1888
|
let items = [];
|
|
1850
1889
|
for(let a=0;a<option.item_count;a++){
|
|
1851
1890
|
let item_title ="Item " + String(parseInt(a+1));
|
|
@@ -1912,8 +1951,8 @@ class App_Logic {
|
|
|
1912
1951
|
return get_cloud_url_main(app_id,url,action_url,param);
|
|
1913
1952
|
};
|
|
1914
1953
|
static get_new = (title,user_id,type,option) =>{
|
|
1915
|
-
option = Field_Logic.get_option(
|
|
1916
|
-
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);
|
|
1917
1956
|
app.title = title;
|
|
1918
1957
|
app.user_id = user_id;
|
|
1919
1958
|
app.type = type;
|
|
@@ -1922,9 +1961,27 @@ class App_Logic {
|
|
|
1922
1961
|
static get_search = (data_type,filter,sort_by,page_current,page_size) => {
|
|
1923
1962
|
return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
|
|
1924
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
|
+
}
|
|
1925
1982
|
static get_not_found = (data_type,id,option) =>{
|
|
1926
1983
|
option=option?option:{};
|
|
1927
|
-
if(data_type !=
|
|
1984
|
+
if(data_type != Type.DATA_USER){
|
|
1928
1985
|
if(!id){
|
|
1929
1986
|
id=0;
|
|
1930
1987
|
}
|
|
@@ -1954,7 +2011,7 @@ class App_Logic {
|
|
|
1954
2011
|
if(search.data_type){
|
|
1955
2012
|
url = url + "&data_type="+search.data_type;
|
|
1956
2013
|
}else{
|
|
1957
|
-
url = url + "&data_type="+
|
|
2014
|
+
url = url + "&data_type="+Type.DATA_BLANK;
|
|
1958
2015
|
}
|
|
1959
2016
|
if(search.sort_by_key){
|
|
1960
2017
|
url = url + "&sort_by_key="+search.sort_by_key;
|
|
@@ -2000,7 +2057,7 @@ class App_Logic {
|
|
|
2000
2057
|
static get_data_search_result = (app_id,data_type,item_count,page_count,filter,items,option) =>{
|
|
2001
2058
|
return{
|
|
2002
2059
|
option:option?option:{},
|
|
2003
|
-
data_type:data_type?data_type:
|
|
2060
|
+
data_type:data_type?data_type:Type.DATA_BLANK,
|
|
2004
2061
|
item_count:item_count?item_count:0,
|
|
2005
2062
|
page_count:page_count?page_count:1,
|
|
2006
2063
|
filter:filter?filter:{},
|
|
@@ -2025,7 +2082,7 @@ class File_Logic {
|
|
|
2025
2082
|
return host+"/"+size + "_"+file_filename+param;
|
|
2026
2083
|
}
|
|
2027
2084
|
static get_new_by_base64 = (item_file) =>{
|
|
2028
|
-
let item = DataItem.get_new(
|
|
2085
|
+
let item = DataItem.get_new(Type.DATA_FILE,0,item_file);
|
|
2029
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';
|
|
2030
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';
|
|
2031
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;
|
|
@@ -2049,7 +2106,7 @@ class Image_Logic {
|
|
|
2049
2106
|
return host+"/"+size + "_"+image_filename+param;
|
|
2050
2107
|
}
|
|
2051
2108
|
static get_new_by_base64 = (item_image) =>{
|
|
2052
|
-
let item = DataItem.get_new(
|
|
2109
|
+
let item = DataItem.get_new(Type.DATA_IMAGE,0,item_image);
|
|
2053
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';
|
|
2054
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';
|
|
2055
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;
|
|
@@ -2065,7 +2122,6 @@ class Image_Logic {
|
|
|
2065
2122
|
size:0,
|
|
2066
2123
|
type_resize:Type.IMAGE_RESIZE_NONE,
|
|
2067
2124
|
},
|
|
2068
|
-
/*
|
|
2069
2125
|
{
|
|
2070
2126
|
image_filename:Type.IMAGE_SIZE_THUMB+"_"+image_filename,
|
|
2071
2127
|
path_filename:upload_dir+"/"+Type.IMAGE_SIZE_THUMB+"_"+image_filename,
|
|
@@ -2078,7 +2134,6 @@ class Image_Logic {
|
|
|
2078
2134
|
size:720,
|
|
2079
2135
|
type_resize:Type.IMAGE_RESIZE_NORMAL,
|
|
2080
2136
|
},
|
|
2081
|
-
*/
|
|
2082
2137
|
{
|
|
2083
2138
|
image_filename:Type.IMAGE_SIZE_LARGE+"_"+image_filename,
|
|
2084
2139
|
path_filename:upload_dir+"/"+Type.IMAGE_SIZE_LARGE+"_"+image_filename,
|
|
@@ -2097,14 +2152,12 @@ class Image_Logic {
|
|
|
2097
2152
|
size:720,
|
|
2098
2153
|
type_resize:Type.IMAGE_RESIZE_SQUARE,
|
|
2099
2154
|
},
|
|
2100
|
-
/*
|
|
2101
2155
|
{
|
|
2102
2156
|
image_filename:Type.IMAGE_SIZE_SQUARE_LARGE+"_"+image_filename,
|
|
2103
2157
|
path_filename:upload_dir+"/"+Type.IMAGE_SIZE_SQUARE_LARGE+"_"+image_filename,
|
|
2104
2158
|
size:1000,
|
|
2105
2159
|
type_resize:Type.IMAGE_RESIZE_SQUARE,
|
|
2106
2160
|
},
|
|
2107
|
-
*/
|
|
2108
2161
|
];
|
|
2109
2162
|
}
|
|
2110
2163
|
}
|
|
@@ -2115,6 +2168,7 @@ class Url {
|
|
|
2115
2168
|
static CART_POST="item/cart_post";
|
|
2116
2169
|
//cms
|
|
2117
2170
|
static CMS_DEMO_POST="cms/demo_post";
|
|
2171
|
+
static CMS_GET="cms/get";
|
|
2118
2172
|
static CMS_POST="cms/post";
|
|
2119
2173
|
static CMS_ITEM_PARENT_TOP_TYPE_CATEGORY="cms/item_parent_top_type_category";
|
|
2120
2174
|
static CMS_SEARCH_ITEM_TYPE_CATEGORY="cms/search_item_type_category";
|
|
@@ -2197,7 +2251,6 @@ module.exports = {
|
|
|
2197
2251
|
Category_Logic,
|
|
2198
2252
|
Content_Logic,
|
|
2199
2253
|
DataItem,
|
|
2200
|
-
DataType,
|
|
2201
2254
|
Demo_Logic,
|
|
2202
2255
|
Event_Logic,
|
|
2203
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);
|