add
wangpengfei
2023-07-20 b54c384d9bb8bec57e0c480d4d65716a3b799370
add

add

satisfaction 满意度模块
add, Delete, update, list
5个文件已添加
9个文件已修改
809 ■■■■■ 已修改文件
api/v1/satisfaction.go 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/serviceFeeManage.go 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 190 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 190 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/index.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/satisfaction.go 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/response/response.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/satisfaction.go 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pkg/ecode/code.go 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/index.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/satisfaction.go 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/index.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/satisfaction.go 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/satisfaction.go
New file
@@ -0,0 +1,112 @@
package v1
import (
    "aps_crm/model"
    "aps_crm/model/request"
    "aps_crm/model/response"
    "aps_crm/pkg/contextx"
    "aps_crm/pkg/ecode"
    "github.com/gin-gonic/gin"
    "strconv"
)
type SatisfactionApi struct{}
// Add
//
//    @Tags        Satisfaction
//    @Summary    添加满意度
//    @Produce    application/json
//    @Param        object    body        request.AddSatisfaction    true    "查询参数"
//    @Success    200        {object}    contextx.Response{}
//    @Router        /api/satisfaction/add [post]
func (s *SatisfactionApi) Add(c *gin.Context) {
    var params request.AddSatisfaction
    ctx, ok := contextx.NewContext(c, &params)
    if !ok {
        return
    }
    satisfaction := new(model.Satisfaction)
    satisfaction.Name = params.Name
    errCode := satisfactionService.AddSatisfaction(satisfaction)
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    ctx.Ok()
}
// Delete
//
//    @Tags        Satisfaction
//    @Summary    删除满意度
//    @Produce    application/json
//    @Param        id    path        int    true    "查询参数"
//    @Success    200    {object}    contextx.Response{}
//    @Router        /api/satisfaction/delete/{id} [delete]
func (s *SatisfactionApi) Delete(c *gin.Context) {
    ctx, ok := contextx.NewContext(c, nil)
    if !ok {
        return
    }
    id, _ := strconv.Atoi(c.Param("id"))
    errCode := satisfactionService.DeleteSatisfaction(id)
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    ctx.Ok()
}
// Update
//
//    @Tags        Satisfaction
//    @Summary    更新满意度
//    @Produce    application/json
//    @Param        object    body        request.UpdateSatisfactions true    "查询参数"
//    @Success    200    {object}    contextx.Response{}
//    @Router        /api/satisfaction/update [put]
func (s *SatisfactionApi) Update(c *gin.Context) {
    var params request.UpdateSatisfactions
    ctx, ok := contextx.NewContext(c, &params)
    if !ok {
        return
    }
    errCode := satisfactionService.UpdateSatisfaction(params.Satisfactions)
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    ctx.Ok()
}
// List
//
//        @Tags        Satisfaction
//        @Summary    满意度列表
//        @Produce    application/json
//     @Success    200    {object}    contextx.Response{data=response.SatisfactionResponse}
//        @Router        /api/satisfaction/list [get]
func (s *SatisfactionApi) List(c *gin.Context) {
    ctx, ok := contextx.NewContext(c, nil)
    if !ok {
        return
    }
    satisfactions, errCode := satisfactionService.GetSatisfactionList()
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
    ctx.OkWithDetailed(response.SatisfactionResponse{
        List: satisfactions,
    })
}
api/v1/serviceFeeManage.go
@@ -33,6 +33,14 @@
        return
    }
    code, client := checkClientParams(params.Client)
    if code != ecode.OK {
        ctx.Fail(code)
        return
    }
    serviceFeeManage.Client = client
    errCode = serviceFeeManageService.AddServiceFeeManage(&serviceFeeManage)
    if errCode != ecode.OK {
        ctx.Fail(errCode)
@@ -135,9 +143,9 @@
    //    return ecode.InvalidParams, result
    //}
    if serviceFeeManage.MemberId == 0 {
        return ecode.InvalidParams, result
    }
    //if serviceFeeManage.MemberId == 0 {
    //    return ecode.InvalidParams, result
    //}
    t, err := checkTimeFormat(serviceFeeManage.LatestDate)
    if err != nil {
docs/docs.go
@@ -4162,6 +4162,125 @@
                }
            }
        },
        "/api/satisfaction/add": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Satisfaction"
                ],
                "summary": "添加满意度",
                "parameters": [
                    {
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.AddSatisfaction"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/contextx.Response"
                        }
                    }
                }
            }
        },
        "/api/satisfaction/delete/{id}": {
            "delete": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Satisfaction"
                ],
                "summary": "删除满意度",
                "parameters": [
                    {
                        "type": "integer",
                        "description": "查询参数",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/contextx.Response"
                        }
                    }
                }
            }
        },
        "/api/satisfaction/list": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Satisfaction"
                ],
                "summary": "满意度列表",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/contextx.Response"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/definitions/response.SatisfactionResponse"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/api/satisfaction/update": {
            "put": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Satisfaction"
                ],
                "summary": "更新满意度",
                "parameters": [
                    {
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.UpdateSatisfactions"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/contextx.Response"
                        }
                    }
                }
            }
        },
        "/api/serviceContract/add": {
            "post": {
                "produces": [
@@ -5630,6 +5749,9 @@
        "model.MasterOrder": {
            "type": "object",
            "properties": {
                "client": {
                    "$ref": "#/definitions/model.Client"
                },
                "client_id": {
                    "type": "integer"
                },
@@ -6011,6 +6133,9 @@
                "addressee": {
                    "type": "string"
                },
                "client": {
                    "$ref": "#/definitions/model.Client"
                },
                "clientId": {
                    "type": "integer"
                },
@@ -6204,6 +6329,17 @@
                }
            }
        },
        "model.Satisfaction": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "model.ServiceContract": {
            "type": "object",
            "properties": {
@@ -6342,6 +6478,9 @@
        "model.SubOrder": {
            "type": "object",
            "properties": {
                "client": {
                    "$ref": "#/definitions/model.Client"
                },
                "clientId": {
                    "type": "integer"
                },
@@ -7091,6 +7230,17 @@
            }
        },
        "request.AddSalesSources": {
            "type": "object",
            "required": [
                "name"
            ],
            "properties": {
                "name": {
                    "type": "string"
                }
            }
        },
        "request.AddSatisfaction": {
            "type": "object",
            "required": [
                "name"
@@ -8857,6 +9007,35 @@
                }
            }
        },
        "request.UpdateSatisfaction": {
            "type": "object",
            "required": [
                "id",
                "name"
            ],
            "properties": {
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "request.UpdateSatisfactions": {
            "type": "object",
            "required": [
                "satisfactions"
            ],
            "properties": {
                "satisfactions": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/request.UpdateSatisfaction"
                    }
                }
            }
        },
        "request.UpdateServiceContract": {
            "type": "object",
            "properties": {
@@ -9611,6 +9790,17 @@
                }
            }
        },
        "response.SatisfactionResponse": {
            "type": "object",
            "properties": {
                "list": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.Satisfaction"
                    }
                }
            }
        },
        "response.ServiceContractsResponse": {
            "type": "object",
            "properties": {
docs/swagger.json
@@ -4150,6 +4150,125 @@
                }
            }
        },
        "/api/satisfaction/add": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Satisfaction"
                ],
                "summary": "添加满意度",
                "parameters": [
                    {
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.AddSatisfaction"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/contextx.Response"
                        }
                    }
                }
            }
        },
        "/api/satisfaction/delete/{id}": {
            "delete": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Satisfaction"
                ],
                "summary": "删除满意度",
                "parameters": [
                    {
                        "type": "integer",
                        "description": "查询参数",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/contextx.Response"
                        }
                    }
                }
            }
        },
        "/api/satisfaction/list": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Satisfaction"
                ],
                "summary": "满意度列表",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/contextx.Response"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/definitions/response.SatisfactionResponse"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/api/satisfaction/update": {
            "put": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Satisfaction"
                ],
                "summary": "更新满意度",
                "parameters": [
                    {
                        "description": "查询参数",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.UpdateSatisfactions"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/contextx.Response"
                        }
                    }
                }
            }
        },
        "/api/serviceContract/add": {
            "post": {
                "produces": [
@@ -5618,6 +5737,9 @@
        "model.MasterOrder": {
            "type": "object",
            "properties": {
                "client": {
                    "$ref": "#/definitions/model.Client"
                },
                "client_id": {
                    "type": "integer"
                },
@@ -5999,6 +6121,9 @@
                "addressee": {
                    "type": "string"
                },
                "client": {
                    "$ref": "#/definitions/model.Client"
                },
                "clientId": {
                    "type": "integer"
                },
@@ -6192,6 +6317,17 @@
                }
            }
        },
        "model.Satisfaction": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "model.ServiceContract": {
            "type": "object",
            "properties": {
@@ -6330,6 +6466,9 @@
        "model.SubOrder": {
            "type": "object",
            "properties": {
                "client": {
                    "$ref": "#/definitions/model.Client"
                },
                "clientId": {
                    "type": "integer"
                },
@@ -7079,6 +7218,17 @@
            }
        },
        "request.AddSalesSources": {
            "type": "object",
            "required": [
                "name"
            ],
            "properties": {
                "name": {
                    "type": "string"
                }
            }
        },
        "request.AddSatisfaction": {
            "type": "object",
            "required": [
                "name"
@@ -8845,6 +8995,35 @@
                }
            }
        },
        "request.UpdateSatisfaction": {
            "type": "object",
            "required": [
                "id",
                "name"
            ],
            "properties": {
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "request.UpdateSatisfactions": {
            "type": "object",
            "required": [
                "satisfactions"
            ],
            "properties": {
                "satisfactions": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/request.UpdateSatisfaction"
                    }
                }
            }
        },
        "request.UpdateServiceContract": {
            "type": "object",
            "properties": {
@@ -9599,6 +9778,17 @@
                }
            }
        },
        "response.SatisfactionResponse": {
            "type": "object",
            "properties": {
                "list": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.Satisfaction"
                    }
                }
            }
        },
        "response.ServiceContractsResponse": {
            "type": "object",
            "properties": {
docs/swagger.yaml
@@ -404,6 +404,8 @@
    type: object
  model.MasterOrder:
    properties:
      client:
        $ref: '#/definitions/model.Client'
      client_id:
        type: integer
      end_time:
@@ -654,6 +656,8 @@
        type: string
      addressee:
        type: string
      client:
        $ref: '#/definitions/model.Client'
      clientId:
        type: integer
      conditions:
@@ -781,6 +785,13 @@
      name:
        type: string
    type: object
  model.Satisfaction:
    properties:
      id:
        type: integer
      name:
        type: string
    type: object
  model.ServiceContract:
    properties:
      clientId:
@@ -872,6 +883,8 @@
    type: object
  model.SubOrder:
    properties:
      client:
        $ref: '#/definitions/model.Client'
      clientId:
        type: integer
      id:
@@ -1377,6 +1390,13 @@
        $ref: '#/definitions/request.SalesReturn'
    type: object
  request.AddSalesSources:
    properties:
      name:
        type: string
    required:
    - name
    type: object
  request.AddSatisfaction:
    properties:
      name:
        type: string
@@ -2574,6 +2594,25 @@
          $ref: '#/definitions/request.UpdateSalesSources'
        type: array
    type: object
  request.UpdateSatisfaction:
    properties:
      id:
        type: integer
      name:
        type: string
    required:
    - id
    - name
    type: object
  request.UpdateSatisfactions:
    properties:
      satisfactions:
        items:
          $ref: '#/definitions/request.UpdateSatisfaction'
        type: array
    required:
    - satisfactions
    type: object
  request.UpdateServiceContract:
    properties:
      clientId:
@@ -3074,6 +3113,13 @@
      list:
        items:
          $ref: '#/definitions/model.SalesSources'
        type: array
    type: object
  response.SatisfactionResponse:
    properties:
      list:
        items:
          $ref: '#/definitions/model.Satisfaction'
        type: array
    type: object
  response.ServiceContractsResponse:
@@ -5654,6 +5700,79 @@
      summary: 更新商机来源
      tags:
      - SalesSources
  /api/satisfaction/add:
    post:
      parameters:
      - description: 查询参数
        in: body
        name: object
        required: true
        schema:
          $ref: '#/definitions/request.AddSatisfaction'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/contextx.Response'
      summary: 添加满意度
      tags:
      - Satisfaction
  /api/satisfaction/delete/{id}:
    delete:
      parameters:
      - description: 查询参数
        in: path
        name: id
        required: true
        type: integer
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/contextx.Response'
      summary: 删除满意度
      tags:
      - Satisfaction
  /api/satisfaction/list:
    get:
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            allOf:
            - $ref: '#/definitions/contextx.Response'
            - properties:
                data:
                  $ref: '#/definitions/response.SatisfactionResponse'
              type: object
      summary: 满意度列表
      tags:
      - Satisfaction
  /api/satisfaction/update:
    put:
      parameters:
      - description: 查询参数
        in: body
        name: object
        required: true
        schema:
          $ref: '#/definitions/request.UpdateSatisfactions'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/contextx.Response'
      summary: 更新满意度
      tags:
      - Satisfaction
  /api/serviceContract/add:
    post:
      parameters:
model/index.go
@@ -63,6 +63,7 @@
        Authority{},
        Api{},
        Department{},
        Satisfaction{},
    )
    return err
}
model/request/satisfaction.go
New file
@@ -0,0 +1,14 @@
package request
type AddSatisfaction struct {
    Name string `json:"name" binding:"required"`
}
type UpdateSatisfaction struct {
    Id   int    `json:"id" binding:"required"`
    Name string `json:"name" binding:"required"`
}
type UpdateSatisfactions struct {
    Satisfactions []*UpdateSatisfaction `json:"satisfactions" binding:"required"`
}
model/response/response.go
@@ -220,4 +220,8 @@
    DepartmentResponse struct {
        List []*model.Department `json:"list"`
    }
    SatisfactionResponse struct {
        List []*model.Satisfaction `json:"list"`
    }
)
model/satisfaction.go
New file
@@ -0,0 +1,79 @@
package model
import (
    "aps_crm/pkg/mysqlx"
    "gorm.io/gorm"
)
type (
    Satisfaction struct {
        Id   int    `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
        Name string `json:"name" gorm:"column:name;type:varchar(255);comment:满意度名称"`
    }
    SatisfactionSearch struct {
        Satisfaction
        Orm *gorm.DB
    }
)
func (Satisfaction) TableName() string {
    return "satisfaction"
}
func NewSatisfactionSearch() *SatisfactionSearch {
    return &SatisfactionSearch{
        Orm: mysqlx.GetDB(),
    }
}
func (slf *SatisfactionSearch) build() *gorm.DB {
    var db = slf.Orm.Model(&Satisfaction{})
    if slf.Id != 0 {
        db = db.Where("id = ?", slf.Id)
    }
    if slf.Name != "" {
        db = db.Where("name = ?", slf.Name)
    }
    return db
}
func (slf *SatisfactionSearch) Create(record *Satisfaction) error {
    var db = slf.build()
    return db.Create(record).Error
}
func (slf *SatisfactionSearch) Delete() error {
    var db = slf.build()
    return db.Delete(&Satisfaction{}).Error
}
func (slf *SatisfactionSearch) Update(record *Satisfaction) error {
    var db = slf.build()
    return db.Updates(record).Error
}
func (slf *SatisfactionSearch) Find() (*Satisfaction, error) {
    var db = slf.build()
    var record = new(Satisfaction)
    err := db.First(record).Error
    return record, err
}
func (slf *SatisfactionSearch) FindAll() ([]*Satisfaction, error) {
    var db = slf.build()
    var records = make([]*Satisfaction, 0)
    err := db.Find(&records).Error
    return records, err
}
func (slf *SatisfactionSearch) SetId(id int) *SatisfactionSearch {
    slf.Id = id
    return slf
}
func (slf *SatisfactionSearch) Updates(data map[string]interface{}) error {
    var db = slf.build()
    return db.Updates(data).Error
}
pkg/ecode/code.go
@@ -292,4 +292,9 @@
    VettingListErr  = 4100003 // 获取审批列表失败
    VettingSetErr   = 4100004 // 设置审批失败
    SatisfactionExist     = 4200001 // 满意度已存在
    SatisfactionNotExist  = 4200002 // 满意度不存在
    SatisfactionListErr   = 4200003 // 获取满意度列表失败
    SatisfactionSetErr    = 4200004 // 设置满意度失败
    SatisfactionUpdateErr = 4200005 // 更新满意度失败
)
router/index.go
@@ -54,6 +54,7 @@
    MenuRouter
    DataRouter
    DepartmentRouter
    SatisfactionRouter
}
func InitRouter() *gin.Engine {
@@ -127,6 +128,7 @@
        routerGroup.InitMenuRouter(PrivateGroup)                 // 注册menu路由
        routerGroup.InitDataRouter(PrivateGroup)                 // 注册data路由
        routerGroup.InitDepartmentRouter(PrivateGroup)           // 注册department路由
        routerGroup.InitSatisfactionRouter(PrivateGroup)         // 注册satisfaction路由
    }
    return Router
}
router/satisfaction.go
New file
@@ -0,0 +1,19 @@
package router
import (
    v1 "aps_crm/api/v1"
    "github.com/gin-gonic/gin"
)
type SatisfactionRouter struct{}
func (s *SatisfactionRouter) InitSatisfactionRouter(router *gin.RouterGroup) {
    satisfactionRouter := router.Group("satisfaction")
    satisfactionApi := v1.ApiGroup.SatisfactionApi
    {
        satisfactionRouter.POST("add", satisfactionApi.Add)             // 添加满意度
        satisfactionRouter.DELETE("delete/:id", satisfactionApi.Delete) // 删除满意度
        satisfactionRouter.PUT("update", satisfactionApi.Update)        // 更新满意度
        satisfactionRouter.GET("list", satisfactionApi.List)            // 获取满意度列表
    }
}
service/index.go
@@ -45,6 +45,7 @@
    DataServer
    DepartmentService
    VettingService
    SatisfactionService
}
var ServiceGroup = new(Group)
service/satisfaction.go
New file
@@ -0,0 +1,59 @@
package service
import (
    "aps_crm/model"
    "aps_crm/model/request"
    "aps_crm/pkg/ecode"
)
type SatisfactionService struct{}
func (SatisfactionService) AddSatisfaction(satisfaction *model.Satisfaction) int {
    err := model.NewSatisfactionSearch().Create(satisfaction)
    if err != nil {
        return ecode.SatisfactionExist
    }
    return ecode.OK
}
func (SatisfactionService) DeleteSatisfaction(id int) int {
    _, err := model.NewSatisfactionSearch().SetId(id).Find()
    if err != nil {
        return ecode.SatisfactionNotExist
    }
    err = model.NewSatisfactionSearch().SetId(id).Delete()
    if err != nil {
        return ecode.SatisfactionNotExist
    }
    return ecode.OK
}
func (SatisfactionService) GetSatisfactionList() ([]*model.Satisfaction, int) {
    list, err := model.NewSatisfactionSearch().FindAll()
    if err != nil {
        return nil, ecode.SatisfactionListErr
    }
    return list, ecode.OK
}
func (SatisfactionService) UpdateSatisfaction(satisfactions []*request.UpdateSatisfaction) int {
    for _, v := range satisfactions {
        // check satisfaction exist
        _, err := model.NewSatisfactionSearch().SetId(v.Id).Find()
        if err != nil {
            return ecode.SatisfactionNotExist
        }
        err = model.NewSatisfactionSearch().SetId(v.Id).Updates(map[string]interface{}{
            "name": v.Name,
        })
        if err != nil {
            return ecode.SatisfactionSetErr
        }
    }
    return ecode.OK
}