123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package add_friend
- import (
- "net/http"
- "github.com/zeromicro/go-zero/rest/httpx"
- "wechat-api/internal/logic/add_friend"
- "wechat-api/internal/svc"
- "wechat-api/internal/types"
- )
- // swagger:route post /add_friend/add_friend_list add_friend AddFriendList
- //
- // 添加好友的列表接口
- //
- // Parameters:
- // + name: body
- // require: true
- // in: body
- // type: AddFriendListReq
- //
- // Responses:
- // 200: AddFriendListResp
- func AddFriendListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- var req types.AddFriendListReq
- if err := httpx.Parse(r, &req, true); err != nil {
- httpx.ErrorCtx(r.Context(), w, err)
- return
- }
- l := add_friend.NewAddFriendListLogic(r.Context(), svcCtx)
- resp, err := l.AddFriendList(&req)
- if err != nil {
- httpx.ErrorCtx(r.Context(), w, err)
- } else {
- httpx.OkJsonCtx(r.Context(), w, resp)
- }
- }
- }
|