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()
|
}
|