bindbox-game/internal/api/user/address_share_revoke_app.go
邹方成 45815bfb7d chore: 清理无用文件与优化代码结构
refactor(utils): 修复密码哈希比较逻辑错误
feat(user): 新增按状态筛选优惠券接口
docs: 添加虚拟发货与任务中心相关文档
fix(wechat): 修正Code2Session上下文传递问题
test: 补充订单折扣与积分转换测试用例
build: 更新配置文件与构建脚本
style: 清理多余的空行与注释
2025-12-18 17:35:55 +08:00

41 lines
1.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package app
import (
"net/http"
"bindbox-game/internal/code"
"bindbox-game/internal/pkg/core"
)
type addressShareRevokeRequest struct {
InventoryID int64 `json:"inventory_id"`
}
// RevokeAddressShare 撤销共享地址链接(极简方案,仅前端态)
// @Summary 撤销共享地址链接
// @Description 极简方案下为前端态操作:不落库令牌,撤销仅用于提示与禁用旧链接(可忽略服务端状态)
// @Tags APP端.用户
// @Accept json
// @Produce json
// @Param user_id path integer true "用户ID"
// @Security LoginVerifyToken
// @Param RequestBody body addressShareRevokeRequest true "请求参数资产ID"
// @Success 200 {object} okResponse
// @Failure 400 {object} code.Failure "参数错误"
// @Router /api/app/users/{user_id}/inventory/address-share/revoke [post]
func (h *handler) RevokeAddressShare() core.HandlerFunc {
return func(ctx core.Context) {
req := new(addressShareRevokeRequest)
if err := ctx.ShouldBindJSON(req); err != nil || req.InventoryID == 0 {
ctx.AbortWithError(core.Error(http.StatusBadRequest, code.ParamBindError, "参数错误"))
return
}
userID := int64(ctx.SessionUserInfo().Id)
if err := h.user.RevokeAddressShare(ctx.RequestContext(), userID, req.InventoryID); err != nil {
ctx.AbortWithError(core.Error(http.StatusBadRequest, 10021, err.Error()))
return
}
ctx.Payload(okResponse{Ok: true})
}
}