biz9-logic 4.9.82 → 4.9.91
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 +2 -2
- package/index.js +24 -49
- package/package.json +2 -2
- package/test.js +111 -36
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -205,6 +205,9 @@ class Type {
|
|
|
205
205
|
static DATE_CREATE='date_create';
|
|
206
206
|
static DATE_SAVE='date_save';
|
|
207
207
|
static ID='id';
|
|
208
|
+
static OBJ='obj';
|
|
209
|
+
static LIST='list';
|
|
210
|
+
static COUNT='count';
|
|
208
211
|
static N_A='n/a';
|
|
209
212
|
static USER='user';
|
|
210
213
|
static USER_ID='user_id';
|
|
@@ -318,6 +321,21 @@ class Type {
|
|
|
318
321
|
{value:Type.USER_ROLE_GUEST,label:Title.USER_ROLE_GUEST},
|
|
319
322
|
];
|
|
320
323
|
};
|
|
324
|
+
static get_page_list(){
|
|
325
|
+
return [
|
|
326
|
+
{value:Type.PAGE_ABOUT,label:Title.PAGE_ABOUT},
|
|
327
|
+
{value:Type.PAGE_BLOG_POST,label:Title.PAGE_BLOG_POST},
|
|
328
|
+
{value:Type.PAGE_BLOG_POST_HOME,label:Title.PAGE_BLOG_POST_HOME},
|
|
329
|
+
{value:Type.PAGE_BLOG_POST_SEARCH,label:Title.PAGE_BLOG_POST_SEARCH},
|
|
330
|
+
{value:Type.PAGE_CONTACT,label:Title.PAGE_CONTACT},
|
|
331
|
+
{value:Type.PAGE_EVENT,label:Title.PAGE_EVENT},
|
|
332
|
+
{value:Type.PAGE_FAQ,label:Title.PAGE_FAQ},
|
|
333
|
+
{value:Type.PAGE_GALLERY,label:Title.PAGE_GALLERY},
|
|
334
|
+
{value:Type.PAGE_HOME,label:Title.PAGE_HOME},
|
|
335
|
+
{value:Type.PAGE_PRODUCT,label:Title.PAGE_PRODUCT},
|
|
336
|
+
{value:Type.PAGE_SERVICE,label:Title.PAGE_SERVICE},
|
|
337
|
+
];
|
|
338
|
+
};
|
|
321
339
|
static get_stat_type_list = () =>{
|
|
322
340
|
return [
|
|
323
341
|
{title:Type.get_title(Type.STAT_CART),type:Type.STAT_CART,label:Type.get_title(Type.STAT_CART),value:Type.STAT_CART},
|
|
@@ -576,33 +594,7 @@ class Stat_Logic {
|
|
|
576
594
|
}
|
|
577
595
|
}
|
|
578
596
|
class Page_Logic {
|
|
579
|
-
|
|
580
|
-
return [
|
|
581
|
-
{value:Type.PAGE_ABOUT,label:Title.PAGE_ABOUT},
|
|
582
|
-
|
|
583
|
-
{value:Type.PAGE_BLOG_POST,label:Title.PAGE_BLOG_POST},
|
|
584
|
-
{value:Type.PAGE_BLOG_POST_HOME,label:Title.PAGE_BLOG_POST_HOME},
|
|
585
|
-
{value:Type.PAGE_BLOG_POST_SEARCH,label:Title.PAGE_BLOG_POST_SEARCH},
|
|
586
|
-
|
|
587
|
-
{value:Type.PAGE_CONTACT,label:Title.PAGE_CONTACT},
|
|
588
|
-
{value:Type.PAGE_EVENT,label:Title.PAGE_EVENT},
|
|
589
|
-
{value:Type.PAGE_FAQ,label:Title.PAGE_FAQ},
|
|
590
|
-
{value:Type.PAGE_GALLERY,label:Title.PAGE_GALLERY},
|
|
591
|
-
{value:Type.PAGE_HOME,label:Title.PAGE_HOME},
|
|
592
|
-
{value:Type.PAGE_PRODUCT,label:Title.PAGE_PRODUCT},
|
|
593
|
-
{value:Type.PAGE_SERVICE,label:Title.PAGE_SERVICE},
|
|
594
|
-
];
|
|
595
|
-
};
|
|
596
|
-
/*
|
|
597
|
-
static get_page_title = (data_type) => {
|
|
598
|
-
if(!data_type){
|
|
599
|
-
return "";
|
|
600
|
-
}else{
|
|
601
|
-
return String(Str.get_title(data_type.replaceAll('_',' '))).trim();
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
*/
|
|
605
|
-
static get_test = (title,option) =>{
|
|
597
|
+
static get_test = (title,option) =>{
|
|
606
598
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
607
599
|
option = Field_Logic.get_option(DataType.PAGE,option?option:{});
|
|
608
600
|
let page = DataItem.get_new(DataType.PAGE,0,Field_Logic.get_test(title,option));
|
|
@@ -1122,27 +1114,10 @@ class Field_Logic {
|
|
|
1122
1114
|
{value:'list',label:'List'},
|
|
1123
1115
|
];
|
|
1124
1116
|
};
|
|
1125
|
-
static get_field_value_value = (value_type,item,value_id) =>{
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
case Type.FIELD_VALUE_IMAGE:
|
|
1130
|
-
return !Str.check_is_null(item[Field_Logic.get_field_value_title(value_type,value_id)]) ? item[Field_Logic.get_field_value_title(value_type,value_id)] : "";
|
|
1131
|
-
break;
|
|
1132
|
-
case Type.FIELD_VALUE_LIST:
|
|
1133
|
-
let r_list = [];
|
|
1134
|
-
for(let a=0;a<30;a++){
|
|
1135
|
-
if(!Str.check_is_null(item[Field_Logic.get_field_value_title(value_type,value_id,a+1)])){
|
|
1136
|
-
r_list.push(item[Field_Logic.get_field_value_title(value_type,value_id,a+1)]);
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
return r_list;
|
|
1140
|
-
break;
|
|
1141
|
-
default:
|
|
1142
|
-
return "";
|
|
1143
|
-
};
|
|
1144
|
-
}
|
|
1145
|
-
static get_field_value_title = (value_type,value_id,row_id) =>{
|
|
1117
|
+
static get_field_value_value = (value_type,item,value_id,sub_field_title) =>{
|
|
1118
|
+
return !Str.check_is_null(item[Field_Logic.get_field_value_title(value_type,value_id,sub_field_title)]) ? item[Field_Logic.get_field_value_title(value_type,value_id,sub_field_title)] : "";
|
|
1119
|
+
};
|
|
1120
|
+
static get_field_value_title = (value_type,value_id,sub_field_title) =>{
|
|
1146
1121
|
let type_str = '';
|
|
1147
1122
|
switch(value_type){
|
|
1148
1123
|
case Type.FIELD_VALUE_TEXT:
|
|
@@ -1155,7 +1130,7 @@ class Field_Logic {
|
|
|
1155
1130
|
return 'image'+'_value_'+value_id;
|
|
1156
1131
|
break;
|
|
1157
1132
|
case Type.FIELD_VALUE_LIST:
|
|
1158
|
-
return 'list'+'_value_'+value_id +
|
|
1133
|
+
return 'list'+'_value_'+value_id +"_"+Str.get_title_url(sub_field_title);
|
|
1159
1134
|
break;
|
|
1160
1135
|
default:
|
|
1161
1136
|
return "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "biz9-logic",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.91",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"async-series": "^0.0.1",
|
|
12
|
-
"biz9-scriptz": "^5.8.
|
|
12
|
+
"biz9-scriptz": "^5.8.12",
|
|
13
13
|
"biz9-utility": "^3.8.36",
|
|
14
14
|
"jest": "^29.7.0",
|
|
15
15
|
"moment": "^2.30.1"
|
package/test.js
CHANGED
|
@@ -30,27 +30,102 @@ describe("connect", () => {
|
|
|
30
30
|
it("_connect", () => {
|
|
31
31
|
series([
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
function(call) {
|
|
34
|
+
let my_template = {
|
|
35
|
+
title1: "About Us",
|
|
36
|
+
title2: "aboout_link",
|
|
37
|
+
title3: "Categories",
|
|
38
|
+
title4: "category_link",
|
|
39
|
+
title5: "Create Gigs",
|
|
40
|
+
title6: "gigs_link",
|
|
41
|
+
title7: "Home",
|
|
42
|
+
title8: "home_link",
|
|
43
|
+
title9: "Service",
|
|
44
|
+
title10: "service_link",
|
|
45
|
+
title11: "Faq",
|
|
46
|
+
title12: "faq_link",
|
|
47
|
+
title13: "Contact",
|
|
48
|
+
title14: "contact_link"
|
|
49
|
+
};
|
|
50
|
+
/*
|
|
51
|
+
let my_template = {
|
|
52
|
+
title1: "About Us",
|
|
53
|
+
title2: "aboout_link",
|
|
54
|
+
title3: "about_id",
|
|
55
|
+
title4: "Create Gigs",
|
|
56
|
+
title5: "gigs_link",
|
|
57
|
+
title6: "gigs_id",
|
|
58
|
+
title7: "Service",
|
|
59
|
+
title8: "service_link",
|
|
60
|
+
title9: "service_id",
|
|
61
|
+
title10: "Contact",
|
|
62
|
+
title11: "contact_link",
|
|
63
|
+
title12: "contact_id"
|
|
64
|
+
};
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
value_count = 2;
|
|
68
|
+
let new_list = [];
|
|
69
|
+
let row_count = 1;
|
|
70
|
+
for(let a = 1; a < 90; a++){
|
|
71
|
+
if(!Str.check_is_null(my_template['title'+row_count])){
|
|
72
|
+
let item = {};
|
|
73
|
+
item['value_1'] = my_template['title'+row_count];
|
|
74
|
+
if(value_count >=2){
|
|
75
|
+
item['value_2'] = my_template['title'+Number(row_count+1)];
|
|
76
|
+
}
|
|
77
|
+
if(value_count >=3){
|
|
78
|
+
item['value_3'] = my_template['title'+Number(row_count+2)];
|
|
79
|
+
}
|
|
80
|
+
new_list.push(item);
|
|
81
|
+
row_count = row_count + value_count;
|
|
82
|
+
}else{
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/*--work
|
|
87
|
+
list_value_count = 2;
|
|
88
|
+
let title_row = 1;
|
|
89
|
+
let link_row = 2;
|
|
90
|
+
for(let a = 1; a < 900; a++){
|
|
91
|
+
if(!Str.check_is_null(my_template['title'+title_row])){
|
|
92
|
+
new_list.push(
|
|
93
|
+
{
|
|
94
|
+
value_1:my_template['title'+title_row],
|
|
95
|
+
value_2:my_template['title'+link_row]
|
|
96
|
+
});
|
|
97
|
+
title_row = title_row + list_value_count;
|
|
98
|
+
link_row = title_row + 1;
|
|
99
|
+
}else{
|
|
100
|
+
console.log('bbbbbbbbb');
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
*/
|
|
45
105
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
106
|
+
Log.w('cool',new_list);
|
|
107
|
+
},
|
|
108
|
+
function(call) {
|
|
109
|
+
console.log('CONNECT-BASE-START');
|
|
110
|
+
let data_type = DataType.PRODUCT;
|
|
111
|
+
let id = 0;
|
|
112
|
+
let parent_data_type = DataType.PRODUCT;
|
|
113
|
+
let parent_id = 3334;
|
|
114
|
+
let user_id = 0;
|
|
115
|
+
let item_list = [];
|
|
116
|
+
Log.w('Title',Type.get_title(Type.ORDER_STATUS_NEW));
|
|
117
|
+
Log.w('Title 2',Type.get_title(Type.ORDER_STATUS_COMPLETE));
|
|
118
|
+
//Log.w('item_list',item_list);
|
|
119
|
+
//Log.w('bind_obj_list',App_Logic.bind_item_parent_user_list(item_list));
|
|
120
|
+
|
|
121
|
+
//item.id = 333;
|
|
122
|
+
//item.items = ['a','b'];
|
|
123
|
+
//Log.w('bind_obj',App_Logic.bind_item_parent_user_obj(item,parent_item,user));
|
|
124
|
+
//let stat = Stat_Logic.get_new(parent_data_type,parent_id,Type.STAT_VIEW,user_id,item);
|
|
125
|
+
//Log.w('stat',stat);
|
|
126
|
+
console.log('CONNECT-BASE-END');
|
|
127
|
+
}
|
|
128
|
+
/*
|
|
54
129
|
function(call) {
|
|
55
130
|
console.log('CONNECT-CMS-DEMO-START');
|
|
56
131
|
let category_type = DataType.PRODUCT;
|
|
@@ -64,7 +139,7 @@ describe("connect", () => {
|
|
|
64
139
|
let category_title_list = '';
|
|
65
140
|
|
|
66
141
|
let item_title_list = [];
|
|
67
|
-
|
|
142
|
+
let post_type_list = [];
|
|
68
143
|
let val_category_title = '';
|
|
69
144
|
let cat_max = 0;
|
|
70
145
|
let option = {get_category:true,category_count:category_count,category_data_type:category_type,categorys:val_category_title?val_category_title:null,
|
|
@@ -77,25 +152,25 @@ describe("connect", () => {
|
|
|
77
152
|
}
|
|
78
153
|
console.log('CONNECT-CMS-DEMO-SUCCESS');
|
|
79
154
|
},
|
|
80
|
-
|
|
155
|
+
*/
|
|
81
156
|
/*
|
|
82
157
|
function(call) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
158
|
+
//console.log('CONNECT-START');
|
|
159
|
+
//let post_cart = Cart_Logic.get_new(DataType.PRODUCT,0,);
|
|
160
|
+
//let post_cart_list = [];
|
|
161
|
+
//let post_cart_item = Cart_Logic.get_new_cart_item(DataType.PRODUCT,123,post_cart.cart_number,1,30);
|
|
162
|
+
//let post_cart_sub_item = Cart_Logic.get_new_cart_sub_item(DataType.PRODUCT,1234,post_cart.cart_number,1,10);
|
|
163
|
+
//let post_cart_sub_item_2 = Cart_Logic.get_new_cart_sub_item(DataType.PRODUCT,1234,post_cart.cart_number,1,30);
|
|
164
|
+
//post_cart_item.cart_sub_item_list.push(post_cart_sub_item);
|
|
165
|
+
//post_cart_item.cart_sub_item_list.push(post_cart_sub_item_2);
|
|
166
|
+
//post_cart.cart_item_list.push(post_cart_item);
|
|
92
167
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
168
|
+
//Log.w('post_cart',post_cart);
|
|
169
|
+
//Log.w('post_order',Order_Logic.get_new(post_cart,{get_payment_plan:true,payment_plan:Title.ORDER_PAYMENT_PLAN_1,payment_plan_status:Title.ORDER_PAYMENT_STATUS_OPEN}));
|
|
170
|
+
//Log.w('post_cart_2',Cart_Logic.get_total(post_cart));
|
|
96
171
|
|
|
97
|
-
|
|
98
|
-
|
|
172
|
+
//console.log('CONNECT-END');
|
|
173
|
+
//call();
|
|
99
174
|
},
|
|
100
175
|
/* --- TEST LOGIC - CONNECT - END --- */
|
|
101
176
|
|