激活修改
This commit is contained in:
parent
72c62c5aed
commit
54a4682a69
@ -9,41 +9,40 @@ import (
|
|||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
func (this *apiComp) ActivateCheck(session comm.IUserSession, req *pb.AtlasActivateReq) (code pb.ErrorCode) {
|
func (this *apiComp) ActivateCheck(session comm.IUserSession, req *pb.AtlasActivateReq) (code pb.ErrorCode) {
|
||||||
|
if req.Id == "" {
|
||||||
|
code = pb.ErrorCode_ReqParameterError
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 一键激活所有激活图鉴信息
|
// 激活图鉴信息
|
||||||
func (this *apiComp) Activate(session comm.IUserSession, req *pb.AtlasActivateReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) Activate(session comm.IUserSession, req *pb.AtlasActivateReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
var (
|
|
||||||
bUpdate bool
|
|
||||||
)
|
|
||||||
if code = this.ActivateCheck(session, req); code != pb.ErrorCode_Success {
|
if code = this.ActivateCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
atlasConf := this.module.configure.GetPandoAtlasConf(req.Id)
|
||||||
|
if atlasConf == nil {
|
||||||
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
|
return
|
||||||
|
}
|
||||||
list, _ := this.module.modelPandaAtlas.getPandaAtlasList(session.GetUserId())
|
list, _ := this.module.modelPandaAtlas.getPandaAtlasList(session.GetUserId())
|
||||||
for k, v := range list.Collect {
|
if v, ok := list.Collect[req.Id]; ok {
|
||||||
if !v.Activate {
|
if !v.Activate {
|
||||||
|
update := make(map[string]interface{})
|
||||||
v.Activate = true // 找到图鉴积分 并更新积分
|
v.Activate = true // 找到图鉴积分 并更新积分
|
||||||
if atlasConf := this.module.configure.GetPandoAtlasConf(k); atlasConf != nil {
|
list.Score += atlasConf.AtlasScore
|
||||||
list.Score += atlasConf.AtlasScore
|
update["collect"] = list.Collect
|
||||||
bUpdate = true
|
update["score"] = list.Score
|
||||||
}
|
this.module.modelPandaAtlas.modifyPandaAtlasList(session.GetUserId(), update)
|
||||||
|
session.SendMsg(string(this.module.GetType()), "activate", &pb.AtlasActivateResp{
|
||||||
|
Data: list,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
code = pb.ErrorCode_MartialhallAtlasError
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if bUpdate { // 更新数据
|
code = pb.ErrorCode_SmithyNoFoundAtlas
|
||||||
update := make(map[string]interface{})
|
|
||||||
update["collect"] = list.Collect
|
|
||||||
update["score"] = list.Score
|
|
||||||
|
|
||||||
this.module.modelPandaAtlas.modifyPandaAtlasList(session.GetUserId(), update)
|
|
||||||
} else {
|
|
||||||
code = pb.ErrorCode_MartialhallAtlasError
|
|
||||||
}
|
|
||||||
|
|
||||||
session.SendMsg(string(this.module.GetType()), "activate", &pb.AtlasActivateResp{
|
|
||||||
Data: list,
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,8 @@ type AtlasActivateReq struct {
|
|||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` // 图鉴ID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AtlasActivateReq) Reset() {
|
func (x *AtlasActivateReq) Reset() {
|
||||||
@ -145,6 +147,13 @@ func (*AtlasActivateReq) Descriptor() ([]byte, []int) {
|
|||||||
return file_atlas_atlas_msg_proto_rawDescGZIP(), []int{2}
|
return file_atlas_atlas_msg_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *AtlasActivateReq) GetId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type AtlasActivateResp struct {
|
type AtlasActivateResp struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@ -297,8 +306,9 @@ var file_atlas_atlas_msg_proto_rawDesc = []byte{
|
|||||||
0x41, 0x74, 0x6c, 0x61, 0x73, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70,
|
0x41, 0x74, 0x6c, 0x61, 0x73, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70,
|
||||||
0x12, 0x21, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d,
|
0x12, 0x21, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d,
|
||||||
0x2e, 0x44, 0x42, 0x50, 0x61, 0x6e, 0x64, 0x61, 0x41, 0x74, 0x6c, 0x61, 0x73, 0x52, 0x04, 0x64,
|
0x2e, 0x44, 0x42, 0x50, 0x61, 0x6e, 0x64, 0x61, 0x41, 0x74, 0x6c, 0x61, 0x73, 0x52, 0x04, 0x64,
|
||||||
0x61, 0x74, 0x61, 0x22, 0x12, 0x0a, 0x10, 0x41, 0x74, 0x6c, 0x61, 0x73, 0x41, 0x63, 0x74, 0x69,
|
0x61, 0x74, 0x61, 0x22, 0x22, 0x0a, 0x10, 0x41, 0x74, 0x6c, 0x61, 0x73, 0x41, 0x63, 0x74, 0x69,
|
||||||
0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x22, 0x36, 0x0a, 0x11, 0x41, 0x74, 0x6c, 0x61, 0x73,
|
0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||||
|
0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x36, 0x0a, 0x11, 0x41, 0x74, 0x6c, 0x61, 0x73,
|
||||||
0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x04,
|
0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x04,
|
||||||
0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x50,
|
0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x50,
|
||||||
0x61, 0x6e, 0x64, 0x61, 0x41, 0x74, 0x6c, 0x61, 0x73, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22,
|
0x61, 0x6e, 0x64, 0x61, 0x41, 0x74, 0x6c, 0x61, 0x73, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22,
|
||||||
|
Loading…
Reference in New Issue
Block a user