上传星座图代码

This commit is contained in:
liwei1dao 2022-11-03 16:33:40 +08:00
parent e6f22d2c46
commit 7f9bda681d
3 changed files with 9 additions and 9 deletions

View File

@ -39,7 +39,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.HoroscopeUpgrade
code = pb.ErrorCode_ConfigNoFound
return
}
if v, ok := info.Nodes[front.GrowType]; !ok || v < front.Lv {
if v, ok := info.Nodes[front.NodeId]; !ok || v < front.Lv {
code = pb.ErrorCode_HoroscopeNotTurnedOn
return
}
@ -51,11 +51,11 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.HoroscopeUpgrade
if code = this.module.ConsumeRes(session, conf.CostItem, true); code != pb.ErrorCode_Success {
return
}
info.Nodes[conf.GrowType] = conf.Lv
info.Nodes[conf.NodeId] = conf.Lv
if err = this.module.modelHoroscope.updateInfo(info); err != nil {
code = pb.ErrorCode_DBError
return
}
session.SendMsg(string(this.module.GetType()), "upgrade", &pb.HoroscopeUpgradeResp{Gid: front.GrowType, Lv: conf.Lv})
session.SendMsg(string(this.module.GetType()), "upgrade", &pb.HoroscopeUpgradeResp{Nid: conf.NodeId, Lv: conf.Lv})
return
}

View File

@ -27,7 +27,7 @@ type DBHoroscope struct {
unknownFields protoimpl.UnknownFields
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"_id"`
Nodes map[int32]int32 `protobuf:"bytes,2,rep,name=nodes,proto3" json:"nodes" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //节点信息 key:是成长线 GrowType value:等级
Nodes map[int32]int32 `protobuf:"bytes,2,rep,name=nodes,proto3" json:"nodes" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //节点信息 key:是节点id value:等级
}
func (x *DBHoroscope) Reset() {

View File

@ -161,7 +161,7 @@ type HoroscopeUpgradeResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Gid int32 `protobuf:"varint,1,opt,name=gid,proto3" json:"gid"` //成长线id 配置文件里面的 GrowType 字段
Nid int32 `protobuf:"varint,1,opt,name=nid,proto3" json:"nid"` //成长线id 配置文件里面的 节点id 字段
Lv int32 `protobuf:"varint,2,opt,name=lv,proto3" json:"lv"`
}
@ -197,9 +197,9 @@ func (*HoroscopeUpgradeResp) Descriptor() ([]byte, []int) {
return file_horoscope_horoscope_msg_proto_rawDescGZIP(), []int{3}
}
func (x *HoroscopeUpgradeResp) GetGid() int32 {
func (x *HoroscopeUpgradeResp) GetNid() int32 {
if x != nil {
return x.Gid
return x.Nid
}
return 0
}
@ -226,8 +226,8 @@ var file_horoscope_horoscope_msg_proto_rawDesc = []byte{
0x73, 0x63, 0x6f, 0x70, 0x65, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x71, 0x12,
0x10, 0x0a, 0x03, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6e, 0x69,
0x64, 0x22, 0x38, 0x0a, 0x14, 0x48, 0x6f, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x55, 0x70,
0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x67, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c,
0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6e, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c,
0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}