biz9-logic 4.8.27 → 4.8.32
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 +91 -8
- package/package.json +1 -1
- package/test.js +32 -31
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -128,7 +128,7 @@ class Page_Logic {
|
|
|
128
128
|
option = Field_Logic.get_option(DataType.PAGE,option?option:{});
|
|
129
129
|
let item_list = [];
|
|
130
130
|
for(let a=0;a<option.page_count;a++){
|
|
131
|
-
item_list.push(Page_Logic.get_test("Page " +parseInt(a+1),option));
|
|
131
|
+
item_list.push(Page_Logic.get_test( "Page " +parseInt(a+1)? !option.get_blank : "",option));
|
|
132
132
|
}
|
|
133
133
|
return item_list;
|
|
134
134
|
}
|
|
@@ -342,19 +342,27 @@ class Event_Logic {
|
|
|
342
342
|
}
|
|
343
343
|
class Field_Logic {
|
|
344
344
|
static get_test = (title,option) =>{
|
|
345
|
+
let sub_note = "Sub Note "+String(Number.get_id());
|
|
346
|
+
let note = "Note "+String(Number.get_id());
|
|
345
347
|
if(!option){
|
|
346
348
|
option= {};
|
|
347
349
|
}
|
|
348
350
|
if(!option.category_title){
|
|
349
351
|
option.category_title = 'Category '+String(Number.get_id());
|
|
350
352
|
}
|
|
353
|
+
if(option.get_blank == true){
|
|
354
|
+
title = "";
|
|
355
|
+
sub_note = "";
|
|
356
|
+
note = "";
|
|
357
|
+
option.category_title = "";
|
|
358
|
+
}
|
|
351
359
|
let item = {
|
|
352
360
|
title:title,
|
|
353
361
|
setting_visible:"1",
|
|
354
362
|
title_url:Str.get_title_url(title),
|
|
355
363
|
category:option.category_title,
|
|
356
|
-
sub_note:
|
|
357
|
-
note:
|
|
364
|
+
sub_note:sub_note,
|
|
365
|
+
note:note
|
|
358
366
|
}
|
|
359
367
|
if(option.get_value){
|
|
360
368
|
item = Field_Logic.get_value_list(item,option);
|
|
@@ -363,12 +371,41 @@ class Field_Logic {
|
|
|
363
371
|
}
|
|
364
372
|
static get_value_list(item,option){
|
|
365
373
|
for(let b=0;b<option.value_count;b++){
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
374
|
+
if(option.get_blank == false){
|
|
375
|
+
item['value_'+String(b+1)] = 'value ' + String(b+1);
|
|
376
|
+
item['field_'+String(b+1)] = Str.get_title_url(item['value_'+String(b+1)]);
|
|
377
|
+
item[Str.get_title_url('value ' + String(b+1))] = item.title + ' value ' + String(b+1);
|
|
378
|
+
}else{
|
|
379
|
+
item['value_'+String(b+1)] = "";
|
|
380
|
+
item['field_'+String(b+1)] = "";
|
|
381
|
+
item[Str.get_title_url('value ' + String(b+1))] ="";
|
|
382
|
+
}
|
|
369
383
|
}
|
|
370
384
|
return item;
|
|
371
385
|
};
|
|
386
|
+
static get_option_admin(req){
|
|
387
|
+
let option = {};
|
|
388
|
+
option.category_product_count = req.query.category_product_count?parseInt(req.query.category_product_count): 9;
|
|
389
|
+
option.product_count = req.query.product_count?parseInt(req.query.product_count): 19;
|
|
390
|
+
option.category_blog_post_count = req.query.category_blog_post_count?parseInt(req.query.category_blog_post_count): 9;
|
|
391
|
+
option.blog_post_count = req.query.blog_post_count?parseInt(req.query.blog_post_count): 19;
|
|
392
|
+
option.category_service_count = req.query.category_service_count?parseInt(req.query.category_service_count): 9;
|
|
393
|
+
option.service_count = req.query.service_count?parseInt(req.query.service_count): 19;
|
|
394
|
+
option.category_event_count = req.query.category_event_count?parseInt(req.query.category_event_count): 9;
|
|
395
|
+
option.event_count = req.query.event_count?parseInt(req.query.event_count): 19;
|
|
396
|
+
|
|
397
|
+
option.get_admin = req.query.get_admin?String(req.query.get_admin)=='true': false;
|
|
398
|
+
option.get_business = req.query.get_business?String(req.query.get_business)=='true': false;
|
|
399
|
+
option.get_blog_post = req.query.get_blog_post?String(req.query.get_blog_post)=='true': false;
|
|
400
|
+
option.get_event = req.query.get_event?String(req.query.get_event)=='true': false;
|
|
401
|
+
option.get_faq = req.query.get_faq?String(req.query.get_faq)=='true': false;
|
|
402
|
+
option.get_template = req.query.get_template?String(req.query.get_template)=='true': false;
|
|
403
|
+
option.get_page = req.query.get_page?String(req.query.get_page)=='true': false;
|
|
404
|
+
option.get_product = req.query.get_product?String(req.query.get_product)=='true': false;
|
|
405
|
+
option.get_service = req.query.get_service?String(req.query.get_service)=='true': false;
|
|
406
|
+
option.get_team = req.query.get_team?String(req.query.get_team)=='true': false;
|
|
407
|
+
return option;
|
|
408
|
+
}
|
|
372
409
|
static get_option(data_type,option){
|
|
373
410
|
if(!data_type){
|
|
374
411
|
data_type = DataType.BLANK;
|
|
@@ -400,6 +437,9 @@ class Field_Logic {
|
|
|
400
437
|
if(!option.category_title){
|
|
401
438
|
option.category_title=null;
|
|
402
439
|
}
|
|
440
|
+
if(!option.get_blank){
|
|
441
|
+
option.get_blank=false;
|
|
442
|
+
}
|
|
403
443
|
if(option.data_type==DataType.PAGE){
|
|
404
444
|
if(!option.page_count){
|
|
405
445
|
option.page_count=9;
|
|
@@ -489,16 +529,54 @@ class Social {
|
|
|
489
529
|
static LINKEDIN_URL="https://linkedin.com/";
|
|
490
530
|
}
|
|
491
531
|
class PageType {
|
|
532
|
+
static get_title = (data_type) => {
|
|
533
|
+
if(!data_type){
|
|
534
|
+
return "";
|
|
535
|
+
}else{
|
|
536
|
+
return String(Str.get_title(data_type.replaceAll('_',' '))).trim();
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
static get_item_list = () =>{
|
|
540
|
+
return [
|
|
541
|
+
{title:DataType.get_title(PageType.ABOUT),type:DataType.ABOUT},
|
|
542
|
+
{title:DataType.get_title(PageType.BLOG_POST),type:DataType.BLOG_POST},
|
|
543
|
+
{title:DataType.get_title(PageType.CONTACT),type:DataType.CONTACT},
|
|
544
|
+
{title:DataType.get_title(PageType.EVENT),type:DataType.EVENT},
|
|
545
|
+
{title:DataType.get_title(PageType.GALLERY),type:DataType.GALLERY},
|
|
546
|
+
{title:DataType.get_title(PageType.HOME),type:DataType.HOME},
|
|
547
|
+
{title:DataType.get_title(PageType.TEAM),type:DataType.TEAM},
|
|
548
|
+
{title:DataType.get_title(PageType.PRODUCT),type:DataType.PRODUCT},
|
|
549
|
+
{title:DataType.get_title(PageType.SERVICE),type:DataType.SERVICE}
|
|
550
|
+
]
|
|
551
|
+
};
|
|
492
552
|
static HOME='home';
|
|
493
553
|
static ABOUT='about';
|
|
494
554
|
static CONTACT='contact';
|
|
555
|
+
|
|
495
556
|
static BLOG_POST='blog_post';
|
|
496
|
-
static
|
|
557
|
+
static BLOG_POST_BROWSE='blog_post_browse';
|
|
558
|
+
static BLOG_POST_DETAIL='blog_post_detail';
|
|
559
|
+
|
|
497
560
|
static EVENT='event';
|
|
561
|
+
static EVENT_BROWSE='event_browse';
|
|
562
|
+
static EVENT_DETAIL='event_detail';
|
|
563
|
+
|
|
564
|
+
static GALLERY='gallery';
|
|
565
|
+
static GALLERY_BROWSE='gallery_browse';
|
|
566
|
+
static GALLERY_DETAIL='gallery_detail';
|
|
567
|
+
|
|
498
568
|
static SERVICE='service';
|
|
569
|
+
static SERVICE_BROWSE='service_browse';
|
|
570
|
+
static SERVICE_DETAIL='service_detail';
|
|
571
|
+
|
|
499
572
|
static PRODUCT='product';
|
|
573
|
+
static PRODUCT_BROWSE='product_browse';
|
|
574
|
+
static PRODUCT_DETAIL='product_detail';
|
|
575
|
+
|
|
500
576
|
static PROJECT='project';
|
|
501
|
-
static
|
|
577
|
+
static PROJECT_BROWSE='project_browse';
|
|
578
|
+
static PROJECT_DETAIL='project_detail';
|
|
579
|
+
|
|
502
580
|
static SECTION_1='section_1';
|
|
503
581
|
static SECTION_2='section_2';
|
|
504
582
|
static SECTION_3='section_2';
|
|
@@ -916,6 +994,10 @@ class Page_Url {
|
|
|
916
994
|
let action_url="page/get/"+title_url;
|
|
917
995
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
918
996
|
};
|
|
997
|
+
static home = (biz9_config,params) => {
|
|
998
|
+
let action_url=PageType.get_title(PageType.HOME);
|
|
999
|
+
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
1000
|
+
};
|
|
919
1001
|
}
|
|
920
1002
|
class Team_Url {
|
|
921
1003
|
static get = (biz9_config,title_url,params) => {
|
|
@@ -1404,6 +1486,7 @@ module.exports = {
|
|
|
1404
1486
|
Message,
|
|
1405
1487
|
Obj,
|
|
1406
1488
|
Page_Logic,
|
|
1489
|
+
Page_Url,
|
|
1407
1490
|
Product_Url,
|
|
1408
1491
|
PageType,
|
|
1409
1492
|
Product_Logic,
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const series = require('async-series');
|
|
3
|
-
const {DataItem,DataType,Url,Obj,BiZ_Url,Cat,Stock,Schedule,Storage,Business,Product,Service,Event,Template,Page,Category,Review,Blog_Post,Faq_Logic,Category_Url,Blank_Url,Blank_Logic,Item_Logic,Service_Logic,Template_Logic,Page_Logic,Product_Logic,Event_Logic,Blog_Post_Logic,Content_Logic,Category_Logic,Team_Logic,Business_Logic} = require('./index');
|
|
3
|
+
const {DataItem,DataType,Url,Obj,BiZ_Url,Cat,Stock,Schedule,Storage,Business,Product,Service,Event,Template,Page,Category,Review,Blog_Post,Faq_Logic,Category_Url,Blank_Url,Blank_Logic,Item_Logic,Service_Logic,Template_Logic,Page_Logic,Product_Logic,Event_Logic,Blog_Post_Logic,Content_Logic,Category_Logic,Team_Logic,Business_Logic,PageType,Page_Url} = require('./index');
|
|
4
4
|
const {Log,Number} = require('biz9-utility');
|
|
5
5
|
const {Scriptz}= require('biz9-scriptz');
|
|
6
6
|
|
|
7
7
|
/* --- TEST CONFIG START --- */
|
|
8
8
|
//const ID='0';
|
|
9
9
|
const ID='f23c2372-df8e-4c09-a919-677fe32ba0bb';
|
|
10
|
-
const
|
|
10
|
+
const APP_ID='cool_bean';
|
|
11
11
|
const DATA_TYPE='dt_blank';
|
|
12
12
|
const URL="http://localhost:1901";
|
|
13
13
|
const biz9_config ={
|
|
14
14
|
SERVICE_HOST_TYPE:'multiple',
|
|
15
|
-
|
|
15
|
+
URL:'http://localhost:1901',
|
|
16
|
+
APP_ID:APP_ID,
|
|
16
17
|
MONGO_IP:'0.0.0.0',
|
|
17
18
|
MONGO_USERNAME_PASSWORD:'',
|
|
18
19
|
MONGO_PORT_ID:"27019",
|
|
@@ -29,23 +30,40 @@ describe("connect", () => {
|
|
|
29
30
|
it("_connect", () => {
|
|
30
31
|
series([
|
|
31
32
|
|
|
32
|
-
/*
|
|
33
33
|
function(call) {
|
|
34
|
-
console.log('GET-URL-START');
|
|
35
|
-
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
34
|
+
//console.log('GET-URL-START');
|
|
35
|
+
//let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
36
36
|
//let action_url = 'test_get_url';
|
|
37
37
|
//let params = '&myparam1=p1&myparam2=p2'
|
|
38
|
-
let data_type = DataType.PRODUCT;
|
|
39
|
-
let id = "123";
|
|
40
|
-
//let cloud_url =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
//
|
|
38
|
+
//let data_type = DataType.PRODUCT;
|
|
39
|
+
//let id = "123";
|
|
40
|
+
//let cloud_url = Page_Url.home(biz9_config);
|
|
41
|
+
//console.log(biz9_config);
|
|
42
|
+
//let cloud_url = Category_Url.get_page(biz9_config,'cool');
|
|
43
|
+
//let cloud_url = Category_Url.get_page(biz9_config,'cool');
|
|
44
|
+
//Log.w('cloud_url',cloud_url);
|
|
45
|
+
//console.log('GET-URL-SUCCESS');
|
|
46
|
+
call();
|
|
45
47
|
},
|
|
46
|
-
*/
|
|
47
48
|
|
|
48
49
|
function(call) {
|
|
50
|
+
/* --PAGE--START */
|
|
51
|
+
//let page = Page_Logic.get_test()
|
|
52
|
+
//let page = Page_Logic.get_test("Page "+Number.get_id())
|
|
53
|
+
let page = Page_Logic.get_test("Page "+Number.get_id(),{get_value:true,value_count:5,get_section:false,section_count:2})
|
|
54
|
+
Log.w("page",page);
|
|
55
|
+
//Log.w("page_section_1",page.section_1);
|
|
56
|
+
//Log.w("page_section_6",page.section_6.items);
|
|
57
|
+
//Log.w("page_section_1_section_1",page.section_1.section_1);
|
|
58
|
+
//let page_list = Page_Logic.get_test_list({page_count:10});
|
|
59
|
+
//Log.w("Page_list",page_list);
|
|
60
|
+
/*
|
|
61
|
+
let page = Page.get_test({item_count:9,page_count:19,get_item:true,get_value:true})
|
|
62
|
+
//let page = Page.get_test()
|
|
63
|
+
Log.w("Page_section_1_section_1_section_1",page.section_1.section_1.section_1);
|
|
64
|
+
*/
|
|
65
|
+
/* --PAGE--END */
|
|
66
|
+
|
|
49
67
|
|
|
50
68
|
/* --TEAM--START */
|
|
51
69
|
//let team = Team_Logic.get_test()
|
|
@@ -144,23 +162,6 @@ describe("connect", () => {
|
|
|
144
162
|
/* --PRODUCT--END */
|
|
145
163
|
|
|
146
164
|
|
|
147
|
-
/* --PAGE--START */
|
|
148
|
-
//let page = Page_Logic.get_test()
|
|
149
|
-
//let page = Page_Logic.get_test("Page "+Number.get_id())
|
|
150
|
-
let page = Page_Logic.get_test("Page "+Number.get_id(),{get_value:true,value_count:5,get_section:true,section_count:20})
|
|
151
|
-
Log.w("page",page);
|
|
152
|
-
Log.w("page_section_1",page.section_1);
|
|
153
|
-
Log.w("page_section_6",page.section_6.items);
|
|
154
|
-
//Log.w("page_section_1_section_1",page.section_1.section_1);
|
|
155
|
-
//let page_list = Page_Logic.get_test_list({page_count:10});
|
|
156
|
-
//Log.w("Page_list",page_list);
|
|
157
|
-
/*
|
|
158
|
-
let page = Page.get_test({item_count:9,page_count:19,get_item:true,get_value:true})
|
|
159
|
-
//let page = Page.get_test()
|
|
160
|
-
Log.w("Page_section_1_section_1_section_1",page.section_1.section_1.section_1);
|
|
161
|
-
*/
|
|
162
|
-
/* --PAGE--END */
|
|
163
|
-
|
|
164
165
|
|
|
165
166
|
/* --ITEM-TEST--START */
|
|
166
167
|
//let item = Item_Logic.get_test("Item_" +Number.get_id(),DataType.SERVICE,0);
|