上传工会信息

This commit is contained in:
liwei1dao 2024-01-12 20:28:16 +08:00
parent ddcda41c3c
commit a68f4ba8ab
4 changed files with 47 additions and 39 deletions

View File

@ -91,33 +91,32 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.SociatyReceiveRe
}
// 更新公会经验和活跃度
if err := this.module.modelSociaty.updateResourceFromTask(sociaty, conf); err != nil {
this.module.Error("更新公会资源",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "sociatyId", Value: sociaty.Id},
log.Field{Key: "taskId", Value: req.TaskId},
log.Field{Key: "err", Value: err.Error()},
)
return
for _, v := range conf.SociatyReward {
if v.T == "guildactive" {
sociaty.Activity += v.N
} else if v.T == "guildexp" {
sociaty.Exp += v.N
}
}
// 更新成员贡献值
if err := this.module.modelSociaty.updateMemberContribution(uid, conf.Contribution, sociaty); err != nil {
this.module.Error("更新公会成员贡献值",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "sociatyId", Value: sociaty.Id},
log.Field{Key: "taskId", Value: req.TaskId},
log.Field{Key: "err", Value: err.Error()},
)
return
for _, m := range sociaty.Members {
if m.Uid == uid {
m.Contribution += conf.Contribution
break
}
}
this.module.modelSociaty.ChangeList(comm.RDS_EMPTY, sociaty.Id, map[string]interface{}{
"exp": sociaty.Exp,
"activity": sociaty.Activity,
"members": sociaty.Members,
})
rsp := &pb.SociatyReceiveResp{
SociatyId: sociaty.Id,
TaskId: req.TaskId,
Reward: atno,
}
session.SendMsg(string(this.module.GetType()), SociatySubTypeReceive, rsp)
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {

View File

@ -75,11 +75,9 @@ func (this *ModelSociatyTask) deleTask(sociatyId, uid string) error {
// 任务奖励领取
func (this *ModelSociatyTask) receive(sociatyTask *pb.DBSociatyTask) error {
update := map[string]interface{}{
"taskList": sociatyTask.TaskList,
}
if err := this.Redis.HMSet(fmt.Sprintf("%s:%s-%s", this.TableName,
sociatyTask.SociatyId, sociatyTask.Uid), update); err != nil {
log.Error("DBModel ChangeList", log.Field{Key: "err", Value: err.Error()})
@ -87,7 +85,7 @@ func (this *ModelSociatyTask) receive(sociatyTask *pb.DBSociatyTask) error {
}
if err := this.UpdateModelLogs(this.TableName,
sociatyTask.Uid, bson.M{"sociatyid": sociatyTask.SociatyId, "uid": sociatyTask.Uid}, update); err != nil {
sociatyTask.Uid, bson.M{"sociatyid": sociatyTask.SociatyId, "_id": sociatyTask.Uid}, update); err != nil {
return err
}
return nil

View File

@ -470,6 +470,7 @@ type DBPagodaRace struct {
Rtime int64 `protobuf:"varint,5,opt,name=rtime,proto3" json:"rtime"` // 刷新时间 客户端不用
Battlecount int32 `protobuf:"varint,6,opt,name=battlecount,proto3" json:"battlecount"` // 今日挑战次数
Reward map[int32]int32 `protobuf:"bytes,7,rep,name=reward,proto3" json:"reward" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key 组
Uinfo *BaseUserInfo `protobuf:"bytes,8,opt,name=uinfo,proto3" json:"uinfo"` //用户基础
}
func (x *DBPagodaRace) Reset() {
@ -553,6 +554,13 @@ func (x *DBPagodaRace) GetReward() map[int32]int32 {
return nil
}
func (x *DBPagodaRace) GetUinfo() *BaseUserInfo {
if x != nil {
return x.Uinfo
}
return nil
}
var File_pagoda_pagoda_db_proto protoreflect.FileDescriptor
var file_pagoda_pagoda_db_proto_rawDesc = []byte{
@ -626,7 +634,7 @@ var file_pagoda_pagoda_db_proto_rawDesc = []byte{
0x0a, 0x04, 0x73, 0x74, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x74,
0x61, 0x72, 0x12, 0x1d, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x09, 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x6c, 0x69, 0x6e,
0x65, 0x22, 0xe3, 0x02, 0x0a, 0x0c, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61,
0x65, 0x22, 0x88, 0x03, 0x0a, 0x0c, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61,
0x63, 0x65, 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, 0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03,
@ -640,16 +648,18 @@ var file_pagoda_pagoda_db_proto_rawDesc = []byte{
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x31, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18,
0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61,
0x52, 0x61, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x1a, 0x42, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x52, 0x61, 0x63, 0x65, 0x44, 0x61, 0x74,
0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b,
0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x23, 0x0a, 0x05, 0x75, 0x69, 0x6e, 0x66,
0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73,
0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x75, 0x69, 0x6e, 0x66, 0x6f, 0x1a, 0x42, 0x0a,
0x09, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x52, 0x61,
0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b,
0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04,
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -692,13 +702,14 @@ var file_pagoda_pagoda_db_proto_depIdxs = []int32{
13, // 7: RaceData.line:type_name -> LineData
9, // 8: DBPagodaRace.data:type_name -> DBPagodaRace.DataEntry
10, // 9: DBPagodaRace.reward:type_name -> DBPagodaRace.RewardEntry
4, // 10: DBRacePagodaRecord.DataEntry.value:type_name -> RaceData
4, // 11: DBPagodaRace.DataEntry.value:type_name -> RaceData
12, // [12:12] is the sub-list for method output_type
12, // [12:12] is the sub-list for method input_type
12, // [12:12] is the sub-list for extension type_name
12, // [12:12] is the sub-list for extension extendee
0, // [0:12] is the sub-list for field type_name
12, // 10: DBPagodaRace.uinfo:type_name -> BaseUserInfo
4, // 11: DBRacePagodaRecord.DataEntry.value:type_name -> RaceData
4, // 12: DBPagodaRace.DataEntry.value:type_name -> RaceData
13, // [13:13] is the sub-list for method output_type
13, // [13:13] is the sub-list for method input_type
13, // [13:13] is the sub-list for extension type_name
13, // [13:13] is the sub-list for extension extendee
0, // [0:13] is the sub-list for field type_name
}
func init() { file_pagoda_pagoda_db_proto_init() }

View File

@ -505,7 +505,7 @@ type DBSociatyTask struct {
unknownFields protoimpl.UnknownFields
SociatyId string `protobuf:"bytes,1,opt,name=sociatyId,proto3" json:"sociatyId"` //@go_tags(`bson:"sociatyId") 公会ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"_id"` //用户ID 此处特殊处理 兼容业务层数据存储方式
TaskList map[int32]int32 `protobuf:"bytes,3,rep,name=taskList,proto3" json:"taskList" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"taskList"` //任务列表
ActivityList map[int32]int32 `protobuf:"bytes,4,rep,name=activityList,proto3" json:"activityList" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"activityList"` //活跃度列表
LastUpdateTime int64 `protobuf:"varint,5,opt,name=lastUpdateTime,proto3" json:"lastUpdateTime" bson:"lastUpdateTime"` //上次初始时间