package typeManage

import "log-server/global"

type LoginType struct {
	Id              int64     `gorm:"column:id;" json:"id"`
	LoginName       string    `gorm:"column:login_name;" json:"login_name"`
	LoginDesc       string    `gorm:"column:login_desc;" json:"login_desc"`
	DisplaySequence int64     `gorm:"column:display_sequence;" json:"display_sequence"`
	GameCounts      int64     `gorm:"column:game_counts;" json:"game_counts"`
	CreatedAt       LocalTime `gorm:"column:create_time;" json:"createdAt"`
	UpdatedAt       LocalTime `gorm:"column:update_time;" json:"updatedAt"`
}

func (m *LoginType) GetLoginTypeData() (mps map[int64]LoginType, err error) {
	var loginType []LoginType
	err = global.GVA_DB.Table("login_type").Find(&loginType).Error
	if err != nil {
		return
	}
	if len(loginType) == 0 {
		return
	}
	var mp = map[int64]LoginType{}
	for _, pc := range loginType {
		mp[pc.Id] = pc
	}
	return mp, err
}
