package fronted

import (
	"go-admin/app/admin/service/appservice"
	statuscode "go-admin/common/status_code"

	"go-admin/common/service/common"
	"go-admin/common/service/sysservice/sysstatuscode"

	"github.com/gin-gonic/gin"
	"github.com/go-admin-team/go-admin-core/sdk/api"
)

type MemberRenwalConfig struct {
	api.Api
}

// 获取已激活的续费套餐
func (e MemberRenwalConfig) GetActiveList(c *gin.Context) {
	s := appservice.MemberRenwalConfigAppService{}

	err := e.MakeContext(c).
		MakeOrm().
		MakeService(&s.Service).
		Errors
	if err != nil {
		e.Logger.Error(err)
		e.Error(500, err, err.Error())
		return
	}

	language := common.GetLanguage(c)
	data, code := s.GetList(language)

	if code != statuscode.OK {
		e.Error(code, nil, sysstatuscode.GetStatusCodeDescription(c, code))
	}

	e.OK(data, "success")
}
