biz9-logic 4.9.50 → 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.2.0'
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,7 @@ 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
+
44
45
  static bind_child_parent_obj = (child_obj,parent_obj)=>{
45
46
  for(const prop in parent_obj) {
46
47
  child_obj['parent_'+prop] = parent_obj[prop];
@@ -1613,6 +1614,36 @@ class App_Logic {
1613
1614
  static get_url = (app_id,host,url,param) => {
1614
1615
  return get_cloud_url_main(app_id,host,url,param);
1615
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
+ };
1616
1647
  static url_dashboard_user_home = (app_id,url,param) => {
1617
1648
  let action_url="dashboard/user_home";
1618
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.50",
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,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');
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,11 +37,21 @@ 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
- let user = User_Logic.get_test();
42
- item.id = 333;
43
- item.items = ['a','b'];
44
- Log.w('bind_obj',Item_Logic.bind_child_parent_obj(item,user));
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));
45
55
  //let stat = Stat_Logic.get_new(parent_data_type,parent_id,Type.STAT_VIEW,user_id,item);
46
56
  //Log.w('stat',stat);
47
57
  console.log('CONNECT-BASE-END');