fix: 修复微信通知字段截断导致的编码错误 feat: 添加有效邀请相关字段和任务中心常量 refactor: 重构一番赏奖品格位逻辑 perf: 优化道具卡列表聚合显示 docs: 更新项目说明文档和API文档 test: 添加字符串截断工具测试
44 lines
1.3 KiB
Go
44 lines
1.3 KiB
Go
package app
|
||
|
||
import (
|
||
"net/http"
|
||
|
||
"bindbox-game/internal/code"
|
||
"bindbox-game/internal/pkg/core"
|
||
)
|
||
|
||
type cancelShippingRequest struct {
|
||
InventoryID int64 `json:"inventory_id"`
|
||
}
|
||
|
||
type cancelShippingResponse struct{}
|
||
|
||
// CancelShipping 取消发货申请
|
||
// @Summary 取消发货申请
|
||
// @Description 取消已提交但未发货的申请;恢复库存状态
|
||
// @Tags APP端.用户
|
||
// @Accept json
|
||
// @Produce json
|
||
// @Security LoginVerifyToken
|
||
// @Param user_id path integer true "用户ID"
|
||
// @Param RequestBody body cancelShippingRequest true "请求参数:资产ID"
|
||
// @Success 200 {object} cancelShippingResponse "成功"
|
||
// @Failure 400 {object} code.Failure "参数错误/记录不存在/已处理"
|
||
// @Router /api/app/users/{user_id}/inventory/cancel-shipping [post]
|
||
func (h *handler) CancelShipping() core.HandlerFunc {
|
||
return func(ctx core.Context) {
|
||
req := new(cancelShippingRequest)
|
||
if err := ctx.ShouldBindJSON(req); err != nil || req.InventoryID == 0 {
|
||
ctx.AbortWithError(core.Error(http.StatusBadRequest, code.ParamBindError, "参数错误"))
|
||
return
|
||
}
|
||
userID := int64(ctx.SessionUserInfo().Id)
|
||
err := h.user.CancelShipping(ctx.RequestContext(), userID, req.InventoryID)
|
||
if err != nil {
|
||
ctx.AbortWithError(core.Error(http.StatusBadRequest, 10024, err.Error()))
|
||
return
|
||
}
|
||
ctx.Payload(nil)
|
||
}
|
||
}
|