From b3a47cb555076c25c64d83dd455a472509291245 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期一, 13 十一月 2023 16:09:35 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/crm --- api/v1/assign.go | 93 ++++++++++++++++++++++------------------------ 1 files changed, 44 insertions(+), 49 deletions(-) diff --git a/api/v1/assign.go b/api/v1/assign.go index c4218df..f7618e5 100644 --- a/api/v1/assign.go +++ b/api/v1/assign.go @@ -1,49 +1,44 @@ -package v1 - -import ( - "aps_crm/model/request" - "aps_crm/pkg/contextx" - "aps_crm/pkg/ecode" - "github.com/gin-gonic/gin" -) - -type AssignApi struct{} - -// Assign -// -// @Tags Assign -// @Summary 鍒嗛厤 -// @Produce application/json -// @Param object body request.Assign true "鏌ヨ鍙傛暟" -// @Success 200 {object} contextx.Response{} -// @Router /api/assign/assign [post] -func (au *AssignApi) Assign(c *gin.Context) { - var params request.Assign - ctx, ok := contextx.NewContext(c, ¶ms) - if !ok { - return - } - - if params.MemberId == 0 { - ctx.Fail(ecode.AssignWrongMemberId) - return - } - - if len(params.Ids) == 0 { - ctx.Fail(ecode.AssignWrongId) - return - } - - if params.Type == "" { - ctx.Fail(ecode.AssignWrongModelType) - return - } - - errCode := assignService.Assign(params.MemberId, params.Ids, params.Type) - if errCode != ecode.OK { - ctx.Fail(errCode) - return - } - - ctx.Ok() -} +package v1 + +import ( + "aps_crm/model/request" + "aps_crm/pkg/contextx" + "aps_crm/pkg/ecode" + "github.com/gin-gonic/gin" +) + +type AssignApi struct{} + +// Assign +// +// @Tags Assign +// @Summary 鍒嗛厤 +// @Produce application/json +// @Param object body request.Assign true "鏌ヨ鍙傛暟" +// @Success 200 {object} contextx.Response{} +// @Router /api/assign/assign [post] +func (au *AssignApi) Assign(c *gin.Context) { + var params request.Assign + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + if len(params.Ids) == 0 { + ctx.Fail(ecode.AssignWrongId) + return + } + + if params.Type == "" { + ctx.Fail(ecode.AssignWrongModelType) + return + } + + errCode := assignService.Assign(params.MemberId, params.Ids, params.Type) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.Ok() +} -- Gitblit v1.8.0