29 lines
718 B
Go
29 lines
718 B
Go
|
package douyin
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
|
||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||
|
"youtu_server/game_open_api/internal/logic/douyin"
|
||
|
"youtu_server/game_open_api/internal/svc"
|
||
|
"youtu_server/game_open_api/internal/types"
|
||
|
)
|
||
|
|
||
|
func DouyinCode2UserIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||
|
var req types.DouyinCode2UserIdRequest
|
||
|
if err := httpx.Parse(r, &req); err != nil {
|
||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
l := douyin.NewDouyinCode2UserIdLogic(r.Context(), svcCtx)
|
||
|
resp, err := l.DouyinCode2UserId(&req)
|
||
|
if err != nil {
|
||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||
|
} else {
|
||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||
|
}
|
||
|
}
|
||
|
}
|