batch_update_label_relationships_handler.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package label_relationship
  2. import (
  3. "net/http"
  4. "github.com/zeromicro/go-zero/rest/httpx"
  5. "wechat-api/internal/logic/label_relationship"
  6. "wechat-api/internal/svc"
  7. "wechat-api/internal/types"
  8. )
  9. // swagger:route post /label_relationship/Batch_update_contact_labels label_relationship BatchUpdateLabelRelationships
  10. //
  11. // Batch Update label relationships information | 批量更新联系人所有 LabelRelationship
  12. //
  13. // Batch Update label relationships information | 批量更新联系人所有 LabelRelationship
  14. //
  15. // Parameters:
  16. // + name: body
  17. // require: true
  18. // in: body
  19. // type: BatchLabelRelationshipsInfo
  20. //
  21. // Responses:
  22. // 200: BaseMsgResp
  23. func BatchUpdateLabelRelationshipsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  24. return func(w http.ResponseWriter, r *http.Request) {
  25. var req types.BatchLabelRelationshipsInfo
  26. if err := httpx.Parse(r, &req, true); err != nil {
  27. httpx.ErrorCtx(r.Context(), w, err)
  28. return
  29. }
  30. l := label_relationship.NewBatchUpdateLabelRelationshipsLogic(r.Context(), svcCtx)
  31. resp, err := l.BatchUpdateLabelRelationships(&req)
  32. if err != nil {
  33. httpx.ErrorCtx(r.Context(), w, err)
  34. } else {
  35. httpx.OkJsonCtx(r.Context(), w, resp)
  36. }
  37. }
  38. }