liuxiulin 2 年之前
父节点
当前提交
0e4ccb353f
共有 2 个文件被更改,包括 6 次插入7 次删除
  1. 1 2
      services/knowoapi/model/rule_chain.go
  2. 5 5
      services/knowoapi/services/rule_chain.go

+ 1 - 2
services/knowoapi/model/rule_chain.go

@@ -67,8 +67,7 @@ func (a *RuleChain) Update(ruleChain *models.RuleChain) error {
 }
 
 // UpdateChainRoot 设置规则链
-func (a *RuleChain) UpdateChainRoot(vendorId, id string, isRoot int) (data models.RuleChain, err error) {
-	fmt.Printf("+++++++++++++%d+_+++++++++++", isRoot)
+func (a *RuleChain) UpdateChainRoot(vendorId, id string, isRoot bool) (data models.RuleChain, err error) {
 	err = a.db.Model(&data).Where("vendor_id = ? and record_id = ?", vendorId, id).
 		Update("root", isRoot).Error
 	return

+ 5 - 5
services/knowoapi/services/rule_chain.go

@@ -233,11 +233,11 @@ func (a ruleChainService) Update(params *models.RuleChainParams) error {
 }
 
 func (a ruleChainService) UpdateChainRoot(params *models.ChangeRootParams) error {
-	var isRoot int = 0
-	if params.Root {
-		isRoot = 1
-	}
-	_, err := a.model.RuleChain.UpdateChainRoot(params.VendorId, params.RecordId, isRoot)
+	//var isRoot int = 0
+	//if params.Root {
+	//	isRoot = 1
+	//}
+	_, err := a.model.RuleChain.UpdateChainRoot(params.VendorId, params.RecordId, params.Root)
 	if err != nil {
 		return err
 	}