zhangqian
2023-11-13 a8849056eebef42a33353e8652de13822f440632
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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, &params)
    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()
}