biz9-logic 3.0.17 → 3.0.21
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 +15 -7
- package/package.json +1 -1
- package/test.js +30 -4
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const { get_new_item_main,get_data_config_main,get_cloud_url_main,get_biz_item_m
|
|
|
8
8
|
const {Log,Test,Str} = require('biz9-utility');
|
|
9
9
|
|
|
10
10
|
class DataType {
|
|
11
|
-
static
|
|
11
|
+
static get_title = (data_type) => {
|
|
12
12
|
if(!data_type){
|
|
13
13
|
return "";
|
|
14
14
|
}else{
|
|
@@ -52,7 +52,7 @@ class DataType {
|
|
|
52
52
|
static DT_USER='user_biz';
|
|
53
53
|
static DT_VIDEO='video_biz';
|
|
54
54
|
}
|
|
55
|
-
class
|
|
55
|
+
class DataItem {
|
|
56
56
|
static get_new = (data_type,id) => {
|
|
57
57
|
return get_new_item_main(data_type,id);
|
|
58
58
|
};
|
|
@@ -60,6 +60,17 @@ class Item {
|
|
|
60
60
|
return get_biz_item_main(biz9_config,item,options);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
class BiZ_Url {
|
|
64
|
+
static get_item = (biz9_config,item) => {
|
|
65
|
+
let action_url= "main/biz_item/get/"+item.data_type + "/" + item.id;
|
|
66
|
+
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
static get_full_item = (biz9_config,item,parent_item,top_item) => {
|
|
70
|
+
let action_url= "main/biz_item/get_full/"+item.data_type + "/" + item.id + "/"+parent_item.data_type + "/" + parent_item.id + "/"+top_item.data_type + "/" + top_item.id;
|
|
71
|
+
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
63
74
|
class Url {
|
|
64
75
|
static get = (biz9_config,action_url,params)=>{
|
|
65
76
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,params);
|
|
@@ -92,10 +103,6 @@ class Url {
|
|
|
92
103
|
let action_url= "main/crud/delete_list/"+data_type;
|
|
93
104
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
94
105
|
};
|
|
95
|
-
static get_biz_item = (biz9_config,data_type,id) => {
|
|
96
|
-
let action_url= "main/biz_item/get/"+data_type + "/" + id;
|
|
97
|
-
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
98
|
-
};
|
|
99
106
|
static delete_biz_item = (biz9_config,data_type,id) => {
|
|
100
107
|
let action_url= "main/biz_item/delete/"+data_type + "/" + id;
|
|
101
108
|
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
@@ -116,7 +123,8 @@ class Obj {
|
|
|
116
123
|
};
|
|
117
124
|
module.exports = {
|
|
118
125
|
DataType,
|
|
119
|
-
|
|
126
|
+
DataItem,
|
|
120
127
|
Url,
|
|
128
|
+
BiZ_Url,
|
|
121
129
|
Obj
|
|
122
130
|
};
|
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 { DataItem,DataType,Url,Obj,BiZ_Url } = require('./');
|
|
4
4
|
const {Log,Test} = require('biz9-utility');
|
|
5
5
|
const { Scriptz }= require('biz9-scriptz');
|
|
6
6
|
|
|
@@ -28,7 +28,33 @@ const biz9_config ={
|
|
|
28
28
|
describe("connect", () => {
|
|
29
29
|
it("_connect", () => {
|
|
30
30
|
series([
|
|
31
|
+
|
|
32
|
+
function(call) {
|
|
33
|
+
console.log('GET-BiZ-Full-Url-Item-Get-Item-START');
|
|
34
|
+
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
35
|
+
let item = DataItem.get_new(DataType.DT_BLANK,0);
|
|
36
|
+
let parent_item = DataItem.get_new(DataType.DT_BLANK,0);
|
|
37
|
+
let top_item = DataItem.get_new(DataType.DT_BLANK,0);
|
|
38
|
+
Log.w('item',item);
|
|
39
|
+
let cloud_url = BiZ_Url.get_full_item(biz9_config,item,parent_item,top_item);
|
|
40
|
+
Log.w('connect_url',cloud_url);
|
|
41
|
+
console.log('GET-BiZ-Full-Url-Item-Get-Item-SUCCESS');
|
|
42
|
+
//call()
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
|
|
31
46
|
/*
|
|
47
|
+
function(call) {
|
|
48
|
+
console.log('GET-BiZ-Url-Item-Get-Item-START');
|
|
49
|
+
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
50
|
+
let item = DataItem.get_new(DataType.DT_BLANK,0);
|
|
51
|
+
Log.w('item',item);
|
|
52
|
+
let cloud_url = BiZ_Url.get_item(biz9_config,item);
|
|
53
|
+
Log.w('connect_url',cloud_url);
|
|
54
|
+
console.log('GET-BiZ-Url-Item-Get-Item-SUCCESS');
|
|
55
|
+
//call()
|
|
56
|
+
},
|
|
57
|
+
|
|
32
58
|
function(call) {
|
|
33
59
|
console.log('GET-BIZ9-GET-DATA-TYPE-START');
|
|
34
60
|
console.log(DataType.get_data_type_title(DataType.DT_CART_ITEM));
|
|
@@ -140,7 +166,7 @@ describe("connect", () => {
|
|
|
140
166
|
},
|
|
141
167
|
function(call) {
|
|
142
168
|
console.log('GET-NEW-ITEM-START');
|
|
143
|
-
var new_item =
|
|
169
|
+
var new_item = DataItem.get_new(DATA_TYPE,0);
|
|
144
170
|
console.log(new_item);
|
|
145
171
|
console.log('GET-NEW-ITEM-SUCCESS');
|
|
146
172
|
call()
|
|
@@ -155,12 +181,11 @@ describe("connect", () => {
|
|
|
155
181
|
item_test.value_2 = 'my_value_2';
|
|
156
182
|
item_test.field_3 = 'my_field_3';
|
|
157
183
|
item_test.value_3 = 'my_value_3';
|
|
158
|
-
let item_biz =
|
|
184
|
+
let item_biz = DataItem.get_biz(biz9_config,item_test,{get_date:true,get_count:true,get_biz_map:true});
|
|
159
185
|
console.log(item_biz);
|
|
160
186
|
console.log('SET-ITEM-BIZ-SUCCESS');
|
|
161
187
|
call();
|
|
162
188
|
},
|
|
163
|
-
*/
|
|
164
189
|
function(call) {
|
|
165
190
|
console.log('GET_URL-BIZ-ITEM-START');
|
|
166
191
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
@@ -171,6 +196,7 @@ describe("connect", () => {
|
|
|
171
196
|
console.log('GET_URL-BIZ-ITEM-SUCCESS');
|
|
172
197
|
call()
|
|
173
198
|
},
|
|
199
|
+
*/
|
|
174
200
|
function(call) {
|
|
175
201
|
// never happens, because "second thing"
|
|
176
202
|
// passed an error to the done() callback
|