biz9-logic 4.9.48 → 4.9.50
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 -120
- package/package.json +1 -1
- package/test.js +6 -9
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -41,6 +41,12 @@ class Item_Logic {
|
|
|
41
41
|
const item = DataItem.get_new(data_type,0,{title:title,title_url:Str.get_title_url(title),setting_visible:"1"});
|
|
42
42
|
return item;
|
|
43
43
|
};
|
|
44
|
+
static bind_child_parent_obj = (child_obj,parent_obj)=>{
|
|
45
|
+
for(const prop in parent_obj) {
|
|
46
|
+
child_obj['parent_'+prop] = parent_obj[prop];
|
|
47
|
+
}
|
|
48
|
+
return child_obj;
|
|
49
|
+
};
|
|
44
50
|
static get_test = (title,data_type,id,option)=>{
|
|
45
51
|
data_type = data_type ? data_type : DataType.BLANK;
|
|
46
52
|
id = id ? id : 0;
|
|
@@ -117,8 +123,6 @@ class Title {
|
|
|
117
123
|
static SOCIAL_URL_INSTAGRAM="https://instagram.com/";
|
|
118
124
|
static SOCIAL_URL_YOUTUBE="https://youtube.com/";
|
|
119
125
|
static SOCIAL_URL_LINKEDIN="https://linkedin.com/";
|
|
120
|
-
//stat
|
|
121
|
-
static STAT_NUMBER="ST-";
|
|
122
126
|
//str
|
|
123
127
|
static CATEGORY='Category';
|
|
124
128
|
static DESCRIPTION='Description';
|
|
@@ -410,24 +414,14 @@ class Type {
|
|
|
410
414
|
}
|
|
411
415
|
}
|
|
412
416
|
class Stat_Logic {
|
|
413
|
-
static get_new = (parent_data_type,stat_type,user_id) => {
|
|
414
|
-
|
|
417
|
+
static get_new = (parent_data_type,parent_id,stat_type,user_id,post_data) => {
|
|
418
|
+
let new_stat = DataItem.get_new(DataType.STAT,0,
|
|
415
419
|
{
|
|
416
420
|
user_id:user_id,
|
|
417
|
-
stat_number:Title.STAT_NUMBER + Num.get_id(99999),
|
|
418
421
|
stat_type:stat_type,
|
|
419
422
|
parent_data_type:parent_data_type,
|
|
420
|
-
|
|
423
|
+
parent_id:parent_id
|
|
421
424
|
});
|
|
422
|
-
};
|
|
423
|
-
static get_new_stat_item = (stat,post_data) =>{
|
|
424
|
-
let new_stat = DataItem.get_new(DataType.STAT_ITEM,0,{
|
|
425
|
-
parent_data_type:stat.parent_data_type,
|
|
426
|
-
parent_id:!Str.check_is_null(post_data.parent_id)?post_data.parent_id:post_data.id,
|
|
427
|
-
stat_type:stat.stat_type,
|
|
428
|
-
stat_number:stat.stat_number,
|
|
429
|
-
user_id:stat.user_id
|
|
430
|
-
});
|
|
431
425
|
if(!Obj.check_is_empty(post_data)){
|
|
432
426
|
new_stat = Obj.merge(new_stat,Stat_Logic.filter_stat(post_data));
|
|
433
427
|
}
|
|
@@ -444,108 +438,6 @@ class Stat_Logic {
|
|
|
444
438
|
return filter_stat;
|
|
445
439
|
}
|
|
446
440
|
}
|
|
447
|
-
class Stat_Logic_Old {
|
|
448
|
-
static get_new = (user_id,stat_type,post_data)=>{
|
|
449
|
-
console.log('4444444444444');
|
|
450
|
-
Log.w('55_user_id',user_id);
|
|
451
|
-
Log.w('66_stat_type',stat_type);
|
|
452
|
-
Log.w('77_post_data',post_data);
|
|
453
|
-
let stat = DataItem.get_new(DataType.STAT,0,{user_id:user_id,stat_type:stat_type,post_data_list:[]});
|
|
454
|
-
console.log('55555555');
|
|
455
|
-
if(post_data[Type.PARENT_ID] && post_data[Type.PARENT_DATA_TYPE]){
|
|
456
|
-
console.log('666666666666');
|
|
457
|
-
stat.post_data[Type.PARENT_ID] = post_data[Type.PARENT_ID];
|
|
458
|
-
stat.post_data[Type.PARENT_DATA_TYPE] = post_data[Type.PARENT_DATA_TYPE];
|
|
459
|
-
}else{
|
|
460
|
-
console.log('77777777777777');
|
|
461
|
-
console.log(post_data);
|
|
462
|
-
/*
|
|
463
|
-
console.log(post_data[Type.ID]);
|
|
464
|
-
stat.post_data[Type.PARENT_ID] = post_data[Type.ID];
|
|
465
|
-
stat.post_data[Type.PARENT_DATA_TYPE] = post_data[Type.DATA_TYPE];
|
|
466
|
-
*/
|
|
467
|
-
}
|
|
468
|
-
/*
|
|
469
|
-
for(const prop in post_data) {
|
|
470
|
-
if (Object.prototype.hasOwnProperty.call(post_data, prop)){
|
|
471
|
-
const value = post_data[prop];
|
|
472
|
-
}else if (!Array.isArray(value) && prop != Type.DATE_CREATE && prop != Type.DATE_SAVE ) {
|
|
473
|
-
stat.post_data[prop] = post_data[prop];
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
*/
|
|
477
|
-
Log.w('88_post_data',stat);
|
|
478
|
-
|
|
479
|
-
//return stat;
|
|
480
|
-
}
|
|
481
|
-
static get_user_activity_filter = (user_id_filter) =>{
|
|
482
|
-
return {
|
|
483
|
-
$and: [
|
|
484
|
-
{ $or: [ { type: Type.STAT_LOGIN }, { type: Type.STAT_REGISTER } ] },
|
|
485
|
-
user_id_filter
|
|
486
|
-
]
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
static url_search_activity = (app_id,url,param) => {
|
|
490
|
-
let action_url="item/search_activity";
|
|
491
|
-
return get_cloud_url_main(app_id,url,action_url,param);
|
|
492
|
-
};
|
|
493
|
-
static get_new_user = (user_id,stat_type,data)=>{
|
|
494
|
-
return {
|
|
495
|
-
user_id:user_id,
|
|
496
|
-
type:stat_type,
|
|
497
|
-
data:data,
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
static old_get_new = (user_id,stat_type,parent_item_list,data)=>{
|
|
501
|
-
let stat_list = [];
|
|
502
|
-
for(const item of parent_item_list){
|
|
503
|
-
let stat = DataItem.get_new(DataType.STAT,0);
|
|
504
|
-
stat.user_id=user_id;
|
|
505
|
-
stat.type=stat_type;
|
|
506
|
-
if(item.parent_id){
|
|
507
|
-
stat.parent_id=item.parent_id;
|
|
508
|
-
stat.parent_data_type=item.parent_data_type;
|
|
509
|
-
}else{
|
|
510
|
-
stat.parent_id=item.id;
|
|
511
|
-
stat.parent_data_type=item.data_type;
|
|
512
|
-
}
|
|
513
|
-
if(item.cost){
|
|
514
|
-
stat.parent_cost = item.cost;
|
|
515
|
-
}
|
|
516
|
-
if(item.quanity){
|
|
517
|
-
stat.parent_quanity = item.quanity;
|
|
518
|
-
}
|
|
519
|
-
if(item.data_type==DataType.CART_ITEM){
|
|
520
|
-
stat.parent_cart_id = item.cart_id;
|
|
521
|
-
stat.parent_cart_number = item.cart_number;
|
|
522
|
-
}
|
|
523
|
-
if(item.data_type==DataType.ORDER_ITEM){
|
|
524
|
-
stat.parent_order_id = item.order_id;
|
|
525
|
-
stat.parent_order_number = item.order_number;
|
|
526
|
-
}
|
|
527
|
-
if(item.data_type==DataType.ORDER_PAYMENT){
|
|
528
|
-
stat.parent_order_number = item.order_number;
|
|
529
|
-
stat.parent_payment_method_type = item.payment_method_type;
|
|
530
|
-
stat.parent_payment_amount = item.payment_amount;
|
|
531
|
-
stat.parent_transaction_id = item.transaction_id;
|
|
532
|
-
}
|
|
533
|
-
if(item.data_type==DataType.REVIEW){
|
|
534
|
-
stat.rating = item.rating;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
stat_list.push(stat);
|
|
538
|
-
};
|
|
539
|
-
return stat_list;
|
|
540
|
-
};
|
|
541
|
-
static get_new_activity = (user_id,stat_type,activity_data)=>{
|
|
542
|
-
return {
|
|
543
|
-
user_id:user_id,
|
|
544
|
-
type:stat_type,
|
|
545
|
-
activity:data,
|
|
546
|
-
}
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
441
|
class Page_Logic {
|
|
550
442
|
static get_page_list(){
|
|
551
443
|
return [
|
|
@@ -1338,12 +1230,10 @@ static APP='app_biz';
|
|
|
1338
1230
|
static SERVICE='service_biz';
|
|
1339
1231
|
static SECURITY='security_biz';
|
|
1340
1232
|
static STAT='stat_biz';
|
|
1341
|
-
static STAT_ITEM='stat_item_biz';
|
|
1342
1233
|
static TEMPLATE='template_biz';
|
|
1343
1234
|
static TYPE='type_biz';
|
|
1344
1235
|
static USER='user_biz';
|
|
1345
1236
|
static VIDEO='video_biz';
|
|
1346
|
-
|
|
1347
1237
|
}
|
|
1348
1238
|
class Favorite_Logic {
|
|
1349
1239
|
static get_new = (parent_data_type,parent_id,user_id) =>{
|
|
@@ -1353,13 +1243,18 @@ class Favorite_Logic {
|
|
|
1353
1243
|
user_id:user_id
|
|
1354
1244
|
});
|
|
1355
1245
|
}
|
|
1356
|
-
static
|
|
1246
|
+
static old_get_favorite_by_list = (favorite_list,item_list) =>{
|
|
1247
|
+
if(!item_list){
|
|
1248
|
+
item_list = [];
|
|
1249
|
+
}
|
|
1250
|
+
if(item_list.length>0){
|
|
1357
1251
|
favorite_list.forEach(item => {
|
|
1358
1252
|
const item_match = item_list.find(item_find => item_find.id === item.parent_id);
|
|
1359
1253
|
if (item_match) {
|
|
1360
1254
|
item_match.is_favorite = true;
|
|
1361
1255
|
}
|
|
1362
1256
|
});
|
|
1257
|
+
}
|
|
1363
1258
|
return item_list;
|
|
1364
1259
|
}
|
|
1365
1260
|
static get_user_search_filter = (item_data_type,user_id) =>{
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const series = require('async-series');
|
|
2
|
-
const {DataItem,DataType,Item_Logic,Page_Logic,Product_Logic,Type,Title,Stat_Logic,Service_Logic,Blog_Post_Logic,Event_Logic,Demo_Logic,Cart_Logic,Order_Logic} = require('./index');
|
|
2
|
+
const {DataItem,DataType,Item_Logic,User_Logic,Page_Logic,Product_Logic,Type,Title,Stat_Logic,Service_Logic,Blog_Post_Logic,Event_Logic,Demo_Logic,Cart_Logic,Order_Logic} = require('./index');
|
|
3
3
|
const {Log,Num,Str} = require('biz9-utility');
|
|
4
4
|
const {Scriptz}= require('biz9-scriptz');
|
|
5
5
|
|
|
@@ -35,18 +35,15 @@ describe("connect", () => {
|
|
|
35
35
|
let data_type = DataType.PRODUCT;
|
|
36
36
|
let id = 0;
|
|
37
37
|
let parent_data_type = DataType.PRODUCT;
|
|
38
|
-
let parent_id =
|
|
38
|
+
let parent_id = 3334;
|
|
39
39
|
let user_id = 0;
|
|
40
40
|
let item = Product_Logic.get_test();
|
|
41
|
+
let user = User_Logic.get_test();
|
|
41
42
|
item.id = 333;
|
|
42
43
|
item.items = ['a','b'];
|
|
43
|
-
|
|
44
|
-
let stat = Stat_Logic.get_new(
|
|
45
|
-
|
|
46
|
-
//Log.w('33_stat',item);
|
|
47
|
-
//Log.w('11_stat',stat);
|
|
48
|
-
//Log.w('22_stat_item',stat_item);
|
|
49
|
-
|
|
44
|
+
Log.w('bind_obj',Item_Logic.bind_child_parent_obj(item,user));
|
|
45
|
+
//let stat = Stat_Logic.get_new(parent_data_type,parent_id,Type.STAT_VIEW,user_id,item);
|
|
46
|
+
//Log.w('stat',stat);
|
|
50
47
|
console.log('CONNECT-BASE-END');
|
|
51
48
|
}
|
|
52
49
|
/*
|