recruit.go 908 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package web
  2. import (
  3. "context"
  4. "encoding/json"
  5. xhttp "net/http"
  6. "net/url"
  7. "go-common/app/interface/main/web-goblin/model/web"
  8. "go-common/library/ecode"
  9. "go-common/library/log"
  10. )
  11. // Recruit .
  12. func (d *Dao) Recruit(ctx context.Context, param url.Values, route *web.Params) (res json.RawMessage, err error) {
  13. var (
  14. req *xhttp.Request
  15. rs json.RawMessage
  16. mokaURI = d.c.Recruit.MokaURI + "/" + route.Route + "/" + d.c.Recruit.Orgid
  17. )
  18. if route.JobID != "" {
  19. mokaURI = mokaURI + "/" + route.JobID
  20. }
  21. param.Del("route")
  22. param.Del("job_id")
  23. if req, err = xhttp.NewRequest("GET", mokaURI+"?"+param.Encode(), nil); err != nil {
  24. log.Error("Recruit xhttp.NewRequest url(%s) error(%v)", mokaURI, err)
  25. return
  26. }
  27. if err = d.httpR.Do(ctx, req, &rs); err != nil {
  28. log.Error("Recruit d.httpR.Do url(%s) error(%v)", mokaURI, err)
  29. err = ecode.NothingFound
  30. return
  31. }
  32. res = rs
  33. return
  34. }