biz9-logic 4.9.27 → 4.9.33

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.
Files changed (4) hide show
  1. package/biz9_config +1 -1
  2. package/index.js +51 -23
  3. package/package.json +1 -1
  4. package/test.js +56 -4
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='8.9.7'
1
+ VERSION='9.0.3'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -127,7 +127,11 @@ class Demo_Logic {
127
127
  let category_title_list = [];
128
128
  if(option.categorys){
129
129
  category_title_list = option.categorys.split(',');
130
+ option.category_count = category_title_list.length;
130
131
  }else{
132
+ if(!option.category_count){
133
+ option.category_count = 1;
134
+ }
131
135
  for(let a = 1;a<parseInt(option.category_count)+1;a++){
132
136
  category_title_list.push(title + " Category " +a);
133
137
  }
@@ -140,12 +144,14 @@ class Demo_Logic {
140
144
  let item_title_list = [];
141
145
  if(option.items){
142
146
  item_title_list = option.items.split(',');
147
+ option.item_count = item_title_list.length;
143
148
  }else{
144
149
  for(let b = 1;b<parseInt(option.item_count)+1;b++){
145
- item_title_list.push(title+" " +Type.get_title(item.categorys[Num.get_id(item.categorys.length)].category)+" "+ b);
150
+ item_title_list.push(title+" " +Type.get_title(item.categorys[Num.get_id(option.category_count)].category)+" "+ b);
146
151
  }
147
152
  }
148
- const cat_item = item.categorys[Num.get_id(item.categorys.length)];
153
+ for(let a = 0;a < option.item_count; a++){
154
+ const cat_item = item.categorys[Num.get_id(option.category_count)];
149
155
  if(!cat_item.items){
150
156
  cat_item.items = [];
151
157
  }
@@ -162,13 +168,12 @@ class Demo_Logic {
162
168
  child_item.note = Field_Logic.get_test_note(),
163
169
  cat_item.items.push(child_item);
164
170
  }
171
+ }
165
172
  }
166
173
  return item;
167
174
  };
168
175
  }
169
-
170
176
  class Type {
171
-
172
177
  static get_stat_type_list = () =>{
173
178
  return [
174
179
  {title:Type.get_title(Type.STAT_VIEW),type:Type.STAT_VIEW,label:Type.get_title(Type.STAT_VIEW),value:Type.STAT_VIEW},
@@ -178,10 +183,10 @@ class Type {
178
183
  {title:Type.get_title(Type.STAT_FAVORITE),type:Type.STAT_FAVORITE,label:Type.get_title(Type.STAT_FAVORITE),value:Type.STAT_FAVORITE},
179
184
  {title:Type.get_title(Type.STAT_CART),type:Type.STAT_CART,label:Type.get_title(Type.STAT_CART),value:Type.STAT_CART},
180
185
  {title:Type.get_title(Type.STAT_ORDER),type:Type.STAT_ORDER,label:Type.get_title(Type.STAT_ORDER),value:Type.STAT_ORDER},
186
+ {title:Type.get_title(Type.STAT_ORDER_PAYMENT),type:Type.STAT_ORDER_PAYMENT,label:Type.get_title(Type.STAT_ORDER_PAYMENT),value:Type.STAT_ORDER_PAYMENT},
181
187
  {title:Type.get_title(Type.STAT_REVIEW),type:Type.STAT_REVIEW,label:Type.get_title(Type.STAT_REVIEW),value:Type.STAT_REVIEW},
182
188
  ]
183
189
  };
184
-
185
190
  //page
186
191
  static PAGE_ABOUT='about';
187
192
  static PAGE_CONTACT='contact';
@@ -211,6 +216,7 @@ class Type {
211
216
  static STAT_FAVORITE='favorite_post';
212
217
  static STAT_CART='cart_post';
213
218
  static STAT_ORDER='order_post';
219
+ static STAT_ORDER_PAYMENT='order_payment_post';
214
220
  static STAT_REVIEW='review_post';
215
221
  //template
216
222
  static TEMPLATE_PRIMARY='primary';
@@ -394,37 +400,59 @@ class Stat_Logic {
394
400
  let action_url="item/search_activity";
395
401
  return get_cloud_url_main(app_id,url,action_url,param);
396
402
  };
397
- static get_new = (user_id,parent_data_type,parent_id,stat_type,data)=>{
398
- return {
399
- user_id:user_id,
400
- parent_data_type:parent_data_type,
401
- parent_id:parent_id,
402
- type:stat_type,
403
- data:data
404
- }
405
- }
406
403
  static get_new_user = (user_id,stat_type,data)=>{
407
404
  return {
408
405
  user_id:user_id,
409
406
  type:stat_type,
410
407
  data:data,
411
408
  }
412
- }
409
+ };
413
410
  static get_new = (user_id,stat_type,parent_item_list,data)=>{
414
- return {
415
- user_id:user_id,
416
- type:stat_type,
417
- parent_item_list:parent_item_list,
418
- data:data,
419
- }
420
- }
411
+ let stat_list = [];
412
+ for(const item of parent_item_list){
413
+ let stat = DataItem.get_new(DataType.STAT,0);
414
+ stat.user_id=user_id;
415
+ stat.type=stat_type;
416
+ if(item.parent_id){
417
+ stat.parent_id=item.parent_id;
418
+ }
419
+ if(item.parent_data_type==DataType.PRODUCT || item.parent_data_type==DataType.SERVICE || item.parent_data_type==DataType.EVENT ){
420
+ stat.parent_data_type=item.parent_data_type;
421
+ stat.parent_id=item.parent_id;
422
+ stat.parent_cost = item.cost;
423
+ stat.parent_quanity = item.quanity;
424
+ }
425
+ if(item.data_type==DataType.CART_ITEM){
426
+ stat.parent_data_type=item.parent_data_type;
427
+ stat.parent_id=item.parent_id;
428
+ stat.parent_cart_id = item.cart_id;
429
+ stat.parent_cart_number = item.cart_number;
430
+ }
431
+ if(item.data_type==DataType.ORDER){
432
+ stat.parent_data_type=item.data_type;
433
+ stat.parent_id=item.id;
434
+ stat.parent_order_id = item.order_id;
435
+ stat.parent_order_number = item.order_number;
436
+ }
437
+ if(item.data_type==DataType.ORDER_PAYMENT){
438
+ stat.parent_data_type=item.data_type;
439
+ stat.parent_id=item.id;
440
+ stat.parent_order_number = item.order_number;
441
+ stat.parent_payment_method_type = item.payment_method_type;
442
+ stat.parent_payment_amount = item.payment_amount;
443
+ stat.parent_transaction_id = item.transaction_id;
444
+ }
445
+ stat_list.push(stat);
446
+ };
447
+ return stat_list;
448
+ };
421
449
  static get_new_activity = (user_id,stat_type,activity_data)=>{
422
450
  return {
423
451
  user_id:user_id,
424
452
  type:stat_type,
425
453
  activity:data,
426
454
  }
427
- }
455
+ };
428
456
  }
429
457
  class Page_Logic {
430
458
  static get_page_list(){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.9.27",
3
+ "version": "4.9.33",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -30,11 +30,63 @@ describe("connect", () => {
30
30
  it("_connect", () => {
31
31
  series([
32
32
  function(call) {
33
- console.log('CONNECT-START');
33
+ console.log('CONNECT-CMS-DEMO-START');
34
34
 
35
- let post_cart = {};
35
+ let category_type = DataType.PRODUCT;
36
+ let category_count = 12;
37
+ let item_count = 500;
38
+ let category_type_title_list = ['Add On','Admin Panel','Hosting','Landing Page','Mobile','Website'];
39
+ let category_title_list = ['Beauty','Church','Fashion','Food Trucks','Health Care','Music','Pets','Services','Service Repair','Sports','Trucking'];
40
+ let item_title_list = [];
41
+ let post_type_list = [];
42
+ let val_category_title = '';
43
+ let cat_max = 0;
44
+ let option = {get_category:true,category_count:category_count,category_data_type:category_type,categorys:val_category_title?val_category_title:null,
45
+ get_item:true,item_count:item_count,item_data_type:category_type,items:null}
46
+
47
+ if(category_title_list.length >0){
48
+ cat_max = category_title_list.length;
49
+ }else{
50
+ if(category_count.length){
51
+ cat_max = category_count;
52
+ }else{
53
+ cat_max = 0;
54
+ }
55
+ }
56
+ option.item_count = item_count / cat_max;
57
+ for(const item of category_type_title_list){
58
+ post_type_list.push(
59
+ Demo_Logic.get_new_type(item,option));
60
+ }
61
+
62
+ Log.w('post_type_list',post_type_list);
63
+ //Log.w('category_type_title_list',category_type_title_list);
64
+ //Log.w('category_title_list',category_title_list);
65
+ //Log.w('option',option);
66
+
67
+ /*
68
+ let post_category_count = 0;
69
+ let post_item_count = 0;
70
+ for(const item_type of post_type_list){
71
+ for(const item_cat of item_type.categorys){
72
+ post_category_count = post_category_count+1;
73
+ if(!item_cat.items){
74
+ item_cat.items = [];
75
+ }
76
+ for(const item_item of item_cat.items){
77
+ post_item_count = post_item_count+1;
78
+ }
79
+ }
80
+ };
81
+ let data = await App_User_Data.post(Url.CMS_DEMO_POST,{data_type:category_type,type_list:post_type_list,option:option});
82
+ alert_prop.current.showValidation("Demo OK. "+ post_type_list.length + " Types "+ category_count+" Categorys "+" "+item_count+" " +" Items");
83
+ */
84
+ console.log('CONNECT-CMS-DEMO-SUCCESS');
85
+
86
+ },
87
+ function(call) {
88
+ //console.log('CONNECT-START');
36
89
  //let post_cart = Cart_Logic.get_new(DataType.PRODUCT,0,);
37
- Log.w('11_type',Type.get_stat_list());
38
90
  //let post_cart_list = [];
39
91
  //let post_cart_item = Cart_Logic.get_new_cart_item(DataType.PRODUCT,123,post_cart.cart_number,1,30);
40
92
  //let post_cart_sub_item = Cart_Logic.get_new_cart_sub_item(DataType.PRODUCT,1234,post_cart.cart_number,1,10);
@@ -47,7 +99,7 @@ describe("connect", () => {
47
99
  //Log.w('post_order',Order_Logic.get_new(post_cart,{get_payment_plan:true,payment_plan:Title.ORDER_PAYMENT_PLAN_1,payment_plan_status:Title.ORDER_PAYMENT_STATUS_OPEN}));
48
100
  //Log.w('post_cart_2',Cart_Logic.get_total(post_cart));
49
101
 
50
- console.log('CONNECT-END');
102
+ //console.log('CONNECT-END');
51
103
  //call();
52
104
  },
53
105
  function(call) {