From 23597a0904851697e0f7b358327a2891e96e62b3 Mon Sep 17 00:00:00 2001
From: meixiongfeng <766881921@qq.com>
Date: Mon, 7 Nov 2022 18:38:33 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E6=AF=8F=E6=97=A5=E7=AD=BE=E5=88=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
bin/json/game_sign.json | 902 ++++++++++++++++++++
bin/json/game_signreset.json | 14 +
modules/comp_configure.go | 49 ++
modules/troll/api_getlist.go | 2 +-
pb/user_db.pb.go | 118 ++-
pb/user_msg.pb.go | 143 +++-
sys/configure/structs/Game.Sign.go | 42 +
sys/configure/structs/Game.SignData.go | 54 ++
sys/configure/structs/Game.SignReset.go | 42 +
sys/configure/structs/Game.SignResetData.go | 37 +
sys/configure/structs/Tables.go | 14 +
11 files changed, 1378 insertions(+), 39 deletions(-)
create mode 100644 bin/json/game_sign.json
create mode 100644 bin/json/game_signreset.json
create mode 100644 sys/configure/structs/Game.Sign.go
create mode 100644 sys/configure/structs/Game.SignData.go
create mode 100644 sys/configure/structs/Game.SignReset.go
create mode 100644 sys/configure/structs/Game.SignResetData.go
diff --git a/bin/json/game_sign.json b/bin/json/game_sign.json
new file mode 100644
index 000000000..eb7d0f15f
--- /dev/null
+++ b/bin/json/game_sign.json
@@ -0,0 +1,902 @@
+[
+ {
+ "id": 1,
+ "day": 1,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "day": 2,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "day": 3,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "day": 4,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 5,
+ "day": 5,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 6,
+ "day": 6,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 7,
+ "day": 7,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 8,
+ "day": 8,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 9,
+ "day": 9,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 10,
+ "day": 10,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 11,
+ "day": 11,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 12,
+ "day": 12,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 13,
+ "day": 13,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 14,
+ "day": 14,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 15,
+ "day": 15,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 16,
+ "day": 16,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 17,
+ "day": 17,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 18,
+ "day": 18,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 19,
+ "day": 19,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 20,
+ "day": 20,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 21,
+ "day": 21,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 22,
+ "day": 22,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 23,
+ "day": 23,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 24,
+ "day": 24,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 25,
+ "day": 25,
+ "group": 1,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 1
+ }
+ ]
+ },
+ {
+ "id": 26,
+ "day": 1,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 27,
+ "day": 2,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 28,
+ "day": 3,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 29,
+ "day": 4,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 30,
+ "day": 5,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 31,
+ "day": 6,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 32,
+ "day": 7,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 33,
+ "day": 8,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 34,
+ "day": 9,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 35,
+ "day": 10,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 36,
+ "day": 11,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 37,
+ "day": 12,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 38,
+ "day": 13,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 39,
+ "day": 14,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 40,
+ "day": 15,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 41,
+ "day": 16,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 42,
+ "day": 17,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 43,
+ "day": 18,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 44,
+ "day": 19,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 45,
+ "day": 20,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 46,
+ "day": 21,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 47,
+ "day": 22,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 48,
+ "day": 23,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 49,
+ "day": 24,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 50,
+ "day": 25,
+ "group": 2,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 2
+ }
+ ]
+ },
+ {
+ "id": 51,
+ "day": 1,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 52,
+ "day": 2,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 53,
+ "day": 3,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 54,
+ "day": 4,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 55,
+ "day": 5,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 56,
+ "day": 6,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 57,
+ "day": 7,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 58,
+ "day": 8,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 59,
+ "day": 9,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 60,
+ "day": 10,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 61,
+ "day": 11,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 62,
+ "day": 12,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 63,
+ "day": 13,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 64,
+ "day": 14,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 65,
+ "day": 15,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 66,
+ "day": 16,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 67,
+ "day": 17,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 68,
+ "day": 18,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 69,
+ "day": 19,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 70,
+ "day": 20,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 71,
+ "day": 21,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 72,
+ "day": 22,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 73,
+ "day": 23,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 74,
+ "day": 24,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ },
+ {
+ "id": 75,
+ "day": 25,
+ "group": 3,
+ "loopgift": [
+ {
+ "a": "item",
+ "t": "90002",
+ "n": 3
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/bin/json/game_signreset.json b/bin/json/game_signreset.json
new file mode 100644
index 000000000..7379aea5a
--- /dev/null
+++ b/bin/json/game_signreset.json
@@ -0,0 +1,14 @@
+[
+ {
+ "id": 1,
+ "groups": 1
+ },
+ {
+ "id": 2,
+ "groups": 2
+ },
+ {
+ "id": 3,
+ "groups": 3
+ }
+]
\ No newline at end of file
diff --git a/modules/comp_configure.go b/modules/comp_configure.go
index cd9148327..b7cadb005 100644
--- a/modules/comp_configure.go
+++ b/modules/comp_configure.go
@@ -21,6 +21,9 @@ const (
game_drop = "game_drop.json" //掉落
game_comatn = "game_comatn.json" //atn配置表
new_hero = "game_hero.json"
+ // 签到
+ game_signreset = "game_signreset.json"
+ game_sign = "game_sign.json"
)
///配置管理基础组件
@@ -28,6 +31,7 @@ type MCompConfigure struct {
cbase.ModuleCompBase
hlock sync.RWMutex
_dropMap map[int32][]*cfg.GameDropData // 掉落表 key 是DiropId
+ _sign map[int32]*cfg.GameSignData
}
//组件初始化接口
@@ -40,8 +44,13 @@ func (this *MCompConfigure) Init(service core.IService, module core.IModule, com
err = this.LoadConfigure(game_playerlv, cfg.NewGamePlayerlv)
err = this.LoadConfigure(game_facemod, cfg.NewGameFacemod)
err = this.LoadConfigure(game_comatn, cfg.NewGameComAtn)
+ err = this.LoadConfigure(game_signreset, cfg.NewGameSignReset)
+ //err = this.LoadConfigure(game_sign, cfg.NewGameSign)
+
this._dropMap = make(map[int32][]*cfg.GameDropData, 0)
+ this._sign = make(map[int32]*cfg.GameSignData, 0)
configure.RegisterConfigure(game_drop, cfg.NewGameDrop, this.LoadDropData)
+ configure.RegisterConfigure(game_sign, cfg.NewGameSign, this.LoadSignData)
return
}
@@ -258,3 +267,43 @@ func (this *MCompConfigure) GetHeroConfigStar(heroCfgId string) int32 {
}
return 0
}
+
+// 获取签到信息
+func (this *MCompConfigure) GetSignConf(day, group int32) *cfg.GameSignData {
+ if v, ok := this._sign[day<<8+group]; ok {
+ return v
+ }
+ return nil
+}
+
+// 获取组id
+func (this *MCompConfigure) GetSignResetConf(id int32) (groups int32) {
+ if v, err := this.GetConfigure(game_signreset); err != nil {
+ return
+ } else {
+ if configure, ok := v.(*cfg.GameSignReset); !ok {
+ err = fmt.Errorf("%T no is *cfg.GameSignData", v)
+ return
+ } else {
+ if configure != nil {
+ groups = configure.Get(id).Groups
+ }
+ }
+ }
+ return
+}
+func (this *MCompConfigure) LoadSignData() {
+ if v, err := this.GetConfigure(game_sign); err == nil {
+ if configure, ok := v.(*cfg.GameSign); ok {
+ this.hlock.Lock()
+ defer this.hlock.Unlock()
+ for _, value := range configure.GetDataList() {
+ this._sign[value.Day<<8+value.Group] = value
+ }
+ return
+ }
+ } else {
+ log.Errorf("get game_sign conf err:%v", err)
+ }
+ return
+}
diff --git a/modules/troll/api_getlist.go b/modules/troll/api_getlist.go
index 2095b5320..103739dcc 100644
--- a/modules/troll/api_getlist.go
+++ b/modules/troll/api_getlist.go
@@ -80,7 +80,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.TrollGetListReq)
trolltrain.SurpriseID = make(map[int32]int32, 0)
n, _ := rand.Int(rand.Reader, big.NewInt(int64(trainNum)))
n2, _ := rand.Int(rand.Reader, big.NewInt(int64(maxCoefficient)))
- trolltrain.SurpriseID[int32(n.Int64())+1] = int32(n2.Int64()) + 1
+ trolltrain.SurpriseID[int32(n.Int64())+1] = int32(n2.Int64())
update["surpriseID"] = trolltrain.SurpriseID
trolltrain.Circle = c
update["circle"] = trolltrain.Circle
diff --git a/pb/user_db.pb.go b/pb/user_db.pb.go
index d154456e2..137d46d2a 100644
--- a/pb/user_db.pb.go
+++ b/pb/user_db.pb.go
@@ -465,6 +465,94 @@ func (x *DBUserSetting) GetSaiji() bool {
return false
}
+// 签到功能
+type DBSign struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
+ Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
+ SignTime int64 `protobuf:"varint,3,opt,name=signTime,proto3" json:"signTime" bson:"signTime"` //玩家登录时间
+ SignCount int32 `protobuf:"varint,4,opt,name=signCount,proto3" json:"signCount" bson:"signCount"` //玩家累计签到次数
+ Group int32 `protobuf:"varint,5,opt,name=group,proto3" json:"group"` // 签到组id
+ Cid int32 `protobuf:"varint,6,opt,name=cid,proto3" json:"cid"` //记录循环签到值,客户端忽略这个字段
+}
+
+func (x *DBSign) Reset() {
+ *x = DBSign{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_user_db_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DBSign) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DBSign) ProtoMessage() {}
+
+func (x *DBSign) ProtoReflect() protoreflect.Message {
+ mi := &file_user_user_db_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DBSign.ProtoReflect.Descriptor instead.
+func (*DBSign) Descriptor() ([]byte, []int) {
+ return file_user_user_db_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *DBSign) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *DBSign) GetUid() string {
+ if x != nil {
+ return x.Uid
+ }
+ return ""
+}
+
+func (x *DBSign) GetSignTime() int64 {
+ if x != nil {
+ return x.SignTime
+ }
+ return 0
+}
+
+func (x *DBSign) GetSignCount() int32 {
+ if x != nil {
+ return x.SignCount
+ }
+ return 0
+}
+
+func (x *DBSign) GetGroup() int32 {
+ if x != nil {
+ return x.Group
+ }
+ return 0
+}
+
+func (x *DBSign) GetCid() int32 {
+ if x != nil {
+ return x.Cid
+ }
+ return 0
+}
+
var File_user_user_db_proto protoreflect.FileDescriptor
var file_user_user_db_proto_rawDesc = []byte{
@@ -533,8 +621,17 @@ var file_user_user_db_proto_rawDesc = []byte{
0x67, 0x12, 0x1c, 0x0a, 0x09, 0x78, 0x75, 0x61, 0x6e, 0x73, 0x68, 0x61, 0x6e, 0x67, 0x18, 0x0d,
0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x78, 0x75, 0x61, 0x6e, 0x73, 0x68, 0x61, 0x6e, 0x67, 0x12,
0x14, 0x0a, 0x05, 0x73, 0x61, 0x69, 0x6a, 0x69, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05,
- 0x73, 0x61, 0x69, 0x6a, 0x69, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x73, 0x61, 0x69, 0x6a, 0x69, 0x22, 0x8c, 0x01, 0x0a, 0x06, 0x44, 0x42, 0x53, 0x69, 0x67, 0x6e,
+ 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
+ 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
+ 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x69, 0x67, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03,
+ 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x69, 0x67, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c,
+ 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28,
+ 0x05, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05,
+ 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x67, 0x72, 0x6f,
+ 0x75, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52,
+ 0x03, 0x63, 0x69, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -549,11 +646,12 @@ func file_user_user_db_proto_rawDescGZIP() []byte {
return file_user_user_db_proto_rawDescData
}
-var file_user_user_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
+var file_user_user_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_user_user_db_proto_goTypes = []interface{}{
(*CacheUser)(nil), // 0: CacheUser
(*DBUser)(nil), // 1: DBUser
(*DBUserSetting)(nil), // 2: DBUserSetting
+ (*DBSign)(nil), // 3: DBSign
}
var file_user_user_db_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
@@ -605,6 +703,18 @@ func file_user_user_db_proto_init() {
return nil
}
}
+ file_user_user_db_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DBSign); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -612,7 +722,7 @@ func file_user_user_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_user_user_db_proto_rawDesc,
NumEnums: 0,
- NumMessages: 3,
+ NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/pb/user_msg.pb.go b/pb/user_msg.pb.go
index a9c2067f9..55fb9da43 100644
--- a/pb/user_msg.pb.go
+++ b/pb/user_msg.pb.go
@@ -2183,6 +2183,62 @@ func (x *UserGetServerDataResp) GetData() *DBServerData {
return nil
}
+// 推送签到信息
+type UserSignPush struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Data *DBSign `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
+ Reward bool `protobuf:"varint,2,opt,name=reward,proto3" json:"reward"` // 是否领奖
+}
+
+func (x *UserSignPush) Reset() {
+ *x = UserSignPush{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_user_msg_proto_msgTypes[43]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UserSignPush) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserSignPush) ProtoMessage() {}
+
+func (x *UserSignPush) ProtoReflect() protoreflect.Message {
+ mi := &file_user_user_msg_proto_msgTypes[43]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserSignPush.ProtoReflect.Descriptor instead.
+func (*UserSignPush) Descriptor() ([]byte, []int) {
+ return file_user_user_msg_proto_rawDescGZIP(), []int{43}
+}
+
+func (x *UserSignPush) GetData() *DBSign {
+ if x != nil {
+ return x.Data
+ }
+ return nil
+}
+
+func (x *UserSignPush) GetReward() bool {
+ if x != nil {
+ return x.Reward
+ }
+ return false
+}
+
var File_user_user_msg_proto protoreflect.FileDescriptor
var file_user_user_msg_proto_rawDesc = []byte{
@@ -2349,8 +2405,12 @@ var file_user_user_msg_proto_rawDesc = []byte{
0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12,
0x21, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e,
0x44, 0x42, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61,
- 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x33,
+ 0x74, 0x61, 0x22, 0x43, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x50, 0x75,
+ 0x73, 0x68, 0x12, 0x1b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x07, 0x2e, 0x44, 0x42, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12,
+ 0x16, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52,
+ 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
+ 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -2365,7 +2425,7 @@ func file_user_user_msg_proto_rawDescGZIP() []byte {
return file_user_user_msg_proto_rawDescData
}
-var file_user_user_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 43)
+var file_user_user_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 44)
var file_user_user_msg_proto_goTypes = []interface{}{
(*UserLoginReq)(nil), // 0: UserLoginReq
(*UserLoginResp)(nil), // 1: UserLoginResp
@@ -2410,38 +2470,41 @@ var file_user_user_msg_proto_goTypes = []interface{}{
(*UserDataListResp)(nil), // 40: UserDataListResp
(*UserGetServerDataReq)(nil), // 41: UserGetServerDataReq
(*UserGetServerDataResp)(nil), // 42: UserGetServerDataResp
- (*DBUser)(nil), // 43: DBUser
- (*DBUserExpand)(nil), // 44: DBUserExpand
- (ErrorCode)(0), // 45: ErrorCode
- (*CacheUser)(nil), // 46: CacheUser
- (*DBUserSetting)(nil), // 47: DBUserSetting
- (*DBPagodaRecord)(nil), // 48: DBPagodaRecord
- (*DBHuntingRank)(nil), // 49: DBHuntingRank
- (*DBVikingRank)(nil), // 50: DBVikingRank
- (*DBServerData)(nil), // 51: DBServerData
+ (*UserSignPush)(nil), // 43: UserSignPush
+ (*DBUser)(nil), // 44: DBUser
+ (*DBUserExpand)(nil), // 45: DBUserExpand
+ (ErrorCode)(0), // 46: ErrorCode
+ (*CacheUser)(nil), // 47: CacheUser
+ (*DBUserSetting)(nil), // 48: DBUserSetting
+ (*DBPagodaRecord)(nil), // 49: DBPagodaRecord
+ (*DBHuntingRank)(nil), // 50: DBHuntingRank
+ (*DBVikingRank)(nil), // 51: DBVikingRank
+ (*DBServerData)(nil), // 52: DBServerData
+ (*DBSign)(nil), // 53: DBSign
}
var file_user_user_msg_proto_depIdxs = []int32{
- 43, // 0: UserLoginResp.data:type_name -> DBUser
- 44, // 1: UserLoginResp.ex:type_name -> DBUserExpand
- 43, // 2: UserInfoResp.data:type_name -> DBUser
- 44, // 3: UserInfoResp.ex:type_name -> DBUserExpand
- 45, // 4: UserRegisterResp.Code:type_name -> ErrorCode
- 46, // 5: UserLoadResp.data:type_name -> CacheUser
- 47, // 6: UserGetSettingResp.setting:type_name -> DBUserSetting
- 47, // 7: UserUpdateSettingReq.setting:type_name -> DBUserSetting
- 43, // 8: UserBattlerecordResp.data:type_name -> DBUser
- 44, // 9: UserBattlerecordResp.ex:type_name -> DBUserExpand
- 48, // 10: UserBattlerecordResp.pagodaRecord:type_name -> DBPagodaRecord
- 49, // 11: UserBattlerecordResp.huntingRecord:type_name -> DBHuntingRank
- 50, // 12: UserBattlerecordResp.vikingRecord:type_name -> DBVikingRank
- 46, // 13: UserOnlineResp.users:type_name -> CacheUser
- 43, // 14: UserDataListResp.users:type_name -> DBUser
- 51, // 15: UserGetServerDataResp.data:type_name -> DBServerData
- 16, // [16:16] is the sub-list for method output_type
- 16, // [16:16] is the sub-list for method input_type
- 16, // [16:16] is the sub-list for extension type_name
- 16, // [16:16] is the sub-list for extension extendee
- 0, // [0:16] is the sub-list for field type_name
+ 44, // 0: UserLoginResp.data:type_name -> DBUser
+ 45, // 1: UserLoginResp.ex:type_name -> DBUserExpand
+ 44, // 2: UserInfoResp.data:type_name -> DBUser
+ 45, // 3: UserInfoResp.ex:type_name -> DBUserExpand
+ 46, // 4: UserRegisterResp.Code:type_name -> ErrorCode
+ 47, // 5: UserLoadResp.data:type_name -> CacheUser
+ 48, // 6: UserGetSettingResp.setting:type_name -> DBUserSetting
+ 48, // 7: UserUpdateSettingReq.setting:type_name -> DBUserSetting
+ 44, // 8: UserBattlerecordResp.data:type_name -> DBUser
+ 45, // 9: UserBattlerecordResp.ex:type_name -> DBUserExpand
+ 49, // 10: UserBattlerecordResp.pagodaRecord:type_name -> DBPagodaRecord
+ 50, // 11: UserBattlerecordResp.huntingRecord:type_name -> DBHuntingRank
+ 51, // 12: UserBattlerecordResp.vikingRecord:type_name -> DBVikingRank
+ 47, // 13: UserOnlineResp.users:type_name -> CacheUser
+ 44, // 14: UserDataListResp.users:type_name -> DBUser
+ 52, // 15: UserGetServerDataResp.data:type_name -> DBServerData
+ 53, // 16: UserSignPush.data:type_name -> DBSign
+ 17, // [17:17] is the sub-list for method output_type
+ 17, // [17:17] is the sub-list for method input_type
+ 17, // [17:17] is the sub-list for extension type_name
+ 17, // [17:17] is the sub-list for extension extendee
+ 0, // [0:17] is the sub-list for field type_name
}
func init() { file_user_user_msg_proto_init() }
@@ -2973,6 +3036,18 @@ func file_user_user_msg_proto_init() {
return nil
}
}
+ file_user_user_msg_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UserSignPush); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -2980,7 +3055,7 @@ func file_user_user_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_user_user_msg_proto_rawDesc,
NumEnums: 0,
- NumMessages: 43,
+ NumMessages: 44,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/sys/configure/structs/Game.Sign.go b/sys/configure/structs/Game.Sign.go
new file mode 100644
index 000000000..af6b3fcac
--- /dev/null
+++ b/sys/configure/structs/Game.Sign.go
@@ -0,0 +1,42 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+package cfg
+
+type GameSign struct {
+ _dataMap map[int32]*GameSignData
+ _dataList []*GameSignData
+}
+
+func NewGameSign(_buf []map[string]interface{}) (*GameSign, error) {
+ _dataList := make([]*GameSignData, 0, len(_buf))
+ dataMap := make(map[int32]*GameSignData)
+ for _, _ele_ := range _buf {
+ if _v, err2 := DeserializeGameSignData(_ele_); err2 != nil {
+ return nil, err2
+ } else {
+ _dataList = append(_dataList, _v)
+ dataMap[_v.Id] = _v
+ }
+ }
+ return &GameSign{_dataList:_dataList, _dataMap:dataMap}, nil
+}
+
+func (table *GameSign) GetDataMap() map[int32]*GameSignData {
+ return table._dataMap
+}
+
+func (table *GameSign) GetDataList() []*GameSignData {
+ return table._dataList
+}
+
+func (table *GameSign) Get(key int32) *GameSignData {
+ return table._dataMap[key]
+}
+
+
diff --git a/sys/configure/structs/Game.SignData.go b/sys/configure/structs/Game.SignData.go
new file mode 100644
index 000000000..b6598c9ec
--- /dev/null
+++ b/sys/configure/structs/Game.SignData.go
@@ -0,0 +1,54 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+package cfg
+
+import "errors"
+
+type GameSignData struct {
+ Id int32
+ Day int32
+ Group int32
+ Loopgift []*Gameatn
+}
+
+const TypeId_GameSignData = -1850890877
+
+func (*GameSignData) GetTypeId() int32 {
+ return -1850890877
+}
+
+func (_v *GameSignData)Deserialize(_buf map[string]interface{}) (err error) {
+ { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
+ { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["day"].(float64); !_ok_ { err = errors.New("day error"); return }; _v.Day = int32(_tempNum_) }
+ { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["group"].(float64); !_ok_ { err = errors.New("group error"); return }; _v.Group = int32(_tempNum_) }
+ {
+ var _arr_ []interface{}
+ var _ok_ bool
+ if _arr_, _ok_ = _buf["loopgift"].([]interface{}); !_ok_ { err = errors.New("loopgift error"); return }
+
+ _v.Loopgift = make([]*Gameatn, 0, len(_arr_))
+
+ for _, _e_ := range _arr_ {
+ var _list_v_ *Gameatn
+ { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
+ _v.Loopgift = append(_v.Loopgift, _list_v_)
+ }
+ }
+
+ return
+}
+
+func DeserializeGameSignData(_buf map[string]interface{}) (*GameSignData, error) {
+ v := &GameSignData{}
+ if err := v.Deserialize(_buf); err == nil {
+ return v, nil
+ } else {
+ return nil, err
+ }
+}
diff --git a/sys/configure/structs/Game.SignReset.go b/sys/configure/structs/Game.SignReset.go
new file mode 100644
index 000000000..73538aa4e
--- /dev/null
+++ b/sys/configure/structs/Game.SignReset.go
@@ -0,0 +1,42 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+package cfg
+
+type GameSignReset struct {
+ _dataMap map[int32]*GameSignResetData
+ _dataList []*GameSignResetData
+}
+
+func NewGameSignReset(_buf []map[string]interface{}) (*GameSignReset, error) {
+ _dataList := make([]*GameSignResetData, 0, len(_buf))
+ dataMap := make(map[int32]*GameSignResetData)
+ for _, _ele_ := range _buf {
+ if _v, err2 := DeserializeGameSignResetData(_ele_); err2 != nil {
+ return nil, err2
+ } else {
+ _dataList = append(_dataList, _v)
+ dataMap[_v.Id] = _v
+ }
+ }
+ return &GameSignReset{_dataList:_dataList, _dataMap:dataMap}, nil
+}
+
+func (table *GameSignReset) GetDataMap() map[int32]*GameSignResetData {
+ return table._dataMap
+}
+
+func (table *GameSignReset) GetDataList() []*GameSignResetData {
+ return table._dataList
+}
+
+func (table *GameSignReset) Get(key int32) *GameSignResetData {
+ return table._dataMap[key]
+}
+
+
diff --git a/sys/configure/structs/Game.SignResetData.go b/sys/configure/structs/Game.SignResetData.go
new file mode 100644
index 000000000..701b64db5
--- /dev/null
+++ b/sys/configure/structs/Game.SignResetData.go
@@ -0,0 +1,37 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+package cfg
+
+import "errors"
+
+type GameSignResetData struct {
+ Id int32
+ Groups int32
+}
+
+const TypeId_GameSignResetData = 1968130912
+
+func (*GameSignResetData) GetTypeId() int32 {
+ return 1968130912
+}
+
+func (_v *GameSignResetData)Deserialize(_buf map[string]interface{}) (err error) {
+ { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
+ { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["groups"].(float64); !_ok_ { err = errors.New("groups error"); return }; _v.Groups = int32(_tempNum_) }
+ return
+}
+
+func DeserializeGameSignResetData(_buf map[string]interface{}) (*GameSignResetData, error) {
+ v := &GameSignResetData{}
+ if err := v.Deserialize(_buf); err == nil {
+ return v, nil
+ } else {
+ return nil, err
+ }
+}
diff --git a/sys/configure/structs/Tables.go b/sys/configure/structs/Tables.go
index 869ecc258..b3c594f2e 100644
--- a/sys/configure/structs/Tables.go
+++ b/sys/configure/structs/Tables.go
@@ -122,6 +122,8 @@ type Tables struct {
TrollCoefficient *GameTrollCoefficient
PrivilegeCard *GamePrivilegeCard
Privilege *GamePrivilege
+ Sign *GameSign
+ SignReset *GameSignReset
}
func NewTables(loader JsonLoader) (*Tables, error) {
@@ -795,5 +797,17 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.Privilege, err = NewGamePrivilege(buf); err != nil {
return nil, err
}
+ if buf, err = loader("game_sign"); err != nil {
+ return nil, err
+ }
+ if tables.Sign, err = NewGameSign(buf); err != nil {
+ return nil, err
+ }
+ if buf, err = loader("game_signreset"); err != nil {
+ return nil, err
+ }
+ if tables.SignReset, err = NewGameSignReset(buf); err != nil {
+ return nil, err
+ }
return tables, nil
}
From f9ea35b8819abac845e4d023fca636270ecbc18f Mon Sep 17 00:00:00 2001
From: meixiongfeng <766881921@qq.com>
Date: Mon, 7 Nov 2022 19:51:35 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=AF=8F=E6=97=A5=E7=AD=BE=E5=88=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
comm/const.go | 3 ++
modules/comp_configure.go | 15 +++-----
modules/hero/hero_test.go | 13 ++++++-
modules/troll/api.go | 1 +
modules/troll/api_afkset.go | 2 +-
modules/user/model_sign.go | 72 +++++++++++++++++++++++++++++++++++++
modules/user/module.go | 1 +
pb/pagoda_msg.pb.go | 17 +++++----
pb/user_db.pb.go | 15 ++++++--
utils/time.go | 13 +++++++
10 files changed, 128 insertions(+), 24 deletions(-)
create mode 100644 modules/user/model_sign.go
diff --git a/comm/const.go b/comm/const.go
index 50f413d9e..52c69ca03 100644
--- a/comm/const.go
+++ b/comm/const.go
@@ -190,6 +190,9 @@ const (
TablePrivilege = "privilege"
//联盟学院
TableAcademy = "academy"
+
+ // 签到
+ TableSign = "sign"
)
//RPC服务接口定义处
diff --git a/modules/comp_configure.go b/modules/comp_configure.go
index b7cadb005..8c315ba29 100644
--- a/modules/comp_configure.go
+++ b/modules/comp_configure.go
@@ -277,20 +277,15 @@ func (this *MCompConfigure) GetSignConf(day, group int32) *cfg.GameSignData {
}
// 获取组id
-func (this *MCompConfigure) GetSignResetConf(id int32) (groups int32) {
- if v, err := this.GetConfigure(game_signreset); err != nil {
- return
- } else {
- if configure, ok := v.(*cfg.GameSignReset); !ok {
- err = fmt.Errorf("%T no is *cfg.GameSignData", v)
- return
- } else {
+func (this *MCompConfigure) GetSignResetConf(id int32) int32 {
+ if v, err := this.GetConfigure(game_signreset); err == nil {
+ if configure, ok := v.(*cfg.GameSignReset); ok {
if configure != nil {
- groups = configure.Get(id).Groups
+ return configure.Get(id).Groups
}
}
}
- return
+ return -1
}
func (this *MCompConfigure) LoadSignData() {
if v, err := this.GetConfigure(game_sign); err == nil {
diff --git a/modules/hero/hero_test.go b/modules/hero/hero_test.go
index 66221aa30..318f3d7be 100644
--- a/modules/hero/hero_test.go
+++ b/modules/hero/hero_test.go
@@ -58,8 +58,19 @@ func (this *TestService) InitSys() {
log.Infof("init sys.configure success!")
}
}
-
+func GetMonthStartEnd() (int64, int64) {
+ t := time.Now()
+ monthStartDay := t.AddDate(0, 0, -t.Day()+1)
+ monthStartTime := time.Date(monthStartDay.Year(), monthStartDay.Month(), monthStartDay.Day(), 0, 0, 0, 0, t.Location())
+ monthEndDay := monthStartTime.AddDate(0, 1, -1)
+ monthEndTime := time.Date(monthEndDay.Year(), monthEndDay.Month(), monthEndDay.Day(), 23, 59, 59, 0, t.Location())
+ _d1 := monthStartTime.Unix()
+ _d2 := monthEndTime.Unix()
+ fmt.Printf("%d,%d", _d1, _d2)
+ return _d1, _d2
+}
func Test_Main(t *testing.T) {
+ GetMonthStartEnd()
fmt.Printf("%d", 9/10)
ids := utils.RandomNumbers(0, 10, 5)
for _, v := range ids {
diff --git a/modules/troll/api.go b/modules/troll/api.go
index 39cde8023..96ce2fa82 100644
--- a/modules/troll/api.go
+++ b/modules/troll/api.go
@@ -14,6 +14,7 @@ const (
GourmetGetRandUserResp = "getranduser"
TrollRankListResp = "ranklist"
TrollRecordListResp = "recordlist"
+ TrollAfkSetResp = "afkset"
)
type apiComp struct {
diff --git a/modules/troll/api_afkset.go b/modules/troll/api_afkset.go
index e32c798cf..d37b43b8e 100644
--- a/modules/troll/api_afkset.go
+++ b/modules/troll/api_afkset.go
@@ -32,6 +32,6 @@ func (this *apiComp) AfkSet(session comm.IUserSession, req *pb.TrollAfkSetReq) (
update["sell"] = troll.Sell
update["aiCount"] = troll.AiCount
this.module.ModifyTrollData(session.GetUserId(), update)
- session.SendMsg(string(this.module.GetType()), TrollNpcRewardResp, &pb.TrollNpcRewardResp{Data: troll})
+ session.SendMsg(string(this.module.GetType()), TrollAfkSetResp, &pb.TrollAfkSetResp{Data: troll})
return
}
diff --git a/modules/user/model_sign.go b/modules/user/model_sign.go
new file mode 100644
index 000000000..6d0d36f79
--- /dev/null
+++ b/modules/user/model_sign.go
@@ -0,0 +1,72 @@
+package user
+
+import (
+ "go_dreamfactory/comm"
+ "go_dreamfactory/lego/core"
+ "go_dreamfactory/modules"
+ "go_dreamfactory/pb"
+ "go_dreamfactory/utils"
+ "time"
+
+ "go.mongodb.org/mongo-driver/mongo"
+)
+
+// 签到
+type ModelSign struct {
+ modules.MCompModel
+ module *User
+}
+
+func (this *ModelSign) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
+ this.TableName = comm.TableSign
+ err = this.MCompModel.Init(service, module, comp, options)
+ this.module = module.(*User)
+ return
+}
+
+func (this *ModelSign) GetUserSign(uid string) (result *pb.DBSign, err error) {
+ result = &pb.DBSign{}
+ if err = this.module.modelSign.Get(uid, result); err != nil && mongo.ErrNoDocuments != err {
+ return
+ }
+ err = nil
+ return result, err
+}
+
+//修改用户签到数据
+func (this *ModelSign) ChangeUserSign(uid string, value map[string]interface{}) (err error) {
+ if len(value) == 0 {
+ return nil
+ }
+ return this.module.modelSign.Change(uid, value)
+}
+
+// 累计登录天数
+func (this *ModelSign) updateSignData(uid string, sign *pb.DBSign) (err error) {
+ if !utils.IsToday(sign.SignTime) {
+ sign.SignCount += 1
+ count := sign.SignCount
+ update := map[string]interface{}{
+ "signCount": count,
+ "signTime": time.Now().UTC(),
+ }
+ this.ChangeUserSign(uid, update)
+ }
+ return
+}
+
+// 重置签到数据
+func (this *ModelSign) resetSignData(uid string, sign *pb.DBSign) (err error) {
+ start, _ := utils.GetMonthStartEnd()
+ if sign.RTime < start { // 重置
+ sign.RTime = time.Now().Unix()
+ sign.SignTime = sign.RTime
+ sign.SignCount = 1
+ }
+
+ if this.module.configure.GetSignResetConf(sign.Cid+1) != -1 { // 获取当前的组id
+ sign.Cid += 1
+ }
+
+ return
+}
diff --git a/modules/user/module.go b/modules/user/module.go
index 19f9ce9ff..89986270d 100644
--- a/modules/user/module.go
+++ b/modules/user/module.go
@@ -47,6 +47,7 @@ type User struct {
modelExpand *ModelExpand
configure *modules.MCompConfigure
service base.IRPCXService
+ modelSign *ModelSign // 签到
}
func (this *User) GetType() core.M_Modules {
diff --git a/pb/pagoda_msg.pb.go b/pb/pagoda_msg.pb.go
index cd1306b54..d715d0307 100644
--- a/pb/pagoda_msg.pb.go
+++ b/pb/pagoda_msg.pb.go
@@ -672,7 +672,7 @@ type PagodaActivateResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
- Data *DBSeasonPagoda `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
+ Data *DBPagoda `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
}
func (x *PagodaActivateResp) Reset() {
@@ -707,7 +707,7 @@ func (*PagodaActivateResp) Descriptor() ([]byte, []int) {
return file_pagoda_pagoda_msg_proto_rawDescGZIP(), []int{13}
}
-func (x *PagodaActivateResp) GetData() *DBSeasonPagoda {
+func (x *PagodaActivateResp) GetData() *DBPagoda {
if x != nil {
return x.Data
}
@@ -772,12 +772,12 @@ var file_pagoda_pagoda_msg_proto_rawDesc = []byte{
0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x65, 0x63,
0x6f, 0x72, 0x64, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x13, 0x0a, 0x11, 0x50, 0x61, 0x67,
- 0x6f, 0x64, 0x61, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x22, 0x39,
+ 0x6f, 0x64, 0x61, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x22, 0x33,
0x0a, 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65,
- 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01,
- 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x53, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x50, 0x61, 0x67,
- 0x6f, 0x64, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
- 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x04, 0x64,
+ 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x33,
}
var (
@@ -813,7 +813,6 @@ var file_pagoda_pagoda_msg_proto_goTypes = []interface{}{
(*BattleInfo)(nil), // 16: BattleInfo
(*BattleReport)(nil), // 17: BattleReport
(*DBPagodaRecord)(nil), // 18: DBPagodaRecord
- (*DBSeasonPagoda)(nil), // 19: DBSeasonPagoda
}
var file_pagoda_pagoda_msg_proto_depIdxs = []int32{
14, // 0: PagodaGetListResp.data:type_name -> DBPagoda
@@ -824,7 +823,7 @@ var file_pagoda_pagoda_msg_proto_depIdxs = []int32{
14, // 5: PagodaChallengeOverResp.data:type_name -> DBPagoda
18, // 6: PagodaRankListResp.ranks:type_name -> DBPagodaRecord
18, // 7: PagodaQueryRecordResp.data:type_name -> DBPagodaRecord
- 19, // 8: PagodaActivateResp.data:type_name -> DBSeasonPagoda
+ 14, // 8: PagodaActivateResp.data:type_name -> DBPagoda
9, // [9:9] is the sub-list for method output_type
9, // [9:9] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension type_name
diff --git a/pb/user_db.pb.go b/pb/user_db.pb.go
index 137d46d2a..e4e0126a1 100644
--- a/pb/user_db.pb.go
+++ b/pb/user_db.pb.go
@@ -477,6 +477,7 @@ type DBSign struct {
SignCount int32 `protobuf:"varint,4,opt,name=signCount,proto3" json:"signCount" bson:"signCount"` //玩家累计签到次数
Group int32 `protobuf:"varint,5,opt,name=group,proto3" json:"group"` // 签到组id
Cid int32 `protobuf:"varint,6,opt,name=cid,proto3" json:"cid"` //记录循环签到值,客户端忽略这个字段
+ RTime int64 `protobuf:"varint,7,opt,name=rTime,proto3" json:"rTime" bson:"rTime"` //刷新时间
}
func (x *DBSign) Reset() {
@@ -553,6 +554,13 @@ func (x *DBSign) GetCid() int32 {
return 0
}
+func (x *DBSign) GetRTime() int64 {
+ if x != nil {
+ return x.RTime
+ }
+ return 0
+}
+
var File_user_user_db_proto protoreflect.FileDescriptor
var file_user_user_db_proto_rawDesc = []byte{
@@ -621,7 +629,7 @@ var file_user_user_db_proto_rawDesc = []byte{
0x67, 0x12, 0x1c, 0x0a, 0x09, 0x78, 0x75, 0x61, 0x6e, 0x73, 0x68, 0x61, 0x6e, 0x67, 0x18, 0x0d,
0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x78, 0x75, 0x61, 0x6e, 0x73, 0x68, 0x61, 0x6e, 0x67, 0x12,
0x14, 0x0a, 0x05, 0x73, 0x61, 0x69, 0x6a, 0x69, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05,
- 0x73, 0x61, 0x69, 0x6a, 0x69, 0x22, 0x8c, 0x01, 0x0a, 0x06, 0x44, 0x42, 0x53, 0x69, 0x67, 0x6e,
+ 0x73, 0x61, 0x69, 0x6a, 0x69, 0x22, 0xa2, 0x01, 0x0a, 0x06, 0x44, 0x42, 0x53, 0x69, 0x67, 0x6e,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x69, 0x67, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03,
@@ -630,8 +638,9 @@ var file_user_user_db_proto_rawDesc = []byte{
0x05, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05,
0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x67, 0x72, 0x6f,
0x75, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52,
- 0x03, 0x63, 0x69, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0x33,
+ 0x03, 0x63, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20,
+ 0x01, 0x28, 0x03, 0x52, 0x05, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
+ 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/utils/time.go b/utils/time.go
index cf675b139..170b83381 100644
--- a/utils/time.go
+++ b/utils/time.go
@@ -79,3 +79,16 @@ func IsInCDHour(cdTime int64) bool {
}
return time.Now().Unix() < cdTime
}
+
+// 获取本月的开始和结束的时间戳
+func GetMonthStartEnd() (int64, int64) {
+ t := time.Now()
+ monthStartDay := t.AddDate(0, 0, -t.Day()+1)
+ monthStartTime := time.Date(monthStartDay.Year(), monthStartDay.Month(), monthStartDay.Day(), 0, 0, 0, 0, t.Location())
+ monthEndDay := monthStartTime.AddDate(0, 1, -1)
+ monthEndTime := time.Date(monthEndDay.Year(), monthEndDay.Month(), monthEndDay.Day(), 23, 59, 59, 0, t.Location())
+ _d1 := monthStartTime.Unix()
+ _d2 := monthEndTime.Unix()
+ fmt.Printf("%d,%d", _d1, _d2)
+ return _d1, _d2
+}