45 lines
866 B
Go
45 lines
866 B
Go
package user
|
|
|
|
import (
|
|
"errors"
|
|
"go_dreamfactory/lego/sys/log"
|
|
"go_dreamfactory/lego/utils/mapstructure"
|
|
"go_dreamfactory/modules"
|
|
)
|
|
|
|
type (
|
|
IOptions interface {
|
|
modules.IOptions
|
|
}
|
|
Options struct {
|
|
modules.Options
|
|
GroupMaxPlayerNum int32
|
|
GroupMaxIntervalDay int32 //天数
|
|
}
|
|
)
|
|
|
|
func (this *Options) GetDebug() bool {
|
|
return this.Debug
|
|
}
|
|
|
|
func (this *Options) GetLog() log.ILogger {
|
|
return this.Log
|
|
}
|
|
|
|
func (this *Options) LoadConfig(settings map[string]interface{}) (err error) {
|
|
this.GroupMaxPlayerNum = 10000
|
|
this.GroupMaxIntervalDay = 30
|
|
if settings != nil {
|
|
if err = mapstructure.Decode(settings, &this.Options); err != nil {
|
|
return
|
|
}
|
|
if err = mapstructure.Decode(settings, this); err != nil {
|
|
return
|
|
}
|
|
}
|
|
if this.Log = log.NewTurnlog(true, log.Clone("", 4)); this.Log == nil {
|
|
err = errors.New("log is nil")
|
|
}
|
|
return
|
|
}
|