Refactor backend APIs to RESTful route patterns.
Align group and conversation handlers/services with path-based endpoints, and unify response/service error handling for related modules. Made-with: Cursor
This commit is contained in:
@@ -500,6 +500,7 @@ func (h *GroupHandler) HandleGetUserGroups(c *gin.Context) {
|
||||
|
||||
// HandleGetMyMemberInfo 获取我在群组中的成员信息
|
||||
// GET /api/v1/groups/get_my_info?group_id=xxx
|
||||
// GET /api/v1/groups/:id/me
|
||||
func (h *GroupHandler) HandleGetMyMemberInfo(c *gin.Context) {
|
||||
userID := parseUserID(c)
|
||||
if userID == "" {
|
||||
@@ -507,7 +508,7 @@ func (h *GroupHandler) HandleGetMyMemberInfo(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
groupID := c.Query("group_id")
|
||||
groupID := parseGroupID(c)
|
||||
if groupID == "" {
|
||||
response.BadRequest(c, "group_id is required")
|
||||
return
|
||||
@@ -840,6 +841,7 @@ func (h *GroupHandler) HandleCreateAnnouncement(c *gin.Context) {
|
||||
|
||||
// HandleGetAnnouncements 获取群公告列表
|
||||
// GET /api/v1/groups/get_announcements?group_id=xxx
|
||||
// GET /api/v1/groups/:id/announcements
|
||||
func (h *GroupHandler) HandleGetAnnouncements(c *gin.Context) {
|
||||
userID := parseUserID(c)
|
||||
if userID == "" {
|
||||
@@ -847,7 +849,7 @@ func (h *GroupHandler) HandleGetAnnouncements(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
groupID := c.Query("group_id")
|
||||
groupID := parseGroupID(c)
|
||||
if groupID == "" {
|
||||
response.BadRequest(c, "group_id is required")
|
||||
return
|
||||
@@ -1724,6 +1726,7 @@ func (h *GroupHandler) HandleRespondInvite(c *gin.Context) {
|
||||
|
||||
// HandleGetGroupInfo 获取群信息
|
||||
// GET /api/v1/groups/get?group_id=xxx
|
||||
// GET /api/v1/groups/:id
|
||||
func (h *GroupHandler) HandleGetGroupInfo(c *gin.Context) {
|
||||
userID := parseUserID(c)
|
||||
if userID == "" {
|
||||
@@ -1731,7 +1734,7 @@ func (h *GroupHandler) HandleGetGroupInfo(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
groupID := c.Query("group_id")
|
||||
groupID := parseGroupID(c)
|
||||
if groupID == "" {
|
||||
response.BadRequest(c, "group_id is required")
|
||||
return
|
||||
@@ -1759,6 +1762,7 @@ func (h *GroupHandler) HandleGetGroupInfo(c *gin.Context) {
|
||||
|
||||
// HandleGetGroupMemberList 获取群成员列表
|
||||
// GET /api/v1/groups/get_members?group_id=xxx
|
||||
// GET /api/v1/groups/:id/members
|
||||
func (h *GroupHandler) HandleGetGroupMemberList(c *gin.Context) {
|
||||
userID := parseUserID(c)
|
||||
if userID == "" {
|
||||
@@ -1766,7 +1770,7 @@ func (h *GroupHandler) HandleGetGroupMemberList(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
groupID := c.Query("group_id")
|
||||
groupID := parseGroupID(c)
|
||||
if groupID == "" {
|
||||
response.BadRequest(c, "group_id is required")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user