From 712ef81c6b8813a498a66cf61ffcd37e5c502c8c Mon Sep 17 00:00:00 2001
From: sunty <1172534965@qq.com>
Date: 星期五, 01 十一月 2019 13:45:30 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 controllers/dbtablesCon.go |   28 ++++++++--------------------
 1 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/controllers/dbtablesCon.go b/controllers/dbtablesCon.go
index 7b588a9..30c1625 100644
--- a/controllers/dbtablesCon.go
+++ b/controllers/dbtablesCon.go
@@ -20,6 +20,7 @@
 type DbTableController struct {
 }
 
+// @Security ApiKeyAuth
 // @Summary 鏄剧ず搴曞簱鍒楄〃
 // @Description 鏄剧ず鍚屾鎴栨湰鍦板簱鍒楄〃
 // @Accept  x-www-form-urlencoded
@@ -40,6 +41,7 @@
 	}
 }
 
+// @Security ApiKeyAuth
 // @Summary 鏌ヨ鏈満鎵�鏈夊簳搴撳垪琛�
 // @Description 鏌ヨ鏈満鎵�鏈夊簳搴撳垪琛�
 // @Accept  x-www-form-urlencoded
@@ -77,6 +79,7 @@
 	return data
 }
 
+// @Security ApiKeyAuth
 // @Summary 淇敼搴曞簱
 // @Description 淇敼鍚屾鎴栨湰鍦板簱
 // @Accept  json
@@ -89,29 +92,11 @@
 func (dbt DbTableController) UpdateDbTables(c *gin.Context) {
 	dbtable := new(models.Dbtables)
 	err := c.BindJSON(&dbtable)
-	if err !=nil || dbtable.Id == "" || dbtable.TableName == "" {
+	if err !=nil || dbtable.Id == "" || dbtable.TableName == "" || (dbtable.Enable !=0 && dbtable.Enable !=1) {
 		util.ResponseFormat(c,code.RequestParamError,"鍙傛暟鏈夎")
 		return
 	}
-	currentTime := time.Now()
-	startTime := dbtable.StartTime
-	endTime := ""
-	if dbtable.EndTime != "" {
-		endTime = dbtable.EndTime
-	}
-	st, _ := time.ParseInLocation("2006-01-02 15:04:05", startTime, time.Local)
-	if endTime != "" {
-		et, _ := time.ParseInLocation("2006-01-02 15:04:05", endTime, time.Local)
-		if et.After(currentTime) && st.Before(currentTime) {
-			dbtable.Enable = 1
-		} else {
-			dbtable.Enable = 0
-		}
-	} else if st.Before(currentTime) && endTime == "" {
-		dbtable.Enable = 1
-	} else {
-		dbtable.Enable = 0
-	}
+
 	paramBody := util.Struct2Map(dbtable)
 	var tApi dbapi.DbTableApi
 	b, data := tApi.UpdateDbTables(paramBody)
@@ -143,6 +128,7 @@
 	Enable int `json:"enable"`
 }
 
+// @Security ApiKeyAuth
 // @Summary 淇敼搴曞簱鐘舵��
 // @Description 淇敼鍚屾鎴栨湰鍦板簱搴曞簱鐘舵��
 // @Accept  json
@@ -230,6 +216,7 @@
 	return flag
 }
 
+// @Security ApiKeyAuth
 // @Summary 娣诲姞搴曞簱
 // @Description 娣诲姞鍚屾鎴栨湰鍦板簱
 // @Accept  json
@@ -296,6 +283,7 @@
 	}
 }
 
+// @Security ApiKeyAuth
 // @Summary 鍒犻櫎搴曞簱
 // @Description 鍒犻櫎鍚屾鎴栨湰鍦板簱
 // @Accept  x-www-form-urlencoded

--
Gitblit v1.8.0