This commit is contained in:
withchao 2023-03-28 17:11:04 +08:00
parent 18156980d9
commit ff65eeddba

View File

@ -5,6 +5,8 @@ import (
"fmt"
"github.com/OpenIMSDK/Open-IM-Server/pkg/a2r"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mcontext"
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/third"
@ -64,6 +66,11 @@ func (o *Third) GetURL(c *gin.Context) {
a2r.Call(third.ThirdClient.GetUrl, o.client, c)
return
}
operationID := c.Query("operationID")
if operationID == "" {
c.String(http.StatusBadRequest, "operationID is empty")
return
}
name := c.Query("name")
if name == "" {
c.String(http.StatusBadRequest, "name is empty")
@ -79,7 +86,8 @@ func (o *Third) GetURL(c *gin.Context) {
c.String(http.StatusInternalServerError, err.Error())
return
}
resp, err := client.GetUrl(c, &third.GetUrlReq{Name: name, Expires: expires})
c.Set(constant.OperationID, operationID)
resp, err := client.GetUrl(mcontext.SetOperationID(c, operationID), &third.GetUrlReq{Name: name, Expires: expires})
if err != nil {
if errs.ErrArgs.Is(err) {
c.String(http.StatusBadRequest, err.Error())