This commit is contained in:
meixiongfeng 2023-07-27 10:15:09 +08:00
commit 2c41019dea
20 changed files with 177 additions and 63 deletions

View File

@ -7,12 +7,3 @@ go build -o ./bin/cmd ./services/cmd/main.go
go build -o ./bin/mainte ./services/mainte/main.go
go build -o ./bin/gateway ./services/gateway/main.go
go build -o ./bin/worker ./services/worker/main.go
curl -XPOST -s -L 'https://oapi.dingtalk.com/robot/send?access_token=5ae6b8eacb8f065c6b6c8211febaf024a4179652b82c4c2ad59a8878cecee5e4' -H 'Content-Type: application/json' -H "charset:utf-8" -d '{"msgtype": "text",
"text": {
"content": "服务构建完成"
}
}'

BIN
bin/cmd

Binary file not shown.

Binary file not shown.

View File

@ -415,7 +415,7 @@
"hide": 0,
"destroy": 1,
"progress": 0,
"frontstoryid": 0,
"frontstoryid": 10322,
"afterstoryid": 0,
"maingroupName": {
"key": "",

Binary file not shown.

View File

@ -1,14 +1,4 @@
#!/bin/sh
curl -XPOST -s -L 'https://oapi.dingtalk.com/robot/send?access_token=5ae6b8eacb8f065c6b6c8211febaf024a4179652b82c4c2ad59a8878cecee5e4' -H 'Content-Type: application/json' -H "charset:utf-8" -d '{"msgtype": "text","text": {"content": " 服务正在启动"}}'
curl -XPOST -s -L 'https://oapi.dingtalk.com/robot/send?access_token=e15fc4f867d6b83336eb720f70d0fb66de1dab49da944f33478d8e619f35c2ac' -H 'Content-Type: application/json' -H "charset:utf-8" -d '{"msgtype": "text",
"text": {
"content": "* 服务正在启动"
}
}'
./stup.sh start dfcross_1_worker0 worker ./conf/dfcross_1_worker0.yaml
sleep 1
./stup.sh start dfcross_1_mainte mainte ./conf/dfcross_1_mainte.yaml
@ -16,26 +6,14 @@ sleep 1
./stup.sh start df01_mainte mainte ./conf/df01_mainte.yaml
sleep 1
./stup.sh start df01_worker0 worker ./conf/df01_worker0.yaml
sleep 1
sleep 5
./stup.sh start df01_gateway0 gateway ./conf/df01_gateway0.yaml
sleep 1
curl -XPOST -s -L 'https://oapi.dingtalk.com/robot/send?access_token=5ae6b8eacb8f065c6b6c8211febaf024a4179652b82c4c2ad59a8878cecee5e4' -H 'Content-Type: application/json' -H "charset:utf-8" -d '{"msgtype": "text",
curl -XPOST -s -L 'https://oapi.dingtalk.com/robot/send?access_token=afd9b57c786ddfb5d370500dcee1ca97e5449952c536c8575a7f491fd1a59a5b' -H 'Content-Type: application/json' -H "charset:utf-8" -d '{"msgtype": "text",
"text": {
"content": " 服务启动完成"
"content": " 服务启动--内网测试服"
}
}'
curl -XPOST -s -L 'https://oapi.dingtalk.com/robot/send?access_token=e15fc4f867d6b83336eb720f70d0fb66de1dab49da944f33478d8e619f35c2ac' -H 'Content-Type: application/json' -H "charset:utf-8" -d '{"msgtype": "text",
"text": {
"content": "* 服务启动完成"
}
}'

View File

@ -3,21 +3,12 @@ curl -XPOST -s -L 'https://oapi.dingtalk.com/robot/send?access_token=afd9b57c78
"text": {
"content": " 服务停止"
"content": "服务停止--内网测试服"
}
}'
curl -XPOST -s -L 'https://oapi.dingtalk.com/robot/send?access_token=e15fc4f867d6b83336eb720f70d0fb66de1dab49da944f33478d8e619f35c2ac' -H 'Content-Type: application/json' -H "charset:utf-8" -d '{"msgtype": "text",
"text": {
"content": "* 服务停止"
}
}'
./stup.sh stop df01_gateway0
./stup.sh stop df01_mainte

Binary file not shown.

View File

@ -1,6 +1,7 @@
package guildgve
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
@ -17,6 +18,7 @@ func (this *apiComp) Rank(session comm.IUserSession, req *pb.GuildGveRankReq) (e
err error
ids []string
sociatys []*pb.DBSociaty
guilids []*pb.DBGuildGve
ranks []*pb.GuildGveRankItem
)
if errdata = this.RankCheck(session, req); errdata != nil {
@ -35,12 +37,32 @@ func (this *apiComp) Rank(session comm.IUserSession, req *pb.GuildGveRankReq) (e
return
}
if guilids, err = this.module.modelGuildGve.querySociatys(ids); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return
}
if len(guilids) != len(sociatys) {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: fmt.Sprintf("数据不对称 guilids:%d sociatys:%d", len(guilids), len(sociatys)),
}
return
}
for i, v := range sociatys {
ranks = append(ranks, &pb.GuildGveRankItem{
Guildid: v.Id,
Name: v.Name,
Icon: v.Icon,
Rank: int32(i),
KillCount: guilids[i].Kills,
LastKillTime: guilids[i].Lastkilltime,
})
}
session.SendMsg(string(this.module.GetType()), "rank", &pb.GuildGveRankResp{List: ranks})

View File

@ -40,6 +40,17 @@ func (this *ModelUniongve) Start() (err error) {
return
}
// 批量查询工会信息
func (this *ModelUniongve) querySociatys(guildids []string) (result []*pb.DBGuildGve, err error) {
result = make([]*pb.DBGuildGve, 0)
if _, err = this.Gets(guildids, &result); err != nil && err != mgo.MongodbNil {
this.module.Errorln(err)
return
}
err = nil
return
}
// 获取用户全部的埋点数据
func (this *ModelUniongve) getGuildGve(guildid string) (results *pb.DBGuildGve, err error) {
var (

View File

@ -113,7 +113,8 @@ func (this *modelRank) raceSettlement() {
this.rankRewardPush(result[i], v.Reward)
}
}
//清理排行榜
this.DBModel.Redis.Delete(this.TableName)
}
// boos 奖励推送

View File

@ -0,0 +1,77 @@
package guildgve_test
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego"
"go_dreamfactory/lego/base/rpcx"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules/chat"
"go_dreamfactory/services"
"go_dreamfactory/sys/db"
"os"
"testing"
"time"
"github.com/go-redis/redis/v8"
)
func newService(ops ...rpcx.Option) core.IService {
s := new(TestService)
s.Configure(ops...)
return s
}
// 梦工厂基础服务对象
type TestService struct {
services.ServiceBase
}
// 初始化相关系统
func (this *TestService) InitSys() {
this.ServiceBase.InitSys()
if err := db.OnInit(this.GetSettings().Sys["db"], db.SetServiceId(this.GetTag())); err != nil {
panic(fmt.Sprintf("init sys.db err: %s", err.Error()))
} else {
log.Infof("init sys.db success!")
}
}
var service core.IService
var s_gateComp comm.ISC_GateRouteComp = services.NewGateRouteComp()
var module = new(chat.Chat)
// 测试环境下初始化db和cache 系统
func TestMain(m *testing.M) {
service = newService(
rpcx.SetConfPath("../../bin/conf/dfli_worker0.yaml"),
rpcx.SetVersion("1.0.0.0"),
)
service.OnInstallComp( //装备组件
s_gateComp, //此服务需要接受用户的消息 需要装备网关组件
)
go func() {
lego.Run(service) //运行模块
}()
time.Sleep(time.Second * 3)
defer os.Exit(m.Run())
}
func Test_Module(t *testing.T) {
var (
key string
score float64
menbers *redis.Z
conn *db.DBConn
err error
)
key = "guildgvebattlerank:3"
score = 1
menbers = &redis.Z{Score: (score), Member: "member"}
conn, err = db.Local()
if err = conn.Redis.ZAdd(key, menbers); err != nil {
log.Errorln(err)
}
}

View File

@ -177,6 +177,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh
Star: star,
HeroExp: conf.HeroExp,
UserExp: userExp,
Reward: aeward,
})
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype60, 1))

View File

@ -120,8 +120,18 @@ func (this *apiComp) LevelPass(session comm.IUserSession, req *pb.MainlineLevelP
Star: star,
HeroExp: conf.HeroExp,
UserExp: userExp,
Reward: aeward,
}) // 数据推送
if err = this.module.modelMline.updateMainlineData(session.GetUserId(), info); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return
}
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype60, 1))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype61, 1, int32(req.Level)))
go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...)

View File

@ -87,6 +87,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
configure.RegisterConfigure(game_stageconf, cfg.NewGameStoneStage, this.LoadGameStoneStage)
configure.RegisterConfigure(game_buffconf, cfg.NewGameStoneBuff, this.LoadGameStoneBuff)
this.CheckStage()
return
}
@ -613,7 +614,7 @@ func (this *configureComp) GetGameStoneBuff(addType int32) (m map[int32]struct{}
return this.buff[addType]
}
func (this *configureComp) CheckGlobalStage() (bossStage map[int32]*StageData) {
func (this *configureComp) CheckStage() (bossStage map[int32]*StageData) {
var (
boosEvent map[int32]int32 // key stageid value rommid
)
@ -626,7 +627,8 @@ func (this *configureComp) CheckGlobalStage() (bossStage map[int32]*StageData) {
stageData := &StageData{}
boosEvent[k] = rooms[0]
if roomconf, err := this.GetStoneRoomDataById(rooms[0]); err == nil {
// buff 组 roomconf.BossEvent
this.GetEventGroupDataByLottery(roomconf.BossEvent)
// 生成 我方buff
if bossConf := this.GetBossConfById(roomconf.BossEvent); bossConf != nil {
stageData.MaineBuff = this.GetBuffGroupDataByLottery(bossConf.FriendlyBuffGroup, 0, nil)

View File

@ -100,7 +100,7 @@ func (this *MStonehenge) loadStoneBoos() (err error) {
}
if bNewData {
this.lock.Lock()
this.bossStage = this.module.configure.CheckGlobalStage()
this.bossStage = this.module.configure.CheckStage()
this.lock.Unlock()
this.module.ModuleTools.UpdateGlobalData(StoneBossKey, map[string]interface{}{
"BossStage": this.bossStage,

View File

@ -91,9 +91,16 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.WTaskAcceptReq) (
wtask.Boxs[conf.Key] = &pb.DBWTaskBox{
Boxs: boxs,
}
update["boxs"] = wtask.Boxs
session.SendMsg(string(this.module.GetType()), "boxchange", &pb.WTaskBoxChangePush{Boxs: wtask.Boxs})
}
if len(conf.GetItem) > 0 { //接取 获得物品
if errdata = this.module.DispenseRes(session, conf.GetItem, true); errdata != nil {
return
}
}
if progress, errdata = this.module.pushtaskprogress(session, wtask, false); errdata != nil {
return
}

View File

@ -18,6 +18,7 @@ func (this *apiComp) FinishCheck(session comm.IUserSession, req *pb.WTaskFinishR
func (this *apiComp) Finish(session comm.IUserSession, req *pb.WTaskFinishReq) (errdata *pb.ErrorData) {
var (
conf *cfg.GameWorldTaskData
afterconf *cfg.GameWorldTaskData
wtask *pb.DBWTask
condis []*pb.ConIProgress
award []*pb.UserAssets
@ -130,6 +131,30 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WTaskFinishReq) (
} else {
wtask.Completes = append(wtask.Completes, req.Tid)
}
if conf.Des == 1 && conf.IdAfter != 0 { //日常任务 自动接取下一个
if afterconf, err = this.module.configure.gettaskconfconfigure(conf.IdAfter); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(),
}
return
}
if err = this.module.ModuleBuried.ActiveCondition(session.GetUserId(), afterconf.Completetask...); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ExternalModule,
Title: pb.ErrorCode_ExternalModule.ToString(),
Message: fmt.Sprintf("ModuleBuried.ActiveCondition uid:%s condiIds:%v", session.GetUserId(), conf.Completetask),
}
return
}
wtask.Accepts = append(wtask.Accepts, afterconf.Key)
if _, errdata = this.module.pushtaskprogress(session, wtask, false); errdata != nil {
return
}
}
this.module.checkgroupState(session, wtask, conf.Group)
session.SendMsg(string(this.module.GetType()), "finish", &pb.WTaskFinishResp{Tid: req.Tid, Award: award, Completes: wtask.Completes, Groups: wtask.Groups})
this.module.fishtask(session, wtask, true)

View File

@ -53,6 +53,10 @@ func (this *WTask) Start() (err error) {
return
}
this.caravan = module.(comm.ICaravan)
if module, err = this.service.GetModule(comm.ModuleDailytask); err != nil {
return
}
this.dailytask = module.(comm.IDailytask)
return
}
@ -743,13 +747,7 @@ func (this *WTask) inquireActivations(session comm.IUserSession, wtask *pb.DBWTa
if _, ok = completeMap[v.Ontxe]; v.Ontxe != 0 && !ok { //前置任务判断
continue
}
if v.Des == 5 { //商队任务不主动触发 日常任务直接接取不进入可接取列表中
continue
}
if v.Des == 1 {
changeAccept = true
wtask.Accepts = append(wtask.Activations, v.Key)
condiIds = append(condiIds, v.Completetask...)
if v.Des == 5 || v.Des == 1 { //商队任务不主动触发 日常任务直接接取不进入可接取列表中
continue
}
wtask.Activations = append(wtask.Activations, v.Key)

View File

@ -90,7 +90,7 @@ type DBGuildGve struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Guildid string `protobuf:"bytes,1,opt,name=Guildid,proto3" json:"Guildid" bson:"_id"`
Guildid string `protobuf:"bytes,1,opt,name=guildid,proto3" json:"guildid" bson:"_id"`
Notice string `protobuf:"bytes,2,opt,name=notice,proto3" json:"notice"` //公告
Fire int32 `protobuf:"varint,3,opt,name=fire,proto3" json:"fire"` //火力
Currstage int32 `protobuf:"varint,4,opt,name=currstage,proto3" json:"currstage"` //当前第几阶段
@ -716,8 +716,8 @@ var file_guildgve_guildgve_db_proto_rawDesc = []byte{
0x12, 0x14, 0x0a, 0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x18, 0x03,
0x20, 0x03, 0x28, 0x05, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x73, 0x22, 0xf9, 0x01, 0x0a, 0x0a, 0x44,
0x42, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x47, 0x76, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x75, 0x69,
0x6c, 0x64, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x47, 0x75, 0x69, 0x6c,
0x42, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x47, 0x76, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x75, 0x69,
0x6c, 0x64, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x75, 0x69, 0x6c,
0x64, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66,
0x69, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x66, 0x69, 0x72, 0x65, 0x12,