package catchbugs import ( "go_dreamfactory/comm" "go_dreamfactory/pb" "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" "go_dreamfactory/utils" ) func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.CatchbugsInfoReq) (errdata *pb.ErrorData) { return } func (this *apiComp) Info(session comm.IUserSession, req *pb.CatchbugsInfoReq) (errdata *pb.ErrorData) { var ( info *pb.DBCatchBugs conf *cfg.GameCatchbugStageData err error ) if errdata = this.InfoCheck(session, req); errdata != nil { return } if info, err = this.module.model.getModel(session.GetUserId()); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, Message: err.Error(), } return } if !utils.IsSameWeek(info.Weektime) { if conf, err = this.module.configure.getNextGameCatchbugStage(info.Level); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound, Message: err.Error(), } return } info.Level = conf.Id info.Integral = 0 info.Weekaward = make(map[int32]bool) info.Weektime = configure.Now().Unix() this.module.model.Change(session.GetUserId(), map[string]interface{}{ "level": info.Level, "integral": info.Integral, "weekaward": info.Weekaward, "weektime": info.Weektime, }) } session.SendMsg(string(this.module.GetType()), "info", &pb.CatchbugsInfoResp{Info: info}) return }