biz9-logic 4.8.383 → 4.8.387
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 +60 -22
- package/package.json +1 -1
- package/test.js +8 -2
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -121,6 +121,57 @@ class Title {
|
|
|
121
121
|
static SOCIAL_URL_YOUTUBE="https://youtube.com/";
|
|
122
122
|
static SOCIAL_URL_LINKEDIN="https://linkedin.com/";
|
|
123
123
|
}
|
|
124
|
+
class Demo_Logic {
|
|
125
|
+
static get_new_type = (title,option) => {
|
|
126
|
+
option = option ? option : {get_category:false,category_count:6,categorys:'',category_data_type:DataType.BLANK,get_item:false,items:'',item_data_type:DataType.BLANK,item_count:6};
|
|
127
|
+
const item = Item_Logic.get_new(title,DataType.TYPE);
|
|
128
|
+
if(option.get_category){
|
|
129
|
+
item.categorys = [];
|
|
130
|
+
let category_title_list = [];
|
|
131
|
+
if(option.categorys){
|
|
132
|
+
category_title_list = option.categorys.split(',');
|
|
133
|
+
}else{
|
|
134
|
+
for(let a = 1;a<option.category_count+1;a++){
|
|
135
|
+
category_title_list.push(title + " Category " +a);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
category_title_list.forEach(cat_item => {
|
|
139
|
+
item.categorys.push(Category_Logic.get_new(cat_item,item.title,option.category_data_type));
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
if(option.get_item){
|
|
143
|
+
let item_title_list = [];
|
|
144
|
+
if(option.items){
|
|
145
|
+
item_title_list = option.items.split(',');
|
|
146
|
+
}else{
|
|
147
|
+
for(let a = 0;a<item.categorys.length;a++){
|
|
148
|
+
for(let b = 1;b<option.item_count+1;b++){
|
|
149
|
+
let num = parseInt(a+b);
|
|
150
|
+
item_title_list.push(title+" " +Type.get_title(item.categorys[a].category)+" "+ num);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
for(const cat_item of item.categorys){
|
|
155
|
+
cat_item.items = [];
|
|
156
|
+
for(const item of item_title_list){
|
|
157
|
+
let child_item = Item_Logic.get_new(item,option.item_data_type);
|
|
158
|
+
if(option.item_data_type == DataType.PRODUCT){
|
|
159
|
+
child_item.cost = Num.get_id(9000);
|
|
160
|
+
child_item.old_cost = Num.get_id(90000);
|
|
161
|
+
}
|
|
162
|
+
child_item.type = cat_item.type;
|
|
163
|
+
child_item.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
|
|
164
|
+
child_item.category = cat_item.title;
|
|
165
|
+
child_item.description = "Description "+String(Num.get_id());
|
|
166
|
+
child_item.note = Field_Logic.get_test_note(),
|
|
167
|
+
cat_item.items.push(child_item);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return item;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
124
175
|
class Type {
|
|
125
176
|
//page
|
|
126
177
|
static PAGE_ABOUT='about';
|
|
@@ -219,7 +270,6 @@ class Type {
|
|
|
219
270
|
{title:Type.get_title(DataType.TYPE),type:DataType.TYPE,label:Type.get_title(DataType.TYPE),value:DataType.TYPE}
|
|
220
271
|
]
|
|
221
272
|
};
|
|
222
|
-
|
|
223
273
|
static get_title = (type,option)=>{
|
|
224
274
|
/* option
|
|
225
275
|
* get_lowercase = ex. true,false / def. false
|
|
@@ -458,33 +508,13 @@ class Cart_Logic {
|
|
|
458
508
|
};
|
|
459
509
|
}
|
|
460
510
|
class Product_Logic {
|
|
461
|
-
|
|
462
|
-
option = option ? option : {get_category:false,categorys:''};
|
|
463
|
-
const item = Item_Logic.get_new(title,DataType.TYPE);
|
|
464
|
-
if(option.get_category){
|
|
465
|
-
item.categorys = [];
|
|
466
|
-
let category_title_list = option.categorys.split(',');
|
|
467
|
-
category_title_list.forEach(cat_item => {
|
|
468
|
-
item.categorys.push(Product_Logic.get_new_category(cat_item,item.title,DataType.PRODUCT));
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
return item;
|
|
472
|
-
};
|
|
473
|
-
static get_new_category = (title,type,category,option) => {
|
|
474
|
-
option = option ? option : {};
|
|
475
|
-
const item = Item_Logic.get_new(title,DataType.CATEGORY);
|
|
476
|
-
item.type = type;
|
|
477
|
-
item.category = category = category?category:"";
|
|
478
|
-
return item;
|
|
479
|
-
};
|
|
480
|
-
static get_new_product = (title,type,category,option) => {
|
|
511
|
+
static get_new = (title,type,category,option) => {
|
|
481
512
|
option = option ? option : {};
|
|
482
513
|
const item = Item_Logic.get_new(title,DataType.PRODUCT);
|
|
483
514
|
item.type = type;
|
|
484
515
|
item.category = category = category?category:"";
|
|
485
516
|
return item;
|
|
486
517
|
};
|
|
487
|
-
|
|
488
518
|
static get_stock_list = () => {
|
|
489
519
|
const r_list=
|
|
490
520
|
[
|
|
@@ -1260,6 +1290,13 @@ class DataItem {
|
|
|
1260
1290
|
};
|
|
1261
1291
|
}
|
|
1262
1292
|
class Category_Logic {
|
|
1293
|
+
static get_new = (title,type,category,option) => {
|
|
1294
|
+
option = option ? option : {};
|
|
1295
|
+
const item = Item_Logic.get_new(title,DataType.CATEGORY);
|
|
1296
|
+
item.type = type;
|
|
1297
|
+
item.category = category = category?category:"";
|
|
1298
|
+
return item;
|
|
1299
|
+
};
|
|
1263
1300
|
static get_test = (title,option) =>{
|
|
1264
1301
|
title = (title) ? title : "Category 1";
|
|
1265
1302
|
option = Field_Logic.get_option(DataType.CATEGORY,option?option:{});
|
|
@@ -1766,6 +1803,7 @@ module.exports = {
|
|
|
1766
1803
|
Content_Logic,
|
|
1767
1804
|
DataItem,
|
|
1768
1805
|
DataType,
|
|
1806
|
+
Demo_Logic,
|
|
1769
1807
|
Event_Logic,
|
|
1770
1808
|
Field_Logic,
|
|
1771
1809
|
Favorite_Logic,
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const series = require('async-series');
|
|
2
|
-
const {DataItem,DataType,Page_Logic,Product_Logic,Type,Stat_Logic,Service_Logic,Blog_Post_Logic,Event_Logic} = require('./index');
|
|
2
|
+
const {DataItem,DataType,Page_Logic,Product_Logic,Type,Stat_Logic,Service_Logic,Blog_Post_Logic,Event_Logic,Demo_Logic} = require('./index');
|
|
3
3
|
const {Log,Num} = require('biz9-utility');
|
|
4
4
|
const {Scriptz}= require('biz9-scriptz');
|
|
5
5
|
|
|
@@ -25,12 +25,18 @@ const biz9_config ={
|
|
|
25
25
|
};
|
|
26
26
|
/* --- TEST DATA CONFIG END --- */
|
|
27
27
|
|
|
28
|
+
//9_connect
|
|
28
29
|
describe("connect", () => {
|
|
29
30
|
it("_connect", () => {
|
|
30
31
|
series([
|
|
31
32
|
function(call) {
|
|
32
33
|
console.log('CONNECT-START');
|
|
33
|
-
|
|
34
|
+
let demo_type_1 = Demo_Logic.get_new_type('Computer',{
|
|
35
|
+
get_category:true,category_count:9,category_data_type:DataType.PRODUCT,categorys:'',
|
|
36
|
+
get_item:true,item_count:9,item_data_type:DataType.PRODUCT,items:''});
|
|
37
|
+
Log.w('demo_type_1',demo_type_1);
|
|
38
|
+
Log.w('demo_type_1_categorys',demo_type_1.categorys);
|
|
39
|
+
|
|
34
40
|
console.log('CONNECT-END');
|
|
35
41
|
call();
|
|
36
42
|
},
|