biz9-logic 4.8.108 → 4.8.115
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 +235 -54
- package/package.json +1 -1
- package/test.js +31 -6
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -198,6 +198,92 @@ class Page_Logic {
|
|
|
198
198
|
return item_list;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
+
class Order_Logic {
|
|
202
|
+
static get_cart_id = () => {
|
|
203
|
+
return FieldType.CART_ID + Number.get_id();
|
|
204
|
+
}
|
|
205
|
+
static get_order_id = () => {
|
|
206
|
+
return FieldType.ORDER_ID + Number.get_id();
|
|
207
|
+
}
|
|
208
|
+
static get_test_cart_item = (cart_id,user_id,parent_data_type,parent_id,option) =>{
|
|
209
|
+
option = Field_Logic.get_option(DataType.CART_ITEM,option?option:{});
|
|
210
|
+
let cart_item = DataItem.get_new(DataType.CART_ITEM,Number.get_guid(),Field_Logic.get_test("Cart Item "+Number.get_id(),option));
|
|
211
|
+
cart_item.cart_id = cart_id;
|
|
212
|
+
cart_item.user_id = user_id;
|
|
213
|
+
cart_item.parent_data_type = parent_data_type;
|
|
214
|
+
cart_item.parent_id = parent_id;
|
|
215
|
+
cart_item.cost = Field_Logic.get_test_cost();
|
|
216
|
+
cart_item.cart_sub_item_list = [];
|
|
217
|
+
if(option.get_cart_sub_item){
|
|
218
|
+
for(let a = 0;a<option.cart_sub_item_count;a++){
|
|
219
|
+
cart_item.cart_sub_item_list.push(Order_Logic.get_test_cart_sub_item(cart_id,user_id,cart_item.id,parent_data_type,parent_id,{get_value:true,get_cart_sub_item:option.get_cart_sub_item,cart_sub_item_count:option.cart_sub_item_count}));
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return cart_item;
|
|
223
|
+
};
|
|
224
|
+
static get_test_cart_sub_item = (cart_id,user_id,cart_item_id,parent_data_type,parent_id,option) =>{
|
|
225
|
+
option = Field_Logic.get_option(DataType.CART_SUB_ITEM,option?option:{});
|
|
226
|
+
let cart_sub_item = DataItem.get_new(DataType.CART_SUB_ITEM,Number.get_guid(),Field_Logic.get_test("Cart Sub Item "+Number.get_id(),option));
|
|
227
|
+
cart_sub_item.user_id = user_id;
|
|
228
|
+
cart_sub_item.cart_id = cart_id;
|
|
229
|
+
cart_sub_item.cart_item_id = cart_item_id;
|
|
230
|
+
cart_sub_item.parent_data_type = parent_data_type;
|
|
231
|
+
cart_sub_item.parent_id = parent_id;
|
|
232
|
+
cart_sub_item.cost = Field_Logic.get_test_cost();
|
|
233
|
+
return cart_sub_item;
|
|
234
|
+
};
|
|
235
|
+
static get_test_order_item = (order_id,user_id,parent_data_type,parent_id,option) =>{
|
|
236
|
+
option = Field_Logic.get_option(DataType.ORDER_ITEM,option?option:{});
|
|
237
|
+
let order_item = DataItem.get_new(DataType.ORDER_ITEM,Number.get_guid(),Field_Logic.get_test("Order Item "+Number.get_id(),option));
|
|
238
|
+
order_item.order_id = order_id;
|
|
239
|
+
order_item.user_id = user_id;
|
|
240
|
+
order_item.parent_data_type = parent_data_type;
|
|
241
|
+
order_item.parent_id = parent_id;
|
|
242
|
+
order_item.cost = Field_Logic.get_test_cost();
|
|
243
|
+
order_item.order_sub_item_list = [];
|
|
244
|
+
if(option.get_order_sub_item){
|
|
245
|
+
for(let a = 0;a<option.order_sub_item_count;a++){
|
|
246
|
+
order_item.order_sub_item_list.push(Order_Logic.get_test_order_sub_item(order_id,user_id,order_item.id,parent_data_type,parent_id,{get_value:true,get_order_sub_item:option.get_order_sub_item,order_sub_item_count:option.order_sub_item_count}));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return order_item;
|
|
250
|
+
};
|
|
251
|
+
static get_test_order_sub_item = (order_id,user_id,order_item_id,parent_data_type,parent_id,option) =>{
|
|
252
|
+
option = Field_Logic.get_option(DataType.ORDER_SUB_ITEM,option?option:{});
|
|
253
|
+
let order_sub_item = DataItem.get_new(DataType.ORDER_SUB_ITEM,Number.get_guid(),Field_Logic.get_test("Order Sub Item "+Number.get_id(),option));
|
|
254
|
+
order_sub_item.user_id = user_id;
|
|
255
|
+
order_sub_item.order_id = order_id;
|
|
256
|
+
order_sub_item.order_item_id = order_item_id;
|
|
257
|
+
order_sub_item.parent_data_type = parent_data_type;
|
|
258
|
+
order_sub_item.parent_id = parent_id;
|
|
259
|
+
order_sub_item.cost = Field_Logic.get_test_cost();
|
|
260
|
+
return order_sub_item;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
static get_test_list = (option) =>{
|
|
264
|
+
option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
|
|
265
|
+
let item_list = [];
|
|
266
|
+
for(let a=0;a<option.product_count+1;a++){
|
|
267
|
+
item_list.push(Product_Logic.get_test("Product "+String(parseInt(a+1)),option));
|
|
268
|
+
}
|
|
269
|
+
return item_list;
|
|
270
|
+
}
|
|
271
|
+
static get_test_list_by_category = (option) =>{
|
|
272
|
+
option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
|
|
273
|
+
let product_list = [];
|
|
274
|
+
let category_list = Category_Logic.get_type_category_list(DataType.PRODUCT,option.category_count);
|
|
275
|
+
let item_count = 0;
|
|
276
|
+
for(let a=0;a<category_list.length;a++){
|
|
277
|
+
for(let b=0;b<option.product_count;b++){
|
|
278
|
+
item_count++;
|
|
279
|
+
let product = Product_Logic.get_test("Product "+String(parseInt(b+1)),option);
|
|
280
|
+
product.category = category_list[Number.get_id(category_list.length+1)].title;
|
|
281
|
+
product_list.push(product);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return [category_list,product_list]
|
|
285
|
+
};
|
|
286
|
+
}
|
|
201
287
|
class Product_Logic {
|
|
202
288
|
static get_test = (title,option) =>{
|
|
203
289
|
[title,option] = Field_Logic.get_option_title(title,option);
|
|
@@ -207,10 +293,9 @@ class Product_Logic {
|
|
|
207
293
|
DataItem.get_new(DataType.PRODUCT,0),
|
|
208
294
|
DataItem.get_new(DataType.PRODUCT,0),
|
|
209
295
|
Field_Logic.get_test(title,option));
|
|
210
|
-
/*
|
|
211
296
|
if(option.get_blank ==false){
|
|
212
|
-
product.cost =
|
|
213
|
-
product.old_cost =
|
|
297
|
+
product.cost = Field_Logic.get_test_cost();
|
|
298
|
+
product.old_cost = Field_Logic.get_test_cost();
|
|
214
299
|
product.type = "Type "+String(Number.get_id());
|
|
215
300
|
product.sub_type = "Sub Type "+String(Number.get_id());
|
|
216
301
|
product.stock = String(Number.get_id(3-1));
|
|
@@ -226,9 +311,53 @@ class Product_Logic {
|
|
|
226
311
|
if(option.get_item){
|
|
227
312
|
product.items = Sub_Item_Logic.get_test_list(product,product,option);
|
|
228
313
|
}
|
|
229
|
-
*/
|
|
230
314
|
return product;
|
|
231
315
|
};
|
|
316
|
+
static get_test_cart = (cart_id,user_id,option) =>{
|
|
317
|
+
[cart_id,option] = Field_Logic.get_option_title("CART"+Number.get_id(),option);
|
|
318
|
+
option = Field_Logic.get_option(DataType.CART,option?option:{});
|
|
319
|
+
let cart = DataItem.get_new(DataType.CART,Number.get_guid(),Field_Logic.get_test(cart_id,option));
|
|
320
|
+
cart.user_id = user_id;
|
|
321
|
+
let product_option = {generate_id:true,product_count:option.cart_item_count};
|
|
322
|
+
let product_list = Product_Logic.get_test_list(product_option);
|
|
323
|
+
cart.cart_item_list = [];
|
|
324
|
+
if(option.get_cart_item){
|
|
325
|
+
for(let a = 0;a<option.cart_item_count;a++){
|
|
326
|
+
cart.cart_item_list.push(Order_Logic.get_test_cart_item(cart_id,user_id,product_list[a].data_type,product_list[a].id,{get_value:true,get_cart_sub_item:option.get_cart_sub_item,cart_sub_item_count:option.cart_sub_item_count}));
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return cart;
|
|
330
|
+
};
|
|
331
|
+
static get_test_cart = (cart_id,user_id,option) =>{
|
|
332
|
+
[cart_id,option] = Field_Logic.get_option_title(cart_id,option);
|
|
333
|
+
option = Field_Logic.get_option(DataType.CART,option?option:{});
|
|
334
|
+
let cart = DataItem.get_new(DataType.CART,Number.get_guid(),Field_Logic.get_test(cart_id,option));
|
|
335
|
+
cart.user_id = user_id;
|
|
336
|
+
let product_option = {generate_id:true,product_count:option.cart_item_count};
|
|
337
|
+
let product_list = Product_Logic.get_test_list(product_option);
|
|
338
|
+
cart.cart_item_list = [];
|
|
339
|
+
if(option.get_cart_item){
|
|
340
|
+
for(let a = 0;a<option.cart_item_count;a++){
|
|
341
|
+
cart.cart_item_list.push(Order_Logic.get_test_cart_item(cart_id,user_id,product_list[a].data_type,product_list[a].id,{get_value:true,get_cart_sub_item:option.get_cart_sub_item,cart_sub_item_count:option.cart_sub_item_count}));
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return cart;
|
|
345
|
+
};
|
|
346
|
+
static get_test_order = (order_id,user_id,option) =>{
|
|
347
|
+
[order_id,option] = Field_Logic.get_option_title(order_id,option);
|
|
348
|
+
option = Field_Logic.get_option(DataType.ORDER,option?option:{});
|
|
349
|
+
let order = DataItem.get_new(DataType.ORDER,Number.get_guid(),Field_Logic.get_test(order_id,option));
|
|
350
|
+
order.user_id = user_id;
|
|
351
|
+
let product_option = {generate_id:true,product_count:option.order_item_count};
|
|
352
|
+
let product_list = Product_Logic.get_test_list(product_option);
|
|
353
|
+
order.order_item_list = [];
|
|
354
|
+
if(option.get_order_item){
|
|
355
|
+
for(let a = 0;a<option.order_item_count;a++){
|
|
356
|
+
order.order_item_list.push(Order_Logic.get_test_order_item(order_id,user_id,product_list[a].data_type,product_list[a].id,{get_value:true,get_order_sub_item:option.get_order_sub_item,order_sub_item_count:option.order_sub_item_count}));
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return order;
|
|
360
|
+
};
|
|
232
361
|
static get_test_list = (option) =>{
|
|
233
362
|
option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
|
|
234
363
|
let item_list = [];
|
|
@@ -262,8 +391,8 @@ class Service_Logic {
|
|
|
262
391
|
DataItem.get_new(DataType.SERVICE,0),
|
|
263
392
|
DataItem.get_new(DataType.SERVICE,0),
|
|
264
393
|
Field_Logic.get_test(title,option));
|
|
265
|
-
service.cost =
|
|
266
|
-
service.old_cost =
|
|
394
|
+
service.cost = Field_Logic.get_test_cost();
|
|
395
|
+
service.old_cost = Field_Logic.get_test_cost();
|
|
267
396
|
service.type = "Type "+String(Number.get_id());
|
|
268
397
|
service.sub_type = "Sub Type "+String(Number.get_id());
|
|
269
398
|
service.stock = String(Number.get_id(3-1));
|
|
@@ -387,8 +516,8 @@ class Event_Logic {
|
|
|
387
516
|
DataItem.get_new(DataType.EVENT,0),
|
|
388
517
|
DataItem.get_new(DataType.EVENT,0),
|
|
389
518
|
Field_Logic.get_test(title,option));
|
|
390
|
-
event.cost =
|
|
391
|
-
event.old_cost =
|
|
519
|
+
event.cost = Field_Logic.get_test_cost();
|
|
520
|
+
event.old_cost = Field_Logic.get_test_cost();
|
|
392
521
|
event.date = String(String(Number.get_id(2030)) + "-" + String(Number.get_id(13)) + "-" + String(Number.get_id(30))).trim();
|
|
393
522
|
event.time = String(Number.get_id(24)) + ":" + String(Number.get_id(59));
|
|
394
523
|
event.website = "Website "+String(Number.get_id());
|
|
@@ -451,6 +580,9 @@ class Field_Logic {
|
|
|
451
580
|
date_create:new moment().toISOString(),
|
|
452
581
|
date_save:new moment().toISOString()
|
|
453
582
|
}
|
|
583
|
+
if(option.generate_id){
|
|
584
|
+
item.id=Number.get_guid();
|
|
585
|
+
}
|
|
454
586
|
if(option.get_value){
|
|
455
587
|
item = Field_Logic.get_value_list(item,option);
|
|
456
588
|
}
|
|
@@ -461,7 +593,7 @@ class Field_Logic {
|
|
|
461
593
|
item[field_list[a]] = "";
|
|
462
594
|
}else{
|
|
463
595
|
if(!Str.check_is_null(field_list[a])){
|
|
464
|
-
|
|
596
|
+
item[Str.get_title_url(field_list[a])] = Str.get_title(field_list[a]) +"_" + Number.get_id();
|
|
465
597
|
}
|
|
466
598
|
}
|
|
467
599
|
}
|
|
@@ -482,45 +614,10 @@ class Field_Logic {
|
|
|
482
614
|
}
|
|
483
615
|
return item;
|
|
484
616
|
};
|
|
485
|
-
static get_option_admin(req){
|
|
486
|
-
let option = {};
|
|
487
|
-
option.value_count = req.query.value_count ? req.query.value_count : 9;
|
|
488
|
-
option.section_count = req.query.section_count ? req.query.section_count : 9;
|
|
489
|
-
option.question_count = req.query.question_count ? req.query.question_count : 9;
|
|
490
|
-
|
|
491
|
-
option.get_blog_post = req.query.get_blog_post ? req.query.get_blog_post : false;
|
|
492
|
-
option.get_category_blog_post = req.query.get_category_blog_post ? req.query.get_category_blog_post : false;
|
|
493
|
-
option.category_blog_post_count = req.query.category_blog_post_count ? req.query.category_blog_post_count : 9;
|
|
494
|
-
option.blog_post_count = req.query.blog_post_count ? req.query.blog_post_count : 9;
|
|
495
|
-
|
|
496
|
-
option.get_product = req.query.get_product ? req.query.get_product : false;
|
|
497
|
-
option.get_category_product = req.query.get_category_product ? req.query.get_category_product : false;
|
|
498
|
-
option.category_product_count = req.query.category_product_count ? req.query.category_product_count : 9;
|
|
499
|
-
option.product_count = req.query.product_count ? req.query.product_count : 9;
|
|
500
|
-
|
|
501
|
-
option.get_service = req.query.get_service ? req.query.get_service : false;
|
|
502
|
-
option.get_category_service = req.query.get_category_service ? req.query.get_category_service : false;
|
|
503
|
-
option.category_service_count = req.query.category_service_count ? req.query.category_service_count : 9;
|
|
504
|
-
option.service_count = req.query.service_count ? req.query.service_count : 9;
|
|
505
|
-
|
|
506
|
-
option.get_event = req.query.get_event ? req.query.get_event : false;
|
|
507
|
-
option.get_category_event = req.query.get_category_event ? req.query.get_category_event : false;
|
|
508
|
-
option.category_event_count = req.query.category_event_count ? req.query.category_event_count : 9;
|
|
509
|
-
option.event_count = req.query.event_count ? req.query.event_count : 9;
|
|
510
|
-
|
|
511
|
-
option.user_count = req.query.user_count ? req.query.user_count : 9;
|
|
512
|
-
option.get_admin = req.query.get_admin ? req.query.get_admin : false;
|
|
513
|
-
option.get_business = req.query.get_business ? req.query.get_business : false;
|
|
514
|
-
option.get_faq = req.query.get_faq ? req.query.get_faq : false;
|
|
515
|
-
option.get_template = req.query.get_template ? req.query.get_template : false;
|
|
516
|
-
option.get_page = req.query.get_page ? req.query.get_page : false;
|
|
517
|
-
option.get_team = req.query.get_team ? req.query.get_team : false;
|
|
518
|
-
|
|
519
|
-
return option;
|
|
520
|
-
}
|
|
521
617
|
static get_option(data_type,option){
|
|
522
618
|
data_type = data_type ? data_type : DataType.BLANK;
|
|
523
619
|
option = !Obj.check_is_empty(option) ? option : {get_value:false,get_item:false,get_photo:false,item_count:9,value_count:9};
|
|
620
|
+
option.generate_id = !Str.check_is_null(option.generate_id) ? option.generate_id : false;
|
|
524
621
|
option.get_photo = option.get_photo ? true : false;
|
|
525
622
|
option.get_value = option.get_value ? true : false;
|
|
526
623
|
option.get_item = option.get_item ? true : false;
|
|
@@ -566,7 +663,34 @@ class Field_Logic {
|
|
|
566
663
|
if(data_type==DataType.USER){
|
|
567
664
|
option.user_count = option.user_count ? option.user_count : 9;
|
|
568
665
|
}
|
|
569
|
-
|
|
666
|
+
if(data_type==DataType.CART){
|
|
667
|
+
option.category_title = option.category_title ? option.category_title : "";
|
|
668
|
+
option.value_count = option.value_count ? option.value_count : 9;
|
|
669
|
+
option.get_cart_item = option.get_cart_item ? option.get_cart_item : false;
|
|
670
|
+
option.cart_item_count = option.cart_item_count ? option.cart_item_count : 1;
|
|
671
|
+
option.get_cart_sub_item = option.get_cart_sub_item ? option.get_cart_sub_item : false;
|
|
672
|
+
option.cart_sub_item_count = option.cart_sub_item_count ? option.cart_sub_item_count : 1;
|
|
673
|
+
}
|
|
674
|
+
if(data_type==DataType.CART_ITEM){
|
|
675
|
+
option.category_title = option.category_title ? option.category_title : "";
|
|
676
|
+
option.value_count = option.value_count ? option.value_count : 9;
|
|
677
|
+
option.get_cart_sub_item = option.get_cart_sub_item ? option.get_cart_sub_item : false;
|
|
678
|
+
option.cart_sub_item_count = option.cart_sub_item_count ? option.cart_sub_item_count : 1;
|
|
679
|
+
}
|
|
680
|
+
if(data_type==DataType.ORDER){
|
|
681
|
+
option.category_title = option.category_title ? option.category_title : "";
|
|
682
|
+
option.value_count = option.value_count ? option.value_count : 9;
|
|
683
|
+
option.get_order_item = option.get_order_item ? option.get_order_item : false;
|
|
684
|
+
option.order_item_count = option.order_item_count ? option.order_item_count : 1;
|
|
685
|
+
option.get_order_sub_item = option.get_order_sub_item ? option.get_order_sub_item : false;
|
|
686
|
+
option.order_sub_item_count = option.order_sub_item_count ? option.order_sub_item_count : 1;
|
|
687
|
+
}
|
|
688
|
+
if(data_type==DataType.ORDER_ITEM){
|
|
689
|
+
option.category_title = option.category_title ? option.category_title : "";
|
|
690
|
+
option.value_count = option.value_count ? option.value_count : 9;
|
|
691
|
+
option.get_order_sub_item = option.get_order_sub_item ? option.get_order_sub_item : false;
|
|
692
|
+
option.order_sub_item_count = option.order_sub_item_count ? option.order_sub_item_count : 1;
|
|
693
|
+
}
|
|
570
694
|
return option;
|
|
571
695
|
}
|
|
572
696
|
static get_option_title = (title,option) =>{
|
|
@@ -595,6 +719,45 @@ class Field_Logic {
|
|
|
595
719
|
}
|
|
596
720
|
return [title,option];
|
|
597
721
|
}
|
|
722
|
+
static get_test_cost(){
|
|
723
|
+
return String(Number.get_id(999)) + "." + String(Number.get_id(99));
|
|
724
|
+
}
|
|
725
|
+
static get_option_admin(req){
|
|
726
|
+
let option = {};
|
|
727
|
+
option.value_count = req.query.value_count ? req.query.value_count : 9;
|
|
728
|
+
option.section_count = req.query.section_count ? req.query.section_count : 9;
|
|
729
|
+
option.question_count = req.query.question_count ? req.query.question_count : 9;
|
|
730
|
+
|
|
731
|
+
option.get_blog_post = req.query.get_blog_post ? req.query.get_blog_post : false;
|
|
732
|
+
option.get_category_blog_post = req.query.get_category_blog_post ? req.query.get_category_blog_post : false;
|
|
733
|
+
option.category_blog_post_count = req.query.category_blog_post_count ? req.query.category_blog_post_count : 9;
|
|
734
|
+
option.blog_post_count = req.query.blog_post_count ? req.query.blog_post_count : 9;
|
|
735
|
+
|
|
736
|
+
option.get_product = req.query.get_product ? req.query.get_product : false;
|
|
737
|
+
option.get_category_product = req.query.get_category_product ? req.query.get_category_product : false;
|
|
738
|
+
option.category_product_count = req.query.category_product_count ? req.query.category_product_count : 9;
|
|
739
|
+
option.product_count = req.query.product_count ? req.query.product_count : 9;
|
|
740
|
+
|
|
741
|
+
option.get_service = req.query.get_service ? req.query.get_service : false;
|
|
742
|
+
option.get_category_service = req.query.get_category_service ? req.query.get_category_service : false;
|
|
743
|
+
option.category_service_count = req.query.category_service_count ? req.query.category_service_count : 9;
|
|
744
|
+
option.service_count = req.query.service_count ? req.query.service_count : 9;
|
|
745
|
+
|
|
746
|
+
option.get_event = req.query.get_event ? req.query.get_event : false;
|
|
747
|
+
option.get_category_event = req.query.get_category_event ? req.query.get_category_event : false;
|
|
748
|
+
option.category_event_count = req.query.category_event_count ? req.query.category_event_count : 9;
|
|
749
|
+
option.event_count = req.query.event_count ? req.query.event_count : 9;
|
|
750
|
+
|
|
751
|
+
option.user_count = req.query.user_count ? req.query.user_count : 9;
|
|
752
|
+
option.get_admin = req.query.get_admin ? req.query.get_admin : false;
|
|
753
|
+
option.get_business = req.query.get_business ? req.query.get_business : false;
|
|
754
|
+
option.get_faq = req.query.get_faq ? req.query.get_faq : false;
|
|
755
|
+
option.get_template = req.query.get_template ? req.query.get_template : false;
|
|
756
|
+
option.get_page = req.query.get_page ? req.query.get_page : false;
|
|
757
|
+
option.get_team = req.query.get_team ? req.query.get_team : false;
|
|
758
|
+
|
|
759
|
+
return option;
|
|
760
|
+
}
|
|
598
761
|
|
|
599
762
|
}
|
|
600
763
|
class FieldType {
|
|
@@ -631,6 +794,9 @@ class FieldType {
|
|
|
631
794
|
static KEY_GUEST="key_guest";
|
|
632
795
|
static KEY_ORDER="key_order";
|
|
633
796
|
static KEY_USER="key_user";
|
|
797
|
+
|
|
798
|
+
static ORDER_ID="OR-";
|
|
799
|
+
static CART_ID="CA-";
|
|
634
800
|
}
|
|
635
801
|
class Social {
|
|
636
802
|
static FACEBOOK_URL="https://facebook.com/";
|
|
@@ -760,9 +926,15 @@ class DataType {
|
|
|
760
926
|
static GALLERY='gallery_biz';
|
|
761
927
|
static ITEM_MAP='item_map_biz';
|
|
762
928
|
static ITEM='item_biz';
|
|
929
|
+
|
|
930
|
+
static CART="cart_biz";
|
|
931
|
+
static CART_ITEM="cart_item_biz";
|
|
932
|
+
static CART_SUB_ITEM="cart_sub_item_biz";
|
|
933
|
+
|
|
763
934
|
static ORDER="order_biz";
|
|
764
935
|
static ORDER_ITEM="order_item_biz";
|
|
765
936
|
static ORDER_SUB_ITEM="order_sub_item_biz";
|
|
937
|
+
|
|
766
938
|
static PROJECT='project_biz';
|
|
767
939
|
static PRODUCT='product_biz';
|
|
768
940
|
static PHOTO='photo_biz';
|
|
@@ -1059,6 +1231,14 @@ class Order_Url {
|
|
|
1059
1231
|
let action_url="order/cart-update/"+user_id+"/"+data_type+"/"+id;
|
|
1060
1232
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
1061
1233
|
};
|
|
1234
|
+
static cart_get = (biz9_config,user_id,data_type,id,params) => {
|
|
1235
|
+
let action_url="order/cart-get/"+user_id+"/"+data_type+"/"+id;
|
|
1236
|
+
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
1237
|
+
};
|
|
1238
|
+
static cart_search = (biz9_config,order_id,params) => {
|
|
1239
|
+
let action_url="order/cart-search/"+order_id;
|
|
1240
|
+
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
1241
|
+
};
|
|
1062
1242
|
}
|
|
1063
1243
|
class Product_Url {
|
|
1064
1244
|
static get = (biz9_config,key,params) => {
|
|
@@ -1555,7 +1735,7 @@ class Storage {
|
|
|
1555
1735
|
return null;
|
|
1556
1736
|
}else{
|
|
1557
1737
|
return JSON.parse(window.localStorage.getItem(key));
|
|
1558
|
-
|
|
1738
|
+
}
|
|
1559
1739
|
}else{
|
|
1560
1740
|
return null;
|
|
1561
1741
|
}
|
|
@@ -1586,17 +1766,17 @@ class User_Logic {
|
|
|
1586
1766
|
static get_user_country_state_city(item){
|
|
1587
1767
|
let country_state_city = "";
|
|
1588
1768
|
if(item.country == "United States"){
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1769
|
+
let state = "";
|
|
1770
|
+
if(!Str.check_is_null(item.state)){
|
|
1771
|
+
country_state_city = item.state;
|
|
1772
|
+
}
|
|
1593
1773
|
if(!Str.check_is_null(item.city)){
|
|
1594
1774
|
if(!Str.check_is_null(item.state)){
|
|
1595
|
-
|
|
1775
|
+
country_state_city = item.city + ", " + item.state;
|
|
1596
1776
|
}else{
|
|
1597
1777
|
country_state_city = item.city;
|
|
1598
1778
|
}
|
|
1599
|
-
|
|
1779
|
+
}
|
|
1600
1780
|
}
|
|
1601
1781
|
else{
|
|
1602
1782
|
if(!Str.check_is_null(item.city)){
|
|
@@ -1604,7 +1784,7 @@ class User_Logic {
|
|
|
1604
1784
|
}else{
|
|
1605
1785
|
country_state_city = item.country;
|
|
1606
1786
|
}
|
|
1607
|
-
|
|
1787
|
+
}
|
|
1608
1788
|
return country_state_city;
|
|
1609
1789
|
}
|
|
1610
1790
|
static get_user(req){
|
|
@@ -1733,6 +1913,7 @@ module.exports = {
|
|
|
1733
1913
|
Review_Logic,
|
|
1734
1914
|
Review_Url,
|
|
1735
1915
|
Order_Url,
|
|
1916
|
+
Order_Logic,
|
|
1736
1917
|
Service_Logic,
|
|
1737
1918
|
Service_Url,
|
|
1738
1919
|
Social,
|
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,User_Logic,Field_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,Field_Logic,Order_Logic} = require('./index');
|
|
4
4
|
const {Log,Number} = require('biz9-utility');
|
|
5
5
|
const {Scriptz}= require('biz9-scriptz');
|
|
6
6
|
|
|
@@ -205,7 +205,32 @@ describe("connect", () => {
|
|
|
205
205
|
/* --SERVICE--END */
|
|
206
206
|
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
console.log('PRODUCT-START');
|
|
209
|
+
|
|
210
|
+
console.log('PRODUCT-CART-START');
|
|
211
|
+
let user = User_Logic.get_test({generate_id:true});
|
|
212
|
+
let cart_id = Order_Logic.get_order_id();
|
|
213
|
+
Log.w('cccc',cart_id);
|
|
214
|
+
//let product_cart = Product_Logic.get_test_cart(cart_id,user.id,{get_cart_item:true,cart_item_count:1, get_cart_sub_item:true,cart_sub_item_count:1 });
|
|
215
|
+
//let product_cart = Product_Logic.get_test_cart(user.id,{get_cart_item:true,order_item_count:1,get_order_sub_item:true,order_sub_item_count:2 });
|
|
216
|
+
//Log.w('product_cart',product_cart);
|
|
217
|
+
//Log.w('product_cart_item_list',product_order.order_item_list.length);
|
|
218
|
+
//Log.w('product_cart_item_list_len',product_order.order_item_list[0].order_sub_item_list.length);
|
|
219
|
+
//Log.w('product_order',product_order.order_item_list[0].order_sub_item_list.length);
|
|
220
|
+
console.log('PRODUCT-CART-END');
|
|
221
|
+
|
|
222
|
+
/*
|
|
223
|
+
console.log('PRODUCT-ORDER-START');
|
|
224
|
+
let order_id = "OR"+Number.get_id();
|
|
225
|
+
let user = User_Logic.get_test({generate_id:true});
|
|
226
|
+
let product_order = Product_Logic.get_test_order(order_id,user.id,{get_order_item:true,order_item_count:1,get_order_sub_item:true,order_sub_item_count:2 });
|
|
227
|
+
Log.w('product_order',product_order);
|
|
228
|
+
Log.w('product_order_item_list',product_order.order_item_list.length);
|
|
229
|
+
Log.w('product_order_item_list_len',product_order.order_item_list[0].order_sub_item_list.length);
|
|
230
|
+
//Log.w('product_order',product_order.order_item_list[0].order_sub_item_list.length);
|
|
231
|
+
console.log('PRODUCT-ORDER-END');
|
|
232
|
+
*/
|
|
233
|
+
|
|
209
234
|
//let product = Product_Logic.get_test("Product 1",{get_value:true,get_item:true})
|
|
210
235
|
//let product = Product_Logic.get_test("Product 1")
|
|
211
236
|
//let product = Product_Logic.get_test({fields:["date_create"]})
|
|
@@ -222,13 +247,13 @@ describe("connect", () => {
|
|
|
222
247
|
//Log.w("product",product);
|
|
223
248
|
//Log.w("Product_section_1",product.section_1);
|
|
224
249
|
//Log.w("Product_section_1_section_1_section_1",product.section_1.section_1.section_1);
|
|
225
|
-
|
|
226
|
-
|
|
250
|
+
//
|
|
251
|
+
console.log('PRODUCT-END');
|
|
227
252
|
|
|
228
253
|
|
|
229
254
|
/* --ITEM-TEST--START */
|
|
230
|
-
let item = Item_Logic.get_test("Item_" +Number.get_id(),DataType.BLOG_POST,0);
|
|
231
|
-
Log.w('item',item);
|
|
255
|
+
//let item = Item_Logic.get_test("Item_" +Number.get_id(),DataType.BLOG_POST,0);
|
|
256
|
+
//Log.w('item',item);
|
|
232
257
|
/*
|
|
233
258
|
let item_list = Item_Logic.get_test_list(DataType.BLANK,{item_count:10,get_value:true});
|
|
234
259
|
Log.w('item_list',item_list);
|