This commit is contained in:
aozhiwei 2019-09-16 23:28:09 +08:00
parent ec4b6dcb62
commit 4b24ebe296
3 changed files with 20 additions and 1 deletions

View File

@ -126,11 +126,11 @@ bool CustomPbSerialize(char* buf, int buflen, google::protobuf::Message* msg)
int offset = 0; int offset = 0;
for (int i = 0; i < descriptor->field_count(); ++i) { for (int i = 0; i < descriptor->field_count(); ++i) {
const google::protobuf::FieldDescriptor* field_desc = descriptor->field(i); const google::protobuf::FieldDescriptor* field_desc = descriptor->field(i);
int fixed_len = field_desc->options().GetExtension(cs::fixed_len);
switch (field_desc->cpp_type()) { switch (field_desc->cpp_type()) {
case google::protobuf::FieldDescriptor::CPPTYPE_STRING: case google::protobuf::FieldDescriptor::CPPTYPE_STRING:
{ {
std::string val = reflection->GetString(*msg, field_desc); std::string val = reflection->GetString(*msg, field_desc);
int fixed_len = field_desc->options().GetExtension(cs::fixed_len);
if (field_desc->type() == google::protobuf::FieldDescriptor::TYPE_BYTES && fixed_len > 0) { if (field_desc->type() == google::protobuf::FieldDescriptor::TYPE_BYTES && fixed_len > 0) {
if (offset + fixed_len > buflen) { if (offset + fixed_len > buflen) {
abort(); abort();

View File

@ -2,6 +2,8 @@
#include "playermgr.h" #include "playermgr.h"
#include "cs_proto.pb.h" #include "cs_proto.pb.h"
#include "dbengine.h"
#include "GCListener.h"
void PlayerMgr::Init() void PlayerMgr::Init()
{ {
@ -16,6 +18,15 @@ void PlayerMgr::UnInit()
void PlayerMgr::_CMAuthSession(f8::MsgHdr& hdr, const cs::CMAuthSession& msg) void PlayerMgr::_CMAuthSession(f8::MsgHdr& hdr, const cs::CMAuthSession& msg)
{ {
std::string digest = msg.digest(); std::string digest = msg.digest();
int ret = DBEngine::Instance()->ExecQuery("SELECT id, gmlevel, sessionkey, last_ip, locked, v, s, mutetime,"
" locale, os FROM zeor_realm.account WHERE username='%s';",
{
msg.account()
});
assert(ret > 0);
cs::SMAuthResponse respmsg;
respmsg.set_errcode(0);
GCListener::Instance()->SendMsg(hdr.socket_handle, respmsg);
} }
int PlayerMgr::OnlineNum() int PlayerMgr::OnlineNum()

View File

@ -11,6 +11,14 @@ message SMAuthChallenge
optional uint32 seed = 1; optional uint32 seed = 1;
} }
message SMAuthResponse
{
optional int32 errcode = 1 [(fixed_len) = 1];
optional int32 billing_time_remaining = 2;
optional int32 billing_plan_flags = 3 [(fixed_len) = 1];
optional int32 billing_time_rested = 4;
}
message CMAuthSession message CMAuthSession
{ {
optional uint32 built_number_client = 1; optional uint32 built_number_client = 1;