package card_info_original_jd

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

	"kami/api/card_info_original_jd/v1"

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

func (c *ControllerV1) OriginalJDAccountDelete(ctx context.Context, req *v1.OriginalJDAccountDeleteReq) (res *v1.OriginalJDAccountDeleteRes, err error) {
	_, err = service.SysAuth().LoginOnlyIFrame(ctx)
	if err != nil {
		err = errHandler.WrapError(ctx, gcode.CodeNotAuthorized, err, "权限不足")
		return
	}
	accountService := service.CardRedeemAccount()
	err = accountService.Delete(ctx, req.ID, consts.CardRedeemAccountCategoryOriginalJD, nil)
	return
}
