biz9-logic 4.9.49 → 4.9.51

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.9'
1
+ VERSION='9.2.1'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -41,6 +41,13 @@ 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
+
45
+ static bind_child_parent_obj = (child_obj,parent_obj)=>{
46
+ for(const prop in parent_obj) {
47
+ child_obj['parent_'+prop] = parent_obj[prop];
48
+ }
49
+ return child_obj;
50
+ };
44
51
  static get_test = (title,data_type,id,option)=>{
45
52
  data_type = data_type ? data_type : DataType.BLANK;
46
53
  id = id ? id : 0;
@@ -117,8 +124,6 @@ class Title {
117
124
  static SOCIAL_URL_INSTAGRAM="https://instagram.com/";
118
125
  static SOCIAL_URL_YOUTUBE="https://youtube.com/";
119
126
  static SOCIAL_URL_LINKEDIN="https://linkedin.com/";
120
- //stat
121
- static STAT_NUMBER="ST-";
122
127
  //str
123
128
  static CATEGORY='Category';
124
129
  static DESCRIPTION='Description';
@@ -414,7 +419,6 @@ class Stat_Logic {
414
419
  let new_stat = DataItem.get_new(DataType.STAT,0,
415
420
  {
416
421
  user_id:user_id,
417
- stat_number:Title.STAT_NUMBER + Num.get_id(99999),
418
422
  stat_type:stat_type,
419
423
  parent_data_type:parent_data_type,
420
424
  parent_id:parent_id
@@ -1610,6 +1614,36 @@ class App_Logic {
1610
1614
  static get_url = (app_id,host,url,param) => {
1611
1615
  return get_cloud_url_main(app_id,host,url,param);
1612
1616
  };
1617
+ static bind_item_parent_user_list = (item,parent_item,user)=>{
1618
+ for(const prop in parent_item) {
1619
+ item['parent_'+prop] = parent_item[prop];
1620
+ }
1621
+ for(const prop in user) {
1622
+ item['user_'+prop] = user[prop];
1623
+ }
1624
+ return item;
1625
+ };
1626
+ static bind_item_parent_user_list = (item_list)=>{
1627
+ for(let item of item_list) {
1628
+ item = App_Logic.bind_item_parent_user_obj(item);
1629
+ }
1630
+ return item_list;
1631
+ };
1632
+ static bind_item_parent_user_obj = (item)=>{
1633
+ if(!item.user){
1634
+ item.user = {};
1635
+ }
1636
+ if(!item.parent_item){
1637
+ item.parent_item = {};
1638
+ }
1639
+ for(const prop in item.parent_item) {
1640
+ item['parent_'+prop] = item.parent_item[prop];
1641
+ }
1642
+ for(const prop in item.user) {
1643
+ item['user_'+prop] = item.user[prop];
1644
+ }
1645
+ return item;
1646
+ };
1613
1647
  static url_dashboard_user_home = (app_id,url,param) => {
1614
1648
  let action_url="dashboard/user_home";
1615
1649
  return get_cloud_url_main(app_id,url,action_url,param);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.9.49",
3
+ "version": "4.9.51",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
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,App_Logic} = require('./index');
3
3
  const {Log,Num,Str} = require('biz9-utility');
4
4
  const {Scriptz}= require('biz9-scriptz');
5
5
 
@@ -37,12 +37,23 @@ describe("connect", () => {
37
37
  let parent_data_type = DataType.PRODUCT;
38
38
  let parent_id = 3334;
39
39
  let user_id = 0;
40
- let item = Product_Logic.get_test();
41
- item.id = 333;
42
- item.items = ['a','b'];
43
- console.log('here');
44
- let stat = Stat_Logic.get_new(parent_data_type,parent_id,Type.STAT_VIEW,user_id,item);
45
- Log.w('stat',stat);
40
+ let item_list = [];
41
+ for(let a = 0; a < 3;a++){
42
+ let item = Product_Logic.get_test();
43
+ let parent_item = Product_Logic.get_test();
44
+ let user = User_Logic.get_test();
45
+ item.parent_item = parent_item;
46
+ item.user = user;
47
+ item_list.push(item);
48
+ }
49
+ //Log.w('item_list',item_list);
50
+ Log.w('bind_obj_list',App_Logic.bind_item_parent_user_list(item_list));
51
+
52
+ //item.id = 333;
53
+ //item.items = ['a','b'];
54
+ //Log.w('bind_obj',App_Logic.bind_item_parent_user_obj(item,parent_item,user));
55
+ //let stat = Stat_Logic.get_new(parent_data_type,parent_id,Type.STAT_VIEW,user_id,item);
56
+ //Log.w('stat',stat);
46
57
  console.log('CONNECT-BASE-END');
47
58
  }
48
59
  /*