package appservice

import (
	"go-admin/app/admin/models"
	memberrenwalconfigstatus "go-admin/common/const/dicts/member_renwal_config_status"
	memberrenwalisvisible "go-admin/common/const/dicts/member_renwal_isvisible"
	statuscode "go-admin/common/status_code"

	"github.com/go-admin-team/go-admin-core/sdk/service"
)

type MemberRenwalConfigAppService struct {
	service.Service
}

func (e *MemberRenwalConfigAppService) GetList() ([]models.MemberRenwalConfig, int) {
	result := make([]models.MemberRenwalConfig, 0)
	if err := e.Orm.Model(&models.MemberRenwalConfig{}).Where(" status =? AND is_visible =?", memberrenwalconfigstatus.ENABLE, memberrenwalisvisible.IsVisibleYes).Order("sort asc").Find(&result).Error; err != nil {
		return result, statuscode.ServerError
	}
	return result, statuscode.OK
}
