linkOtherTimeOut.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package operate
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/sirupsen/logrus"
  5. "youngee_m_api/consts"
  6. "youngee_m_api/db"
  7. "youngee_m_api/model/http_model"
  8. "youngee_m_api/util"
  9. )
  10. func WrapLinkOtherTimeOutHandler(ctx *gin.Context) {
  11. handler := newLinkOtherTimeOutHandler(ctx)
  12. BaseRun(handler)
  13. }
  14. type LinkOtherTimeOutHandler struct {
  15. ctx *gin.Context
  16. req *http_model.LinkOtherTimeOutRequest
  17. resp *http_model.CommonResponse
  18. }
  19. func (l LinkOtherTimeOutHandler) getContext() *gin.Context {
  20. return l.ctx
  21. }
  22. func (l LinkOtherTimeOutHandler) getResponse() interface{} {
  23. return l.resp
  24. }
  25. func (l LinkOtherTimeOutHandler) getRequest() interface{} {
  26. return l.req
  27. }
  28. func (l LinkOtherTimeOutHandler) run() {
  29. rate := l.req.Rate
  30. err := db.UpdateAutoDefaultRate(l.ctx, rate, 12)
  31. if err != nil {
  32. logrus.WithContext(l.ctx).Errorf("[LinkOtherTimeOutHandler] error UpdateAutoDefaultRate, err:%+v", err)
  33. util.HandlerPackErrorResp(l.resp, consts.ErrorInternal, consts.DefaultToast)
  34. return
  35. }
  36. l.resp.Message = "已更新自报价、固定稿费类型的链接违约超时未上传的扣款比率"
  37. }
  38. func (l LinkOtherTimeOutHandler) checkParam() error {
  39. return nil
  40. }
  41. func newLinkOtherTimeOutHandler(ctx *gin.Context) *LinkOtherTimeOutHandler {
  42. return &LinkOtherTimeOutHandler{
  43. ctx: ctx,
  44. req: http_model.NewLinkOtherTimeOutRequest(),
  45. resp: http_model.NewLinkOtherTimeOutResponse(),
  46. }
  47. }