package card_info_apple

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

	"kami/api/card_info_apple/v1"

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

func (c *ControllerV1) CardInfoUpdateStatus(ctx context.Context, req *v1.CardInfoUpdateStatusReq) (res *v1.CardInfoUpdateStatusRes, err error) {
	_, err = service.SysAuth().LoginOnlyIFrame(ctx)
	if err != nil {
		err = errHandler.WrapError(ctx, gcode.CodeInternalError, err, "登录校验失败")
		return
	}
	err = service.AppleAccount().ModifyStatus(ctx, req.ID, req.Status, nil)
	if err != nil {
		err = errHandler.WrapError(ctx, gcode.CodeInternalError, err, "修改账户状态失败")
	}
	return
}
