data_api_get_data_combo_free.go 942 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2019 getensh.com. All rights reserved.
  2. // Use of this source code is governed by getensh.com.
  3. package data_api
  4. import (
  5. "context"
  6. "gd_management/apis"
  7. "encoding/json"
  8. "fmt"
  9. "gd_management/errors"
  10. "gd_management/common.in/jsonrpc2"
  11. "gd_management/common.in/utils"
  12. "go.uber.org/zap"
  13. )
  14. func GetDataComboFree(ctx context.Context, req *apis.GetDataComboFreeReq, reply *apis.GetDataComboFreeReply) (err error) {
  15. // 捕获各个task中的异常并返回给调用者
  16. defer func() {
  17. if r := recover(); r != nil {
  18. err = fmt.Errorf("%+v", r)
  19. e := &jsonrpc2.Error{}
  20. if er := json.Unmarshal([]byte(err.Error()), e); er != nil {
  21. l.Error("err",
  22. zap.String("system_err", err.Error()),
  23. zap.Stack("stacktrace"))
  24. }
  25. }
  26. }()
  27. if req.QueryTypeId <= 0 {
  28. l.Error("argument",
  29. zap.String("call", "check"),
  30. zap.String("fields", utils.MarshalJsonString(req)))
  31. return errors.ArgsError
  32. }
  33. return nil
  34. }