From aa91d7884e7fef55b47d6a4905596f72a5ef1ac3 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期六, 30 五月 2020 17:43:03 +0800 Subject: [PATCH] fix sdkType unTar --- controllers/dbtableperson.go | 49 ++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 40 insertions(+), 9 deletions(-) diff --git a/controllers/dbtableperson.go b/controllers/dbtableperson.go index 6112be3..3142978 100644 --- a/controllers/dbtableperson.go +++ b/controllers/dbtableperson.go @@ -14,7 +14,6 @@ "webserver/service" "github.com/gin-gonic/gin" - "github.com/satori/go.uuid" "webserver/extend/code" "webserver/extend/config" "webserver/extend/util" @@ -48,26 +47,58 @@ paramBody := util.Struct2Map(dbperson) b, data := pApi.AddDbPerson(paramBody) if b { - util.ResponseFormat(c, code.Success, data) + util.ResponseFormat(c, code.AddSuccess, data) } else { - util.ResponseFormat(c, code.ServiceInsideError, "") + util.ResponseFormat(c, code.ComError, "") + } +} + + +type MultiCarNo struct { + TableId string `json:"tableId" binding:"required"` + CarNos []string `json:"carNos" binding:"required"` +} + +// @Security ApiKeyAuth +// @Summary 鎵归噺娣诲姞搴曞簱杞﹁締 +// @Description 鎵归噺娣诲姞搴曞簱杞﹁締 +// @Accept json +// @Produce json +// @Tags dbperson 搴曞簱浜哄憳 +// @Param reqBody body controllers.MultiCarNo true "鎵归噺杞︾墝鍙�" +// @Success 200 {string} json "{"code":200, msg:"", success:true}" +// @Failure 500 {string} json "{"code":500, msg:"", success:false}" +// @Router /data/api-v/dbperson/multiUploadCarNo [post] +func (dbc DbPersonController) MultiUploadCarNo(c *gin.Context) { + var reqBody MultiCarNo + err := c.BindJSON(&reqBody) + if err != nil { + util.ResponseFormat(c, code.RequestParamError, "") + return + } + logger.Debug("multiUploadCarNo reqBody:", reqBody) + var pApi dbapi.DbPersonApi + paramBody := util.Struct2Map(reqBody) + if pApi.MultiUploadCarNo(paramBody) { + util.ResponseFormat(c,code.UploadSuccess,"涓婁紶鎴愬姛") + } else { + util.ResponseFormat(c,code.ComError,"") } } func addDbPerson(dbperson *models.Dbtablepersons) (result map[string]interface{}) { - personId := uuid.NewV4().String() - dbperson.Id = personId dbperson.PriInsert() var pApi dbapi.DbPersonApi paramBody := util.Struct2Map(dbperson) - b, _ := pApi.AddDbPerson(paramBody) + b, d := pApi.AddDbPerson(paramBody) result = map[string]interface{}{} if b { result["code"] = 200 + personMap := util.Struct2Map(d) data := make(map[string]interface{}) - data["uuid"] = personId + data["uuid"] = personMap["id"] result["data"] = data result["success"] = true result["msg"] = "娣诲姞鎴愬姛" @@ -102,9 +133,9 @@ paramBody := util.Struct2Map(dbperson) b, data := pApi.UpdateDbPerson(paramBody) if b { - util.ResponseFormat(c, code.Success, data) + util.ResponseFormat(c, code.UpdateSuccess, data) } else { - util.ResponseFormat(c, code.ServiceInsideError, "") + util.ResponseFormat(c, code.UpdateFail, "") } } -- Gitblit v1.8.0