From a98b2ed2ddcf15db5b20907cd502e157d04d1b88 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 20 十月 2023 10:22:06 +0800
Subject: [PATCH] 去掉无用配置
---
controllers/location.go | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/controllers/location.go b/controllers/location.go
index 595a2ba..e545fb9 100644
--- a/controllers/location.go
+++ b/controllers/location.go
@@ -30,6 +30,18 @@
util.ResponseFormat(c, code.RequestParamError, err)
return
}
+ if params.ParentId != 0 {
+ //鏌ヨ涓婄骇鍚嶇О
+ first, err := models.NewLocationSearch().SetID(params.ParentId).First()
+ if err != nil {
+ util.ResponseFormat(c, code.RequestParamError, "鏌ヨ涓婄骇鍚嶇О澶辫触")
+ return
+ }
+ params.JointName = first.JointName + "/" + params.Name
+ } else {
+ params.JointName = params.Name
+ }
+
err := models.NewLocationSearch().Create(¶ms)
if err != nil {
util.ResponseFormat(c, code.RequestParamError, "鍒涘缓澶辫触")
@@ -102,6 +114,25 @@
util.ResponseFormat(c, code.RequestParamError, err)
return
}
+ //index := strings.LastIndex(params.JointName, "/")
+ //if index > 0 {
+ // jn := params.JointName[:index]
+ // oldName := params.JointName[index+1:]
+ // if oldName != params.Name {
+ // params.JointName = jn + "/" + params.Name
+ // }
+ //}
+ if params.ParentId != 0 {
+ //鏌ヨ涓婄骇鍚嶇О
+ first, err := models.NewLocationSearch().SetID(params.ParentId).First()
+ if err != nil {
+ util.ResponseFormat(c, code.RequestParamError, "鏌ヨ涓婄骇鍚嶇О澶辫触")
+ return
+ }
+ params.JointName = first.JointName + "/" + params.Name
+ } else {
+ params.JointName = params.Name
+ }
err := models.NewLocationSearch().Update(¶ms)
if err != nil {
util.ResponseFormat(c, code.RequestParamError, "浣嶇疆淇℃伅鏇存柊澶辫触")
--
Gitblit v1.8.0