From 0260b7a960b806e61ccd60597c549dfd595ba584 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期二, 19 九月 2023 11:10:41 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS --- controllers/operation.go | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/controllers/operation.go b/controllers/operation.go index 18a26f7..bbe2288 100644 --- a/controllers/operation.go +++ b/controllers/operation.go @@ -2,6 +2,7 @@ import ( "errors" + "fmt" "github.com/gin-gonic/gin" "wms/extend/code" "wms/extend/util" @@ -25,20 +26,23 @@ var reqParams request.AddOperation var params models.Operation if err := c.BindJSON(&reqParams); err != nil { - util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") + util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�"+err.Error()) + return } if err := structx.AssignTo(reqParams, params); err != nil { util.ResponseFormat(c, code.RequestParamError, "鏁版嵁杞崲閿欒") + return } if err := slf.CheckParams(params); err != nil { util.ResponseFormat(c, code.RequestParamError, err.Error()) + return } if err := models.NewOperationSearch().Create(¶ms); err != nil { logx.Errorf("Operation create err: %v", err) util.ResponseFormat(c, code.SaveFail, "娣诲姞澶辫触锛�"+err.Error()) + return } util.ResponseFormat(c, code.Success, "娣诲姞鎴愬姛") - } func (slf OperationController) CheckParams(params models.Operation) error { @@ -58,7 +62,7 @@ return errors.New("璇烽�夋嫨鐩爣浣嶇疆") } - if params.OperationDate.IsZero() { + if params.OperationDate == "" { return errors.New("璇烽�夋嫨瀹夋帓鏃ユ湡") } @@ -81,6 +85,7 @@ return errors.New("浜у搧鏁伴噺鍑洪敊") } } + fmt.Println(111111) return nil } -- Gitblit v1.8.0