biz9-logic 4.9.48 → 4.9.49

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 CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='9.1.8'
1
+ VERSION='9.1.9'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -410,24 +410,15 @@ class Type {
410
410
  }
411
411
  }
412
412
  class Stat_Logic {
413
- static get_new = (parent_data_type,stat_type,user_id) => {
414
- return DataItem.get_new(DataType.STAT,0,
413
+ static get_new = (parent_data_type,parent_id,stat_type,user_id,post_data) => {
414
+ let new_stat = DataItem.get_new(DataType.STAT,0,
415
415
  {
416
416
  user_id:user_id,
417
417
  stat_number:Title.STAT_NUMBER + Num.get_id(99999),
418
418
  stat_type:stat_type,
419
419
  parent_data_type:parent_data_type,
420
- stat_item_list:[]
420
+ parent_id:parent_id
421
421
  });
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
422
  if(!Obj.check_is_empty(post_data)){
432
423
  new_stat = Obj.merge(new_stat,Stat_Logic.filter_stat(post_data));
433
424
  }
@@ -444,108 +435,6 @@ class Stat_Logic {
444
435
  return filter_stat;
445
436
  }
446
437
  }
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
438
  class Page_Logic {
550
439
  static get_page_list(){
551
440
  return [
@@ -1338,12 +1227,10 @@ static APP='app_biz';
1338
1227
  static SERVICE='service_biz';
1339
1228
  static SECURITY='security_biz';
1340
1229
  static STAT='stat_biz';
1341
- static STAT_ITEM='stat_item_biz';
1342
1230
  static TEMPLATE='template_biz';
1343
1231
  static TYPE='type_biz';
1344
1232
  static USER='user_biz';
1345
1233
  static VIDEO='video_biz';
1346
-
1347
1234
  }
1348
1235
  class Favorite_Logic {
1349
1236
  static get_new = (parent_data_type,parent_id,user_id) =>{
@@ -1353,13 +1240,18 @@ class Favorite_Logic {
1353
1240
  user_id:user_id
1354
1241
  });
1355
1242
  }
1356
- static get_favorite_by_list = (favorite_list,item_list) =>{
1243
+ static old_get_favorite_by_list = (favorite_list,item_list) =>{
1244
+ if(!item_list){
1245
+ item_list = [];
1246
+ }
1247
+ if(item_list.length>0){
1357
1248
  favorite_list.forEach(item => {
1358
1249
  const item_match = item_list.find(item_find => item_find.id === item.parent_id);
1359
1250
  if (item_match) {
1360
1251
  item_match.is_favorite = true;
1361
1252
  }
1362
1253
  });
1254
+ }
1363
1255
  return item_list;
1364
1256
  }
1365
1257
  static get_user_search_filter = (item_data_type,user_id) =>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.9.48",
3
+ "version": "4.9.49",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -35,18 +35,14 @@ 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 = 0;
38
+ let parent_id = 3334;
39
39
  let user_id = 0;
40
40
  let item = Product_Logic.get_test();
41
41
  item.id = 333;
42
42
  item.items = ['a','b'];
43
43
  console.log('here');
44
- let stat = Stat_Logic.get_new(data_type,Type.STAT_VIEW,user_id);
45
- let stat_item = Stat_Logic.get_new_stat_item(stat,item);
46
- //Log.w('33_stat',item);
47
- //Log.w('11_stat',stat);
48
- //Log.w('22_stat_item',stat_item);
49
-
44
+ let stat = Stat_Logic.get_new(parent_data_type,parent_id,Type.STAT_VIEW,user_id,item);
45
+ Log.w('stat',stat);
50
46
  console.log('CONNECT-BASE-END');
51
47
  }
52
48
  /*