finstore.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package client
  2. import (
  3. "context"
  4. "encoding/json"
  5. "errors"
  6. "mop-account-system/common"
  7. )
  8. type NotifyFinstoreAccountInfoUpReq struct {
  9. TraceId string `json:"traceId"`
  10. SubId string `json:"subId"`
  11. Type string `json:"type"`
  12. Data map[string]interface{} `json:"data"`
  13. }
  14. func NotifyFinstoreAccountInfoUp(ctx context.Context, organId string, m map[string]interface{}) error {
  15. var headers = map[string]string{
  16. "Accept": "application/json, text/plain, */*",
  17. "Content-Type": "application/json",
  18. }
  19. req := NotifyFinstoreAccountInfoUpReq{}
  20. req.Type = "upOrganInfo"
  21. req.TraceId = organId
  22. req.Data = m
  23. body, _ := json.Marshal(req)
  24. url := cfg.NotifyFinstoreInfoUpUrl
  25. rsp, err := Request(ctx).SetHeaders(headers).SetBody(body).Patch(url)
  26. if err != nil {
  27. common.GinLog.Error("NotifyFinstoreAccountInfoUp err:" + err.Error())
  28. return err
  29. }
  30. if rsp.StatusCode() != 200 {
  31. common.GinLog.Error("NotifyFinstoreAccountInfoUp status err:" + rsp.String())
  32. return errors.New("status err")
  33. }
  34. return nil
  35. }