From 1f46bdbb7a02df39041dfaf4c6b3a76440016f0a Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期三, 04 九月 2019 15:16:53 +0800 Subject: [PATCH] add dbpersoncompare query --- controllers/dbtablesCon.go | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/controllers/dbtablesCon.go b/controllers/dbtablesCon.go index 9746d1d..e1e75bf 100644 --- a/controllers/dbtablesCon.go +++ b/controllers/dbtablesCon.go @@ -129,7 +129,35 @@ util.ResponseFormat(c,code.RequestParamError,"鍙傛暟鏈夎") return } + var dtApi dbapi.DbTableApi + dts, err := dtApi.DbtablesById([]string{ds.Id}) + if err !=nil || dts == nil { + util.ResponseFormat(c,code.RequestParamError,"搴曞簱涓嶅瓨鍦�") + return + } + if ds.Enable == 1 { + str := dts[0].StartTime + etr := dts[0].EndTime + ct := time.Now() + st, _ := time.ParseInLocation("2006-01-02 15:04:05", str, time.Local) + b := false + if etr != "" { + et,_ := time.ParseInLocation("2006-01-02 15:04:05", etr, time.Local) + if et.After(ct) && st.Before(ct) { + b = true + } + } else { + if st.Before(ct) { + b = true + } + } + //b 涓簍rue鎵嶅厑璁稿紑鍚� + if !b { + util.ResponseFormat(c,code.UpdateFail,"褰撳墠涓嶅厑璁稿惎鐢�") + return + } + } b,_ := dtApi.UpdateDbTableStatus(ds.Id, ds.Enable) if b { -- Gitblit v1.8.0