更改module命名

This commit is contained in:
wh_zcy 2023-05-29 17:06:41 +08:00
parent 392c7d3ecf
commit b3e16d641e
12 changed files with 29 additions and 47 deletions

View File

@ -5,7 +5,7 @@ import (
"go_dreamfactory/pb"
)
//黑名单列表
// 黑名单列表
func (this *apiComp) BlacklistCheck(session comm.IUserSession, req *pb.FriendBlackListReq) (code pb.ErrorCode) {
return
}

View File

@ -7,7 +7,7 @@ import (
"go_dreamfactory/utils"
)
//删除好友
// 删除好友
func (this *apiComp) DelCheck(session comm.IUserSession, req *pb.FriendDelReq) (code pb.ErrorCode) {
if req.FriendId == "" {
code = pb.ErrorCode_ReqParameterError

View File

@ -7,7 +7,7 @@ import (
"go_dreamfactory/utils"
)
//删除黑名单
// 删除黑名单
func (this *apiComp) DelblackCheck(session comm.IUserSession, req *pb.FriendDelBlackReq) (code pb.ErrorCode) {
if req.FriendId == "" {
code = pb.ErrorCode_ReqParameterError

View File

@ -17,7 +17,7 @@ func (this *apiComp) RefuseCheck(session comm.IUserSession, req *pb.FriendRefuse
return
}
//单个/批量拒绝
// 单个/批量拒绝
func (this *apiComp) Refuse(session comm.IUserSession, req *pb.FriendRefuseReq) (code pb.ErrorCode, data *pb.ErrorData) {
if code = this.RefuseCheck(session, req); code != pb.ErrorCode_Success {
return

View File

@ -7,7 +7,7 @@ import (
"go_dreamfactory/utils"
)
//搜索
// 搜索
func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.FriendSearchReq) (code pb.ErrorCode) {
if req.NickName == "" {
code = pb.ErrorCode_FriendSearchNameEmpty

View File

@ -14,12 +14,12 @@ const (
type apiComp struct {
modules.MCompGate
service core.IService
moduleLinestory *ModuleLinestory
module *ModuleLinestory
}
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompGate.Init(service, module, comp, options)
this.moduleLinestory = module.(*ModuleLinestory)
this.module = module.(*ModuleLinestory)
this.service = service
return
}

View File

@ -12,12 +12,12 @@ func (this *apiComp) ChapterCheck(session comm.IUserSession, req *pb.LinestoryCh
func (this *apiComp) Chapter(session comm.IUserSession, req *pb.LinestoryChapterReq) (code pb.ErrorCode, data *pb.ErrorData) {
uid := session.GetUserId()
taskMap := this.moduleLinestory.modelLinestory.getChapters(uid)
taskMap := this.module.modelLinestory.getChapters(uid)
rsp := &pb.LinestoryChapterResp{
TaskChapter: taskMap,
}
if err := session.SendMsg(string(this.moduleLinestory.GetType()), LinestorySubTypeChapter, rsp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), LinestorySubTypeChapter, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return

View File

@ -9,7 +9,7 @@ import (
// 支线剧情-我的主线任务
func (this *apiComp) MaintaskCheck(session comm.IUserSession, req *pb.LinestoryMaintaskReq) (code pb.ErrorCode) {
if req.ChapterId == 0 {
this.moduleLinestory.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
this.module.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
code = pb.ErrorCode_ReqParameterError
}
return
@ -22,13 +22,13 @@ func (this *apiComp) Maintask(session comm.IUserSession, req *pb.LinestoryMainta
uid := session.GetUserId()
// 我的主线任务
list := this.moduleLinestory.modelLinestory.getMaintasks(uid, req.ChapterId)
list := this.module.modelLinestory.getMaintasks(uid, req.ChapterId)
rsp := &pb.LinestoryMaintaskResp{
List: list,
}
if err := session.SendMsg(string(this.moduleLinestory.GetType()), LinestorySubTypeMaintask, rsp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), LinestorySubTypeMaintask, rsp); err != nil {
code = pb.ErrorCode_SystemError
return
}

View File

@ -11,7 +11,7 @@ import (
// 章节奖励领取
func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.LinestoryReceiveReq) (code pb.ErrorCode) {
if req.ChapterId == 0 {
this.moduleLinestory.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
this.module.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
code = pb.ErrorCode_ReqParameterError
}
return
@ -22,27 +22,27 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.LinestoryReceive
return
}
uid := session.GetUserId()
conf := this.moduleLinestory.configure.getChapterCfgById(req.ChapterId)
conf := this.module.configure.getChapterCfgById(req.ChapterId)
if conf == nil {
this.moduleLinestory.Error("配置未找到", log.Field{Key: "uid", Value: uid}, log.Field{Key: "chapterId", Value: req.ChapterId})
this.module.Error("配置未找到", log.Field{Key: "uid", Value: uid}, log.Field{Key: "chapterId", Value: req.ChapterId})
code = pb.ErrorCode_ConfigNoFound
return
}
if err := this.moduleLinestory.modelLinestory.receive(uid, req.ChapterId); err != nil {
if err := this.module.modelLinestory.receive(uid, req.ChapterId); err != nil {
var customErr = new(comm.CustomError)
if errors.As(err, &customErr) {
code = customErr.Code
} else {
code = pb.ErrorCode_DBError
}
this.moduleLinestory.Error("章节奖励领取失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "chapterId", Value: req.ChapterId}, log.Field{Key: "code", Value: code})
this.module.Error("章节奖励领取失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "chapterId", Value: req.ChapterId}, log.Field{Key: "code", Value: code})
return
}
//发奖
if code = this.moduleLinestory.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success {
this.moduleLinestory.Error("奖励发放失败",
if code = this.module.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success {
this.module.Error("奖励发放失败",
log.Field{Key: "uid", Value: uid}, log.Field{Key: "chapterId", Value: req.ChapterId}, log.Field{Key: "reward", Value: conf.Reward},
)
return
@ -52,7 +52,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.LinestoryReceive
ChapterId: req.ChapterId,
UserAssets: utils.ConvertReward(conf.Reward...),
}
if err := session.SendMsg(string(this.moduleLinestory.GetType()), LinestorySubTypeReceive, rsp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), LinestorySubTypeReceive, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return

View File

@ -5,7 +5,7 @@ import (
"go_dreamfactory/pb"
)
//活跃度列表
// 活跃度列表
func (this *apiComp) ActiveListCheck(session comm.IUserSession, req *pb.TaskActiveListReq) (code pb.ErrorCode) {
if req.TaskTag <= 0 || req.TaskTag > 2 {
code = pb.ErrorCode_TaskTagEmpty

View File

@ -85,30 +85,11 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq)
a.module.modelWorldtask.taskFinish(session, req.GroupId, req.TaskId, myWorldtask, curTaskConf)
a.module.modelWorldtask.taskFinishPush(session, req.GroupId, myWorldtask, curTaskConf)
} else {
// 检查任务条件是否已完成
rsp.CondiIds = a.checkCurrentCompleteCond(uid, curTaskConf.Completetask, myWorldtask)
// 已完成的任务条件
rsp.CondiIds = a.module.ModuleBuried.CheckCondition(uid, curTaskConf.Completetask...)
}
a.sendMsg(session, WorldtaskSubtypeAccept, rsp)
return
}
// 检查当前任务的完成条件
func (this *apiComp) checkCurrentCompleteCond(uid string, completeCondIds []int32, userTask *pb.DBWorldtask) (condIds []int32) {
for _, condId := range completeCondIds {
if condId == 0 {
continue
}
if m, err := this.module.service.GetModule(comm.ModuleRtask); err == nil {
iwt, ok := m.(comm.IRtask)
if ok {
if mc := iwt.CheckCondi(uid, condId); mc == pb.ErrorCode_Success {
condIds = append(condIds, condId)
}
}
}
}
a.module.ModuleBuried.ActiveCondition(uid, curTaskConf.Completetask...)
return
}

View File

@ -4,6 +4,7 @@ import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/event"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
@ -56,8 +57,8 @@ func (this *Worldtask) Start() (err error) {
}
func (this *Worldtask) TCondFinishNotify(uid string, conids []int32) {
session, ok:= this.GetUserSession(uid)
if !ok{
session, ok := this.GetUserSession(uid)
if !ok {
return
}
this.Debug("世界任务完成条件通知", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "condIds", Value: conids})