biz9-logic 3.0.12 → 3.0.13
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 +20 -14
- package/package.json +1 -1
- package/test.js +14 -14
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -52,49 +52,55 @@ class DataType {
|
|
|
52
52
|
static DT_USER='user_biz';
|
|
53
53
|
static DT_VIDEO='video_biz';
|
|
54
54
|
}
|
|
55
|
-
class
|
|
56
|
-
static
|
|
55
|
+
class Item {
|
|
56
|
+
static get_new = (data_type,id) => {
|
|
57
57
|
return get_new_item_main(data_type,id);
|
|
58
58
|
};
|
|
59
|
-
static
|
|
59
|
+
static get_biz = (biz9_config,item,options)=>{
|
|
60
60
|
return get_biz_item_main(biz9_config,item,options);
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
}
|
|
63
|
+
class Url {
|
|
64
|
+
static get = (biz9_config,action_url,params)=>{
|
|
63
65
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,params);
|
|
64
66
|
}
|
|
65
|
-
static
|
|
67
|
+
static get_action_connect = (biz9_config) => {
|
|
66
68
|
let action_url= "main/test/connect/";
|
|
67
69
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
68
70
|
};
|
|
69
|
-
static
|
|
71
|
+
static get_action_update_item = (biz9_config,data_type,id) => {
|
|
70
72
|
let action_url= "main/crud/update/"+data_type + "/" + id;
|
|
71
73
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
72
74
|
};
|
|
73
|
-
static
|
|
75
|
+
static get_action_get_item = (biz9_config,data_type,id) => {
|
|
74
76
|
let action_url= "main/crud/get/"+data_type + "/" + id;
|
|
75
77
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
76
78
|
};
|
|
77
|
-
static
|
|
79
|
+
static get_action_delete_item = (biz9_config,data_type,id) => {
|
|
78
80
|
let action_url= "main/crud/delete/"+data_type + "/" + id;
|
|
79
81
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
80
82
|
};
|
|
81
|
-
static
|
|
83
|
+
static get_action_get_list = (biz9_config,data_type) => {
|
|
82
84
|
let action_url= "main/crud/get_list/"+data_type;
|
|
83
85
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
84
86
|
};
|
|
85
|
-
static
|
|
87
|
+
static get_action_delete_list = (biz9_config,data_type) => {
|
|
86
88
|
let action_url= "main/crud/delete_list/"+data_type;
|
|
87
89
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
88
90
|
};
|
|
89
|
-
static
|
|
91
|
+
static get_action_update_list = (biz9_config,data_type) => {
|
|
90
92
|
let action_url= "main/crud/update_list/"+data_type;
|
|
91
93
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
92
94
|
};
|
|
93
|
-
|
|
95
|
+
}
|
|
96
|
+
class Obj {
|
|
97
|
+
static get_filter = (biz9_config,data_type,filter,sort_by,page_current,page_size)=>{
|
|
94
98
|
return get_cloud_filter_obj_main(data_type,filter,sort_by,page_current,page_size);
|
|
95
99
|
}
|
|
96
100
|
};
|
|
97
101
|
module.exports = {
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
DataType,
|
|
103
|
+
Item,
|
|
104
|
+
Url,
|
|
105
|
+
Obj
|
|
100
106
|
};
|
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 {
|
|
3
|
+
const {Item,DataType,Url,Obj} = require('./');
|
|
4
4
|
const {Log,Test} = require('biz9-utility');
|
|
5
5
|
const { Scriptz }= require('biz9-scriptz');
|
|
6
6
|
|
|
@@ -30,10 +30,11 @@ describe("connect", () => {
|
|
|
30
30
|
series([
|
|
31
31
|
function(call) {
|
|
32
32
|
console.log('GET-BIZ9-GET-DATA-TYPE-START');
|
|
33
|
-
|
|
33
|
+
console.log(DataType.get_data_type_title(DataType.DT_CART_ITEM));
|
|
34
34
|
console.log(DataType.ID);
|
|
35
35
|
console.log(DataType.TITLE);
|
|
36
36
|
console.log('GET-BIZ9-GET-DATA-TYPE-END');
|
|
37
|
+
call();
|
|
37
38
|
},
|
|
38
39
|
function(call) {
|
|
39
40
|
console.log('GET-BIZ9-CONFIG-FILE-START');
|
|
@@ -54,7 +55,7 @@ describe("connect", () => {
|
|
|
54
55
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
55
56
|
let action_url = 'test_get_url_action';
|
|
56
57
|
let params = '&myparam1=p1&myparam2=p2'
|
|
57
|
-
let cloud_url =
|
|
58
|
+
let cloud_url = Url.get(biz9_config,action_url,params);
|
|
58
59
|
Log.w('connect_url',cloud_url);
|
|
59
60
|
console.log('GET-URL-SUCCESS');
|
|
60
61
|
call()
|
|
@@ -62,7 +63,7 @@ describe("connect", () => {
|
|
|
62
63
|
function(call) {
|
|
63
64
|
console.log('CONNECT-START');
|
|
64
65
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
65
|
-
let cloud_url =
|
|
66
|
+
let cloud_url = Url.get_action_connect(biz9_config);
|
|
66
67
|
Log.w('connect_url',cloud_url);
|
|
67
68
|
console.log('CONNECT-SUCCESS');
|
|
68
69
|
call()
|
|
@@ -72,7 +73,7 @@ describe("connect", () => {
|
|
|
72
73
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
73
74
|
let data_type = 'dt_blank';
|
|
74
75
|
let id = 0;
|
|
75
|
-
let cloud_url =
|
|
76
|
+
let cloud_url = Url.get_action_update_item(biz9_config,data_type,id);
|
|
76
77
|
Log.w('get_url_action_update_item',cloud_url);
|
|
77
78
|
console.log('GET_URL-ACTION-UPDATE-ITEM-SUCCESS');
|
|
78
79
|
call()
|
|
@@ -82,7 +83,7 @@ describe("connect", () => {
|
|
|
82
83
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
83
84
|
let data_type = 'dt_blank';
|
|
84
85
|
let id = 0;
|
|
85
|
-
let cloud_url =
|
|
86
|
+
let cloud_url = Url.get_action_get_item(biz9_config,data_type,id);
|
|
86
87
|
Log.w('get_url_action_get_item',cloud_url);
|
|
87
88
|
console.log('GET_URL-ACTION-GET-ITEM-SUCCESS');
|
|
88
89
|
call()
|
|
@@ -92,7 +93,7 @@ describe("connect", () => {
|
|
|
92
93
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
93
94
|
let data_type = 'dt_blank';
|
|
94
95
|
let id = 0;
|
|
95
|
-
let cloud_url =
|
|
96
|
+
let cloud_url = Url.get_action_delete_item(biz9_config,data_type,id);
|
|
96
97
|
Log.w('get_url_action_delete_item',cloud_url);
|
|
97
98
|
console.log('GET_URL-ACTION-DELETE-ITEM-SUCCESS');
|
|
98
99
|
call()
|
|
@@ -101,7 +102,7 @@ describe("connect", () => {
|
|
|
101
102
|
console.log('GET_URL-ACTION-GET-LIST-ITEM-START');
|
|
102
103
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
103
104
|
let data_type = 'dt_blank';
|
|
104
|
-
let cloud_url =
|
|
105
|
+
let cloud_url = Url.get_action_get_list(biz9_config,data_type);
|
|
105
106
|
Log.w('get_url_action_get_list_item',cloud_url);
|
|
106
107
|
console.log('GET_URL-ACTION-GET-LIST-ITEM-SUCCESS');
|
|
107
108
|
call()
|
|
@@ -110,7 +111,7 @@ describe("connect", () => {
|
|
|
110
111
|
console.log('GET_URL-ACTION-DELETE-LIST-ITEM-START');
|
|
111
112
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
112
113
|
let data_type = 'dt_blank';
|
|
113
|
-
let cloud_url =
|
|
114
|
+
let cloud_url = Url.get_action_delete_list(biz9_config,data_type);
|
|
114
115
|
Log.w('get_url_action_delete_list_item',cloud_url);
|
|
115
116
|
console.log('GET_URL-ACTION-DELETE-LIST-ITEM-SUCCESS');
|
|
116
117
|
call()
|
|
@@ -119,7 +120,7 @@ describe("connect", () => {
|
|
|
119
120
|
console.log('GET_URL-ACTION-UPDATE-LIST-ITEM-START');
|
|
120
121
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
121
122
|
let data_type = 'dt_blank';
|
|
122
|
-
let cloud_url =
|
|
123
|
+
let cloud_url = Url.get_action_update_list(biz9_config,data_type);
|
|
123
124
|
Log.w('get_url_action_update_list_item',cloud_url);
|
|
124
125
|
console.log('GET_URL-ACTION-UPDATE-LIST-ITEM-SUCCESS');
|
|
125
126
|
call()
|
|
@@ -131,14 +132,14 @@ describe("connect", () => {
|
|
|
131
132
|
let sort_by = {title:-1};
|
|
132
133
|
let page_current = 0;
|
|
133
134
|
let page_size = 15;
|
|
134
|
-
let filter_obj =
|
|
135
|
+
let filter_obj = Obj.get_filter(data_type,filter,sort_by,page_current,page_size);
|
|
135
136
|
Log.w('get_url_action_filter_obj',filter_obj);
|
|
136
137
|
console.log('GET_FILTER-OBJECT-SUCCESS');
|
|
137
138
|
call()
|
|
138
139
|
},
|
|
139
140
|
function(call) {
|
|
140
141
|
console.log('GET-NEW-ITEM-START');
|
|
141
|
-
var new_item =
|
|
142
|
+
var new_item = Item.get_new(DATA_TYPE,0);
|
|
142
143
|
console.log(new_item);
|
|
143
144
|
console.log('GET-NEW-ITEM-SUCCESS');
|
|
144
145
|
call()
|
|
@@ -153,7 +154,7 @@ describe("connect", () => {
|
|
|
153
154
|
item_test.value_2 = 'my_value_2';
|
|
154
155
|
item_test.field_3 = 'my_field_3';
|
|
155
156
|
item_test.value_3 = 'my_value_3';
|
|
156
|
-
let item_biz =
|
|
157
|
+
let item_biz = Item.get_biz(biz9_config,item_test,{get_photo:true,get_date:true,get_count:true,get_biz_map:true});
|
|
157
158
|
console.log(item_biz);
|
|
158
159
|
console.log('SET-ITEM-BIZ-SUCCESS');
|
|
159
160
|
call();
|
|
@@ -165,7 +166,6 @@ describe("connect", () => {
|
|
|
165
166
|
], function(err) {
|
|
166
167
|
console.log(err.message) // "another thing"
|
|
167
168
|
})
|
|
168
|
-
|
|
169
169
|
});
|
|
170
170
|
});
|
|
171
171
|
|