浏览代码

Merge branch 'feature/contact_field_template' into debug

* feature/contact_field_template:
  fixbug
boweniac 2 周之前
父节点
当前提交
8a25dd193f
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. 8 6
      internal/logic/contact/update_contact_logic.go

+ 8 - 6
internal/logic/contact/update_contact_logic.go

@@ -98,12 +98,14 @@ func UpdateContactFields(ctx context.Context, tx *ent.Tx, contact_id uint64, fie
 				if len(field.Value) == 0 {
 				if len(field.Value) == 0 {
 					field.Value = []string{""}
 					field.Value = []string{""}
 				}
 				}
-				_, err := tx.ContactField.UpdateOneID(f.ID).
-					SetValue(field.Value).
-					Save(ctx)
-				if err != nil {
-					return err
-				}
+			} else {
+				field.Value = []string{""}
+			}
+			_, err := tx.ContactField.UpdateOneID(f.ID).
+				SetValue(field.Value).
+				Save(ctx)
+			if err != nil {
+				return err
 			}
 			}
 		}
 		}
 	}
 	}