package service

import (
	"XT_New/models"
	"github.com/jinzhu/gorm"
)

func GetAppVersionByAppType(apptype int64) (*models.AppVersion, error) {
	var version models.AppVersion
	err := readDb.Model(&models.AppVersion{}).Where("app_type=?", apptype).First(&version).Error
	if err == gorm.ErrRecordNotFound {
		return nil, nil
	}

	if err != nil {
		return nil, err
	}
	return &version, nil
}
