| | |
| | | "aps_crm/pkg/ecode" |
| | | "aps_crm/utils" |
| | | "github.com/gin-gonic/gin" |
| | | "strconv" |
| | | ) |
| | | |
| | | type ContractApi struct{} |
| | |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/contract/delete [delete] |
| | | func (s *ContractApi) Delete(c *gin.Context) { |
| | | var params request.DeleteContract |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | id := c.Param("id") |
| | | ctx, _ := contextx.NewContext(c, nil) |
| | | if id == "" { |
| | | ctx.Fail(ecode.ParamsErr) |
| | | return |
| | | } |
| | | |
| | | errCode := contractService.DeleteContract(params.Ids) |
| | | atoi, err := strconv.Atoi(id) |
| | | if err != nil { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "数据转换失败") |
| | | return |
| | | } |
| | | errCode := contractService.DeleteContract(atoi) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |