refactor(utils): 修复密码哈希比较逻辑错误 feat(user): 新增按状态筛选优惠券接口 docs: 添加虚拟发货与任务中心相关文档 fix(wechat): 修正Code2Session上下文传递问题 test: 补充订单折扣与积分转换测试用例 build: 更新配置文件与构建脚本 style: 清理多余的空行与注释
41 lines
1.4 KiB
Go
41 lines
1.4 KiB
Go
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})
|
||
}
|
||
}
|