update_supplier_invoice.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package handler
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "youngee_b_api/model/http_model"
  5. "youngee_b_api/service"
  6. )
  7. func WrapUpdateSupplierInvoiceHandler(ctx *gin.Context) {
  8. handler := newUpdateSupplierInvoiceHandler(ctx)
  9. baseRun(handler)
  10. }
  11. func newUpdateSupplierInvoiceHandler(ctx *gin.Context) *UpdateSupplierInvoiceHandler {
  12. return &UpdateSupplierInvoiceHandler{
  13. req: http_model.NewUpdateSupplierInvoiceRequest(),
  14. resp: http_model.NewUpdateSupplierInvoiceResponse(),
  15. ctx: ctx,
  16. }
  17. }
  18. type UpdateSupplierInvoiceHandler struct {
  19. req *http_model.UpdateSupplierInvoiceRequest
  20. resp *http_model.CommonResponse
  21. ctx *gin.Context
  22. }
  23. func (h *UpdateSupplierInvoiceHandler) getRequest() interface{} {
  24. return h.req
  25. }
  26. func (h *UpdateSupplierInvoiceHandler) getContext() *gin.Context {
  27. return h.ctx
  28. }
  29. func (h *UpdateSupplierInvoiceHandler) getResponse() interface{} {
  30. return h.resp
  31. }
  32. func (h *UpdateSupplierInvoiceHandler) run() {
  33. err := service.Supplier.UpdateSupplierInvoice(h.ctx, h.req)
  34. if err != nil {
  35. h.resp.Data = err.Error()
  36. h.resp.Message = "更新失败"
  37. }
  38. h.resp.Message = "更新成功"
  39. }
  40. func (h *UpdateSupplierInvoiceHandler) checkParam() error {
  41. return nil
  42. }