| | |
| | | package test |
| | | |
| | | import ( |
| | | "github.com/flipped-aurora/gin-vue-admin/server/global" |
| | | "github.com/flipped-aurora/gin-vue-admin/server/model/common/request" |
| | | "github.com/flipped-aurora/gin-vue-admin/server/model/common/response" |
| | | "github.com/flipped-aurora/gin-vue-admin/server/model/test" |
| | | testReq "github.com/flipped-aurora/gin-vue-admin/server/model/test/request" |
| | | "github.com/flipped-aurora/gin-vue-admin/server/service" |
| | | "github.com/flipped-aurora/gin-vue-admin/server/utils" |
| | | "github.com/gin-gonic/gin" |
| | | "go.uber.org/zap" |
| | | "srm/global" |
| | | "srm/model/common/request" |
| | | "srm/model/common/response" |
| | | "srm/model/test" |
| | | testReq "srm/model/test/request" |
| | | "srm/service" |
| | | "srm/utils" |
| | | ) |
| | | |
| | | type SupplierApi struct { |
| | |
| | | var s test.Supplier |
| | | err := c.ShouldBindJSON(&s) |
| | | if err != nil { |
| | | response.FailWithMessage(err.Error(), c) |
| | | return |
| | | } |
| | | verify := utils.Rules{ |
| | | "Name": {utils.NotEmpty()}, |
| | | "ResponsiblePersonId": {utils.NotEmpty()}, |
| | | } |
| | | if err := utils.Verify(s, verify); err != nil { |
| | | response.FailWithMessage(err.Error(), c) |
| | | return |
| | | } |
| | |
| | | }, "获取成功", c) |
| | | } |
| | | } |
| | | |
| | | // ChangeSupplierStatus 修改Supplier状态 |
| | | // @Tags Supplier |
| | | // @Summary 修改Supplier状态 |
| | | // @Security ApiKeyAuth |
| | | // @accept application/json |
| | | // @Produce application/json |
| | | // @Param data body testReq.SupplierStatus true "修改Supplier状态" |
| | | // @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" |
| | | // @Router /s/changeSupplierStatus [post] |
| | | func (sApi *SupplierApi) ChangeSupplierStatus(c *gin.Context) { |
| | | var params testReq.SupplierStatus |
| | | err := c.ShouldBindJSON(¶ms) |
| | | if err != nil { |
| | | response.FailWithMessage(err.Error(), c) |
| | | return |
| | | } |
| | | if err := sService.ChangeStatus(params.Id, params.Status); err != nil { |
| | | global.GVA_LOG.Error("修改失败!", zap.Error(err)) |
| | | response.FailWithMessage("修改失败", c) |
| | | } else { |
| | | response.OkWithMessage("修改成功", c) |
| | | } |
| | | } |