fix
modify the vetting update
| | |
| | | package v1 |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model" |
| | | "aps_crm/model/request" |
| | | "aps_crm/pkg/contextx" |
| | | "aps_crm/pkg/ecode" |
| | | "aps_crm/utils" |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // Update |
| | | // |
| | | // @Tags Vetting |
| | | // @Summary 更新审批 |
| | | // @Produce application/json |
| | | // @Param object body request.UpdateVetting true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/vetting/update [post] |
| | | func (vet *VettingApi) Update(c *gin.Context) { |
| | | var params request.UpdateVetting |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | vetting, err := model.NewVettingSearch().SetId(params.Id).Get() |
| | | if err != nil { |
| | | ctx.Fail(ecode.VettingNotExist) |
| | | return |
| | | } |
| | | |
| | | waitUse, _ := utils.GetClaims(c) |
| | | // 如何当前用户是超级管理员,则不需要判断 |
| | | if waitUse.UserType != constvar.UserTypeSuper { |
| | | userId := waitUse.UserId |
| | | user, err := model.NewUserSearch(nil).SetId(userId).First() |
| | | if err != nil { |
| | | return |
| | | } |
| | | |
| | | if user.ID != vetting.UserId { |
| | | ctx.Fail(ecode.VettingNotBelongToUser) |
| | | return |
| | | } |
| | | } |
| | | |
| | | vetting.Status = params.Status |
| | | |
| | | errCode := vettingService.UpdateVetting(vetting) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | func checkVettingParams(vetting *request.AddVetting) (int, *model.Vetting) { |
| | | |
| | | v := &model.Vetting{ |
| | |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/vetting/update": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "Vetting" |
| | | ], |
| | | "summary": "更新审批", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateVetting" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "definitions": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateVetting": { |
| | | "type": "object", |
| | | "required": [ |
| | | "id", |
| | | "status" |
| | | ], |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "status": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "response.AccountIdResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api/vetting/update": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "Vetting" |
| | | ], |
| | | "summary": "更新审批", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.UpdateVetting" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "OK", |
| | | "schema": { |
| | | "$ref": "#/definitions/contextx.Response" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "definitions": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.UpdateVetting": { |
| | | "type": "object", |
| | | "required": [ |
| | | "id", |
| | | "status" |
| | | ], |
| | | "properties": { |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "status": { |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "response.AccountIdResponse": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | required: |
| | | - timely_rate |
| | | type: object |
| | | request.UpdateVetting: |
| | | properties: |
| | | id: |
| | | type: integer |
| | | status: |
| | | type: integer |
| | | required: |
| | | - id |
| | | - status |
| | | type: object |
| | | response.AccountIdResponse: |
| | | properties: |
| | | list: |
| | |
| | | summary: 添加审批 |
| | | tags: |
| | | - Vetting |
| | | /api/vetting/update: |
| | | post: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.UpdateVetting' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: OK |
| | | schema: |
| | | $ref: '#/definitions/contextx.Response' |
| | | summary: 更新审批 |
| | | tags: |
| | | - Vetting |
| | | swagger: "2.0" |
| | |
| | | VettingType int `json:"vettingType" form:"vettingType" binding:"required"` |
| | | VettingId int `json:"vettingId" form:"vettingId" binding:"required"` |
| | | } |
| | | |
| | | type UpdateVetting struct { |
| | | Id int `json:"id" form:"id" binding:"required"` |
| | | Status int `json:"status" form:"status" binding:"required"` |
| | | } |
| | |
| | | DepartmentDeleteErr = 4000006 // 删除部门失败 |
| | | DepartmentDeleteErr1 = 4000007 // 该部门下存在用户,无法删除 |
| | | |
| | | VettingExist = 4100001 // 审批已存在 |
| | | VettingNotExist = 4100002 // 审批不存在 |
| | | VettingListErr = 4100003 // 获取审批列表失败 |
| | | VettingSetErr = 4100004 // 设置审批失败 |
| | | VettingExist = 4100001 // 审批已存在 |
| | | VettingNotExist = 4100002 // 审批不存在 |
| | | VettingListErr = 4100003 // 获取审批列表失败 |
| | | VettingSetErr = 4100004 // 设置审批失败 |
| | | VettingNotBelongToUser = 4100005 // 审批不属于当前用户 |
| | | |
| | | SatisfactionExist = 4200001 // 满意度已存在 |
| | | SatisfactionNotExist = 4200002 // 满意度不存在 |
| | |
| | | QuotationStatusSetErr = 5500004 // 设置报价单状态失败 |
| | | QuotationStatusUpdateErr = 5500005 // 更新报价单状态失败 |
| | | |
| | | CurrencyExist = 5600001 // 币种已存在 |
| | | CurrencyNotExist = 5600002 // 币种不存在 |
| | | CurrencyListErr = 5600003 // 获取币种列表失败 |
| | | CurrencySetErr = 5600004 // 设置币种失败 |
| | | CurrencyUpdateErr = 5600005 // 更新币种失败 |
| | | |
| | | CurrencyExist = 5000001 // 币种已存在 |
| | | CurrencyNotExist = 5000002 // 币种不存在 |
| | | CurrencyListErr = 5000003 // 获取币种列表失败 |
| | | CurrencySetErr = 5000004 // 设置币种失败 |
| | | CurrencyUpdateErr = 5000005 // 更新币种失败 |
| | | |
| | | ) |
| | | ) |