biz9-logic 4.8.26 → 4.8.31
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 +71 -3
- package/package.json +1 -1
- package/test.js +17 -16
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -369,6 +369,31 @@ class Field_Logic {
|
|
|
369
369
|
}
|
|
370
370
|
return item;
|
|
371
371
|
};
|
|
372
|
+
static get_option_admin(req){
|
|
373
|
+
let option = {};
|
|
374
|
+
option.category_product_count = req.query.category_product_count?parseInt(req.query.category_product_count): 9;
|
|
375
|
+
option.product_count = req.query.product_count?parseInt(req.query.product_count): 19;
|
|
376
|
+
option.category_blog_post_count = req.query.category_blog_post_count?parseInt(req.query.category_blog_post_count): 9;
|
|
377
|
+
option.blog_post_count = req.query.blog_post_count?parseInt(req.query.blog_post_count): 19;
|
|
378
|
+
option.category_service_count = req.query.category_service_count?parseInt(req.query.category_service_count): 9;
|
|
379
|
+
option.service_count = req.query.service_count?parseInt(req.query.service_count): 19;
|
|
380
|
+
option.category_event_count = req.query.category_event_count?parseInt(req.query.category_event_count): 9;
|
|
381
|
+
option.event_count = req.query.event_count?parseInt(req.query.event_count): 19;
|
|
382
|
+
|
|
383
|
+
option.get_admin = req.query.get_admin?String(req.query.get_admin)=='true': false;
|
|
384
|
+
option.get_business = req.query.get_business?String(req.query.get_business)=='true': false;
|
|
385
|
+
option.get_blog_post = req.query.get_blog_post?String(req.query.get_blog_post)=='true': false;
|
|
386
|
+
option.get_event = req.query.get_event?String(req.query.get_event)=='true': false;
|
|
387
|
+
option.get_faq = req.query.get_faq?String(req.query.get_faq)=='true': false;
|
|
388
|
+
option.get_template = req.query.get_template?String(req.query.get_template)=='true': false;
|
|
389
|
+
option.get_page = req.query.get_page?String(req.query.get_page)=='true': false;
|
|
390
|
+
option.get_product = req.query.get_product?String(req.query.get_product)=='true': false;
|
|
391
|
+
option.get_service = req.query.get_service?String(req.query.get_service)=='true': false;
|
|
392
|
+
option.get_team = req.query.get_team?String(req.query.get_team)=='true': false;
|
|
393
|
+
|
|
394
|
+
return option;
|
|
395
|
+
|
|
396
|
+
}
|
|
372
397
|
static get_option(data_type,option){
|
|
373
398
|
if(!data_type){
|
|
374
399
|
data_type = DataType.BLANK;
|
|
@@ -489,16 +514,54 @@ class Social {
|
|
|
489
514
|
static LINKEDIN_URL="https://linkedin.com/";
|
|
490
515
|
}
|
|
491
516
|
class PageType {
|
|
517
|
+
static get_title = (data_type) => {
|
|
518
|
+
if(!data_type){
|
|
519
|
+
return "";
|
|
520
|
+
}else{
|
|
521
|
+
return String(Str.get_title(data_type.replaceAll('_',' '))).trim();
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
static get_item_list = () =>{
|
|
525
|
+
return [
|
|
526
|
+
{title:DataType.get_title(PageType.ABOUT),type:DataType.ABOUT},
|
|
527
|
+
{title:DataType.get_title(PageType.BLOG_POST),type:DataType.BLOG_POST},
|
|
528
|
+
{title:DataType.get_title(PageType.CONTACT),type:DataType.CONTACT},
|
|
529
|
+
{title:DataType.get_title(PageType.EVENT),type:DataType.EVENT},
|
|
530
|
+
{title:DataType.get_title(PageType.GALLERY),type:DataType.GALLERY},
|
|
531
|
+
{title:DataType.get_title(PageType.HOME),type:DataType.HOME},
|
|
532
|
+
{title:DataType.get_title(PageType.TEAM),type:DataType.TEAM},
|
|
533
|
+
{title:DataType.get_title(PageType.PRODUCT),type:DataType.PRODUCT},
|
|
534
|
+
{title:DataType.get_title(PageType.SERVICE),type:DataType.SERVICE}
|
|
535
|
+
]
|
|
536
|
+
};
|
|
492
537
|
static HOME='home';
|
|
493
538
|
static ABOUT='about';
|
|
494
539
|
static CONTACT='contact';
|
|
540
|
+
|
|
495
541
|
static BLOG_POST='blog_post';
|
|
496
|
-
static
|
|
542
|
+
static BLOG_POST_BROWSE='blog_post_browse';
|
|
543
|
+
static BLOG_POST_DETAIL='blog_post_detail';
|
|
544
|
+
|
|
497
545
|
static EVENT='event';
|
|
546
|
+
static EVENT_BROWSE='event_browse';
|
|
547
|
+
static EVENT_DETAIL='event_detail';
|
|
548
|
+
|
|
549
|
+
static GALLERY='gallery';
|
|
550
|
+
static GALLERY_BROWSE='gallery_browse';
|
|
551
|
+
static GALLERY_DETAIL='gallery_detail';
|
|
552
|
+
|
|
498
553
|
static SERVICE='service';
|
|
554
|
+
static SERVICE_BROWSE='service_browse';
|
|
555
|
+
static SERVICE_DETAIL='service_detail';
|
|
556
|
+
|
|
499
557
|
static PRODUCT='product';
|
|
558
|
+
static PRODUCT_BROWSE='product_browse';
|
|
559
|
+
static PRODUCT_DETAIL='product_detail';
|
|
560
|
+
|
|
500
561
|
static PROJECT='project';
|
|
501
|
-
static
|
|
562
|
+
static PROJECT_BROWSE='project_browse';
|
|
563
|
+
static PROJECT_DETAIL='project_detail';
|
|
564
|
+
|
|
502
565
|
static SECTION_1='section_1';
|
|
503
566
|
static SECTION_2='section_2';
|
|
504
567
|
static SECTION_3='section_2';
|
|
@@ -916,6 +979,10 @@ class Page_Url {
|
|
|
916
979
|
let action_url="page/get/"+title_url;
|
|
917
980
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
918
981
|
};
|
|
982
|
+
static home = (biz9_config,params) => {
|
|
983
|
+
let action_url=PageType.get_title(PageType.HOME);
|
|
984
|
+
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
985
|
+
};
|
|
919
986
|
}
|
|
920
987
|
class Team_Url {
|
|
921
988
|
static get = (biz9_config,title_url,params) => {
|
|
@@ -977,7 +1044,7 @@ class Url{
|
|
|
977
1044
|
};
|
|
978
1045
|
}
|
|
979
1046
|
class Obj {
|
|
980
|
-
static get_search = (
|
|
1047
|
+
static get_search = (data_type,filter,sort_by,page_current,page_size) => {
|
|
981
1048
|
return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
|
|
982
1049
|
}
|
|
983
1050
|
};
|
|
@@ -1404,6 +1471,7 @@ module.exports = {
|
|
|
1404
1471
|
Message,
|
|
1405
1472
|
Obj,
|
|
1406
1473
|
Page_Logic,
|
|
1474
|
+
Page_Url,
|
|
1407
1475
|
Product_Url,
|
|
1408
1476
|
PageType,
|
|
1409
1477
|
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,24 +30,23 @@ describe("connect", () => {
|
|
|
29
30
|
it("_connect", () => {
|
|
30
31
|
series([
|
|
31
32
|
|
|
32
|
-
/*
|
|
33
33
|
function(call) {
|
|
34
34
|
console.log('GET-URL-START');
|
|
35
|
-
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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);
|
|
43
45
|
console.log('GET-URL-SUCCESS');
|
|
44
46
|
//call()
|
|
45
47
|
},
|
|
46
|
-
*/
|
|
47
48
|
|
|
48
49
|
function(call) {
|
|
49
|
-
|
|
50
50
|
/* --TEAM--START */
|
|
51
51
|
//let team = Team_Logic.get_test()
|
|
52
52
|
//let team = Team_Logic.get_test("Team 1",{get_value:true,get_member:true})
|
|
@@ -145,12 +145,13 @@ describe("connect", () => {
|
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
/* --PAGE--START */
|
|
148
|
+
console.log(PageType.get_title(PageType.BLOG_POST));
|
|
148
149
|
//let page = Page_Logic.get_test()
|
|
149
150
|
//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);
|
|
151
|
+
//let page = Page_Logic.get_test("Page "+Number.get_id(),{get_value:true,value_count:5,get_section:true,section_count:20})
|
|
152
|
+
//Log.w("page",page);
|
|
153
|
+
//Log.w("page_section_1",page.section_1);
|
|
154
|
+
//Log.w("page_section_6",page.section_6.items);
|
|
154
155
|
//Log.w("page_section_1_section_1",page.section_1.section_1);
|
|
155
156
|
//let page_list = Page_Logic.get_test_list({page_count:10});
|
|
156
157
|
//Log.w("Page_list",page_list);
|