package card_info_t_mall_game

import (
	"context"
	"kami/internal/errHandler"
	"kami/utility/config"

	"kami/api/card_info_t_mall_game/v1"

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

func (c *ControllerV1) TMallGameAccountAuthorizeGetKey(ctx context.Context, req *v1.TMallGameAccountAuthorizeGetKeyReq) (res *v1.TMallGameAccountAuthorizeGetKeyRes, err error) {
	cfg, err := config.NewConfig(ctx).GetTMallGame()
	if err != nil {
		err = errHandler.WrapError(ctx, gcode.CodeInvalidParameter, err, "获取天猫游戏配置失败")
		return
	}
	return &v1.TMallGameAccountAuthorizeGetKeyRes{
		Code:        cfg.AppKey,
		RedirectUri: cfg.RedirectUri,
	}, nil
}
