feat: 添加店铺邀请列表查询接口并修复 responded_at 未写入

This commit is contained in:
zetaloop
2026-04-23 15:54:12 +08:00
parent d596d41e1a
commit 83a2f243f4
9 changed files with 300 additions and 13 deletions
+12
View File
@@ -75,6 +75,12 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/shops/:id/invitations",
Handler: shop.InvitePlayerHandler(serverCtx),
},
{
// 获取店铺邀请列表
Method: http.MethodGet,
Path: "/shops/:id/invitations",
Handler: shop.ListShopInvitationsHandler(serverCtx),
},
{
// 移除打手
Method: http.MethodDelete,
@@ -99,6 +105,12 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/shops/invitations/:id/accept",
Handler: shop.AcceptInvitationHandler(serverCtx),
},
{
// 获取我收到的邀请
Method: http.MethodGet,
Path: "/shops/invitations/mine",
Handler: shop.MyInvitationsHandler(serverCtx),
},
{
// 获取当前用户的店铺
Method: http.MethodGet,
@@ -0,0 +1,32 @@
// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1
package shop
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"juwan-backend/app/shop/api/internal/logic/shop"
"juwan-backend/app/shop/api/internal/svc"
"juwan-backend/app/shop/api/internal/types"
)
// 获取店铺邀请列表
func ListShopInvitationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ShopIdReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := shop.NewListShopInvitationsLogic(r.Context(), svcCtx)
resp, err := l.ListShopInvitations(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
@@ -0,0 +1,25 @@
// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1
package shop
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"juwan-backend/app/shop/api/internal/logic/shop"
"juwan-backend/app/shop/api/internal/svc"
)
// 获取我收到的邀请
func MyInvitationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := shop.NewMyInvitationsLogic(r.Context(), svcCtx)
resp, err := l.MyInvitations()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}