biz9-logic 4.8.64 → 4.8.66
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 +55 -31
- package/package.json +1 -1
- package/test.js +11 -6
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -43,6 +43,9 @@ class Item_Logic {
|
|
|
43
43
|
}
|
|
44
44
|
return item_list;
|
|
45
45
|
}
|
|
46
|
+
static get_search = (data_type,filter,sort_by,page_current,page_size) => {
|
|
47
|
+
return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
|
|
48
|
+
}
|
|
46
49
|
static get_search_query(search){
|
|
47
50
|
let url = "";
|
|
48
51
|
if(search.data_type){
|
|
@@ -91,9 +94,6 @@ class Item_Logic {
|
|
|
91
94
|
}
|
|
92
95
|
return Item_Logic.get_search(query.data_type,filter,sort_by,query.page_current,query.page_size);
|
|
93
96
|
}
|
|
94
|
-
static get_search = (data_type,filter,sort_by,page_current,page_size) => {
|
|
95
|
-
return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
|
|
96
|
-
}
|
|
97
97
|
}
|
|
98
98
|
class Template_Logic {
|
|
99
99
|
static get_test = (title,option) =>{
|
|
@@ -113,7 +113,7 @@ class Template_Logic {
|
|
|
113
113
|
template.items = [];
|
|
114
114
|
for(let a = 0; a<title_list.length;a++){
|
|
115
115
|
let item = Sub_Item_Logic.get_test(title_list[a],template,template,option);
|
|
116
|
-
item.items = Sub_Item_Logic.
|
|
116
|
+
item.items = Sub_Item_Logic.get_test_section_list(item,template,option);
|
|
117
117
|
item = Sub_Item_Logic.bind_parent_child_list(item,item.items);
|
|
118
118
|
template.items.push(item);
|
|
119
119
|
//template.items.push(Sub_Item_Logic.get_test(title_list[a],template,template,option));
|
|
@@ -213,12 +213,14 @@ class Product_Logic {
|
|
|
213
213
|
product.type = "Type "+String(Number.get_id());
|
|
214
214
|
product.sub_type = "Sub Type "+String(Number.get_id());
|
|
215
215
|
product.stock = String(Number.get_id(3-1));
|
|
216
|
+
product.tag = "Tag "+ Number.get_id() + ", Tag "+Number.get_id() + ", Tag "+ Number.get_id();
|
|
216
217
|
}else{
|
|
217
218
|
product.cost = "";
|
|
218
219
|
product.old_cost = "";
|
|
219
220
|
product.type = "";
|
|
220
221
|
product.sub_type = "";
|
|
221
222
|
product.stock = "";
|
|
223
|
+
product.tag = "";
|
|
222
224
|
}
|
|
223
225
|
if(option.get_item){
|
|
224
226
|
product.items = Sub_Item_Logic.get_test_list(product,product,option);
|
|
@@ -263,6 +265,7 @@ class Service_Logic {
|
|
|
263
265
|
service.type = "Type "+String(Number.get_id());
|
|
264
266
|
service.sub_type = "Sub Type "+String(Number.get_id());
|
|
265
267
|
service.stock = String(Number.get_id(3-1));
|
|
268
|
+
service.tag = "Tag "+ Number.get_id() + ", Tag "+Number.get_id() + ", Tag "+ Number.get_id();
|
|
266
269
|
if(option.get_item){
|
|
267
270
|
service.items = Sub_Item_Logic.get_test_list(service,service,option);
|
|
268
271
|
}
|
|
@@ -343,7 +346,7 @@ class Blog_Post_Logic {
|
|
|
343
346
|
DataItem.get_new(DataType.BLOG_POST,0),
|
|
344
347
|
Field_Logic.get_test(title,option));
|
|
345
348
|
blog_post.author="First Name "+ Number.get_id();
|
|
346
|
-
blog_post.tag="
|
|
349
|
+
blog_post.tag = "Tag "+ Number.get_id() + ", Tag "+Number.get_id() + ", Tag "+ Number.get_id();
|
|
347
350
|
if(option.get_item){
|
|
348
351
|
blog_post.items = Sub_Item_Logic.get_test_list(blog_post,blog_post,option);
|
|
349
352
|
}
|
|
@@ -391,6 +394,7 @@ class Event_Logic {
|
|
|
391
394
|
event.meeting_link = "Meeting Link "+String(Number.get_id());
|
|
392
395
|
event.stock = String(Number.get_id(3-1));
|
|
393
396
|
event.category ="Category " + String(Number.get_id());
|
|
397
|
+
event.tag = "Tag "+ Number.get_id() + ", Tag "+Number.get_id() + ", Tag "+ Number.get_id();
|
|
394
398
|
if(option.get_item){
|
|
395
399
|
event.items = Sub_Item_Logic.get_test_list(event,event,option);
|
|
396
400
|
}
|
|
@@ -589,13 +593,12 @@ class FieldType {
|
|
|
589
593
|
static APP_ID='app_id';
|
|
590
594
|
static ID='id';
|
|
591
595
|
static DATA_TYPE='data_type';
|
|
596
|
+
static DATE_CREATE='date_create';
|
|
592
597
|
static PARENT_ID='parent_id';
|
|
593
598
|
static PARENT_DATA_TYPE='parent_data_type';
|
|
594
599
|
static PHOTO_DATA='photo_data';
|
|
595
600
|
static TOP_ID='top_id';
|
|
596
601
|
static TOP_DATA_TYPE='top_data_type';
|
|
597
|
-
static DATE_CREATE='date_create';
|
|
598
|
-
static DATE_SAVE='date_save';
|
|
599
602
|
static TITLE='title';
|
|
600
603
|
static TITLE_URL='title_url';
|
|
601
604
|
static SETTING_DELETE_PROTECTION='setting_delete_protection';
|
|
@@ -610,6 +613,9 @@ class FieldType {
|
|
|
610
613
|
static SOURCE_TOP_DATA_TYPE='source_top_data_type';
|
|
611
614
|
static DATE_CREATE='date_create';
|
|
612
615
|
static DATE_SAVE='date_save';
|
|
616
|
+
static STAT_VIEW_ID='1';
|
|
617
|
+
static STAT_LIKE_ID='2';
|
|
618
|
+
static STAT_POST_ID='3';
|
|
613
619
|
}
|
|
614
620
|
class Social {
|
|
615
621
|
static FACEBOOK_URL="https://facebook.com/";
|
|
@@ -746,6 +752,7 @@ class DataType {
|
|
|
746
752
|
static PAGE='page_biz';
|
|
747
753
|
static REVIEW='review_biz';
|
|
748
754
|
static SERVICE='service_biz';
|
|
755
|
+
static STAT='stat_biz';
|
|
749
756
|
static TEMPLATE='template_biz';
|
|
750
757
|
static TEAM='team_biz';
|
|
751
758
|
static USER='user_biz';
|
|
@@ -929,8 +936,8 @@ class DataItem {
|
|
|
929
936
|
}
|
|
930
937
|
}
|
|
931
938
|
class Blank_Url {
|
|
932
|
-
static get = (biz9_config,
|
|
933
|
-
let action_url="blank/get/"+
|
|
939
|
+
static get = (biz9_config,key,params) => {
|
|
940
|
+
let action_url="blank/get/"+key;
|
|
934
941
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
935
942
|
};
|
|
936
943
|
static browse = (biz9_config,params) => {
|
|
@@ -943,8 +950,8 @@ class Blank_Url {
|
|
|
943
950
|
};
|
|
944
951
|
}
|
|
945
952
|
class Blog_Post_Url {
|
|
946
|
-
static get = (biz9_config,
|
|
947
|
-
let action_url="blog_post/get/"+
|
|
953
|
+
static get = (biz9_config,key,params) => {
|
|
954
|
+
let action_url="blog_post/get/"+key;
|
|
948
955
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
949
956
|
};
|
|
950
957
|
static browse = (biz9_config,params) => {
|
|
@@ -957,8 +964,8 @@ class Blog_Post_Url {
|
|
|
957
964
|
};
|
|
958
965
|
}
|
|
959
966
|
class Custom_Field_Url {
|
|
960
|
-
static get = (biz9_config,data_type,
|
|
961
|
-
let action_url="custom_field/get/"+data_type+"/"+
|
|
967
|
+
static get = (biz9_config,data_type,key,params) => {
|
|
968
|
+
let action_url="custom_field/get/"+data_type+"/"+key;
|
|
962
969
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
963
970
|
};
|
|
964
971
|
static browse = (biz9_config,params) => {
|
|
@@ -967,8 +974,8 @@ class Custom_Field_Url {
|
|
|
967
974
|
};
|
|
968
975
|
}
|
|
969
976
|
class FAQ_Url {
|
|
970
|
-
static get = (biz9_config,
|
|
971
|
-
let action_url="faq/"+
|
|
977
|
+
static get = (biz9_config,key,params) => {
|
|
978
|
+
let action_url="faq/"+key;
|
|
972
979
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
973
980
|
};
|
|
974
981
|
static category = (biz9_config,title_url,params) => {
|
|
@@ -977,8 +984,8 @@ class FAQ_Url {
|
|
|
977
984
|
};
|
|
978
985
|
}
|
|
979
986
|
class Product_Url {
|
|
980
|
-
static get = (biz9_config,
|
|
981
|
-
let action_url="product/get/"+
|
|
987
|
+
static get = (biz9_config,key,params) => {
|
|
988
|
+
let action_url="product/get/"+key;
|
|
982
989
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
983
990
|
};
|
|
984
991
|
static browse = (biz9_config,params) => {
|
|
@@ -999,8 +1006,8 @@ class Product_Url {
|
|
|
999
1006
|
};
|
|
1000
1007
|
}
|
|
1001
1008
|
class Event_Url {
|
|
1002
|
-
static get = (biz9_config,
|
|
1003
|
-
let action_url="event/get/"+
|
|
1009
|
+
static get = (biz9_config,key,params) => {
|
|
1010
|
+
let action_url="event/get/"+key;
|
|
1004
1011
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
1005
1012
|
};
|
|
1006
1013
|
static browse = (biz9_config,params) => {
|
|
@@ -1021,8 +1028,8 @@ class Event_Url {
|
|
|
1021
1028
|
};
|
|
1022
1029
|
}
|
|
1023
1030
|
class Service_Url {
|
|
1024
|
-
static get = (biz9_config,
|
|
1025
|
-
let action_url="service/get/"+
|
|
1031
|
+
static get = (biz9_config,key,params) => {
|
|
1032
|
+
let action_url="service/get/"+key;
|
|
1026
1033
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
1027
1034
|
};
|
|
1028
1035
|
static browse = (biz9_config,params) => {
|
|
@@ -1043,8 +1050,8 @@ class Service_Url {
|
|
|
1043
1050
|
};
|
|
1044
1051
|
}
|
|
1045
1052
|
class Content_Url {
|
|
1046
|
-
static get = (biz9_config,
|
|
1047
|
-
let action_url="content/get/"+
|
|
1053
|
+
static get = (biz9_config,key,params) => {
|
|
1054
|
+
let action_url="content/get/"+key;
|
|
1048
1055
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
1049
1056
|
};
|
|
1050
1057
|
static browse = (biz9_config,params) => {
|
|
@@ -1057,8 +1064,8 @@ class Content_Url {
|
|
|
1057
1064
|
};
|
|
1058
1065
|
}
|
|
1059
1066
|
class Gallery_Url {
|
|
1060
|
-
static get = (biz9_config,
|
|
1061
|
-
let action_url="gallery/get/"+
|
|
1067
|
+
static get = (biz9_config,key,params) => {
|
|
1068
|
+
let action_url="gallery/get/"+key;
|
|
1062
1069
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
1063
1070
|
};
|
|
1064
1071
|
static browse = (biz9_config,params) => {
|
|
@@ -1071,8 +1078,8 @@ class Gallery_Url {
|
|
|
1071
1078
|
};
|
|
1072
1079
|
}
|
|
1073
1080
|
class Category_Url {
|
|
1074
|
-
static get = (biz9_config,
|
|
1075
|
-
let action_url="category/get/"+
|
|
1081
|
+
static get = (biz9_config,key,params) => {
|
|
1082
|
+
let action_url="category/get/"+key;
|
|
1076
1083
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
1077
1084
|
};
|
|
1078
1085
|
static browse = (biz9_config,params) => {
|
|
@@ -1091,8 +1098,8 @@ class Page_Url {
|
|
|
1091
1098
|
};
|
|
1092
1099
|
}
|
|
1093
1100
|
class Team_Url {
|
|
1094
|
-
static get = (biz9_config,
|
|
1095
|
-
let action_url="team/"+
|
|
1101
|
+
static get = (biz9_config,key,params) => {
|
|
1102
|
+
let action_url="team/"+key;
|
|
1096
1103
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
1097
1104
|
};
|
|
1098
1105
|
static member = (biz9_config,title_url,params) => {
|
|
@@ -1128,8 +1135,8 @@ class Url{
|
|
|
1128
1135
|
let action_url = "main/crud/get_item_parent_top/"+data_type+"/"+id+"/"+parent_data_type+ "/"+parent_id+"/"+top_data_type+ "/"+top_id;
|
|
1129
1136
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
|
|
1130
1137
|
};
|
|
1131
|
-
static
|
|
1132
|
-
let action_url = "main/crud/
|
|
1138
|
+
static search = (biz9_config,data_type) => {
|
|
1139
|
+
let action_url = "main/crud/search/"+data_type;
|
|
1133
1140
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
|
|
1134
1141
|
};
|
|
1135
1142
|
static upload_file = (biz9_config,data_type,id) => {
|
|
@@ -1473,6 +1480,22 @@ class Storage {
|
|
|
1473
1480
|
window.localStorage.clear();
|
|
1474
1481
|
}
|
|
1475
1482
|
}
|
|
1483
|
+
class User_Logic {
|
|
1484
|
+
static get_user(req){
|
|
1485
|
+
if(!req || !req.session.user){
|
|
1486
|
+
let user=DataItem.get_new(DataType.USER,0,{is_guest:true,customer_id:Number.get_id(99999)});
|
|
1487
|
+
req.session.user=user;
|
|
1488
|
+
}
|
|
1489
|
+
return req.session.user;
|
|
1490
|
+
}
|
|
1491
|
+
static set_user(req){
|
|
1492
|
+
req.session.user=user;
|
|
1493
|
+
}
|
|
1494
|
+
static del_user(req){
|
|
1495
|
+
req.session.user=null;
|
|
1496
|
+
delete req.session.user;
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1476
1499
|
class Sub_Item_Logic {
|
|
1477
1500
|
static get_test(title,parent_item,top_item,option){
|
|
1478
1501
|
option = Field_Logic.get_option(DataType.ITEM,option?option:{});
|
|
@@ -1568,4 +1591,5 @@ module.exports = {
|
|
|
1568
1591
|
Team_Logic,
|
|
1569
1592
|
Template_Logic,
|
|
1570
1593
|
Url,
|
|
1594
|
+
User_Logic,
|
|
1571
1595
|
};
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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,PageType,Sub_Item_Logic,Page_Url,Review_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,Sub_Item_Logic,Page_Url,Review_Logic,User_Logic} = require('./index');
|
|
4
4
|
const {Log,Number} = require('biz9-utility');
|
|
5
5
|
const {Scriptz}= require('biz9-scriptz');
|
|
6
6
|
|
|
@@ -79,6 +79,11 @@ describe("connect", () => {
|
|
|
79
79
|
//Log.w('team_list',team_list);
|
|
80
80
|
/* --TEAM--END */
|
|
81
81
|
|
|
82
|
+
/* --USER--START */
|
|
83
|
+
//let user = User_Logic.get_user();
|
|
84
|
+
//Log.w('user',user);
|
|
85
|
+
|
|
86
|
+
/* --USER--END */
|
|
82
87
|
|
|
83
88
|
/* --SEARCH--START */
|
|
84
89
|
//console.log(Url.get_search(DataType.BLOG_POST,{title:-1},{cool:-1},1,10));
|
|
@@ -141,12 +146,12 @@ describe("connect", () => {
|
|
|
141
146
|
|
|
142
147
|
|
|
143
148
|
/* --BLOG_POST--START */
|
|
144
|
-
|
|
149
|
+
let blog_post = Blog_Post_Logic.get_test("Blog_Post 1")
|
|
145
150
|
//let blog_post = Blog_Post_Logic.get_test("Blog_Post 1",{get_value:true})
|
|
146
151
|
//let blog_post = Blog_Post_Logic.get_test("Blog_Post 1",{get_value:true})
|
|
147
152
|
//let blog_post = Blog_Post_Logic.get_test("Blog_Post 1",{get_value:true,get_item:true})
|
|
148
153
|
//let [category_list,blog_post_list]=Blog_Post_Logic.get_test_list_by_category();
|
|
149
|
-
|
|
154
|
+
Log.w("blog_post",blog_post);
|
|
150
155
|
//let blog_post_list = Blog_Post_Logic.get_test_list({get_value:true,get_item:true});
|
|
151
156
|
//Log.w('blog_post_list',blog_post_list);
|
|
152
157
|
//Log.w('blog_post_list',blog_post_list[0].items);
|
|
@@ -211,13 +216,13 @@ describe("connect", () => {
|
|
|
211
216
|
/* --ITEM-TEST--END */
|
|
212
217
|
|
|
213
218
|
|
|
214
|
-
|
|
219
|
+
/* --TEMPLATE--START */
|
|
215
220
|
//let template = Template_Logic.get_test("Primary",{});
|
|
216
|
-
let template = Template_Logic.get_test("Primary",{get_value:true,get_item:true});
|
|
221
|
+
//let template = Template_Logic.get_test("Primary",{get_value:true,get_item:true});
|
|
217
222
|
/*
|
|
218
223
|
let template_item_list = Template_Logic.get_test("Primary",template,template,{get_value:false,get_item:false,item_count:2});
|
|
219
224
|
*/
|
|
220
|
-
Log.w('template',template);
|
|
225
|
+
//Log.w('template',template);
|
|
221
226
|
//Log.w('template_item_list',template_item_list);
|
|
222
227
|
/* --TEMPLATE--END */
|
|
223
228
|
|