package card_info_walmart

import (
	"context"
	"kami/internal/errHandler"
	"kami/internal/service"

	"github.com/gogf/gf/v2/errors/gcode"
	"github.com/gogf/gf/v2/errors/gerror"

	"kami/api/card_info_walmart/v1"
)

func (c *ControllerV1) GroupDelete(ctx context.Context, req *v1.GroupDeleteReq) (res *v1.GroupDeleteRes, err error) {
	userInfo, err := service.SysAuth().LoginOnlyLogin(ctx)
	if err != nil {
		err = errHandler.WrapError(ctx, gcode.CodeNotAuthorized, err, "权限不足")
		return
	}
	err = service.CardRedeemAccount().GroupDelete(ctx, req.ID, userInfo.Id, nil)
	if err != nil {
		err = gerror.WrapCode(gcode.CodeInvalidParameter, err, "删除失败")
		return
	}
	return
}
