package card_info_walmart

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

	"kami/api/card_info_walmart/v1"

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

func (c *ControllerV1) AccountDelete(ctx context.Context, req *v1.AccountDeleteReq) (res *v1.AccountDeleteRes, err error) {
	_, err = service.SysAuth().LoginWithIFrameAndLogin(ctx)
	if err != nil {
		err = errHandler.WrapError(ctx, gcode.CodeNotAuthorized, err, "权限不足")
		return
	}
	err = service.CardRedeemAccount().Delete(ctx, req.ID, consts.CardRedeemAccountCategoryWalMart, nil)
	return
}
