package card_info_original_jd

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

	"github.com/gogf/gf/v2/errors/gcode"
	"github.com/gogf/gf/v2/frame/g"

	"kami/api/card_info_original_jd/v1"
)

func (c *ControllerV1) OriginalDownloadTemplate(ctx context.Context, req *v1.OriginalDownloadTemplateReq) (res *v1.OriginalDownloadTemplateRes, err error) {
	_, err = service.SysAuth().LoginOnlyIFrame(ctx)
	if err != nil {
		err = errHandler.WrapError(ctx, gcode.CodeNotAuthorized, err, "权限不足")
		return
	}
	g.RequestFromCtx(ctx).Response.ServeFileDownload("./resource/public/CK导入通用模板.xlsx")
	return
}
