0508 20:26 更新了注册逻辑 修改为邮箱手机申请,添加验证码接口
包结构改变
This commit is contained in:
@@ -4,17 +4,18 @@
|
||||
|
||||
#include "Request.h"
|
||||
|
||||
Request::Request(mp::MP_TYPE type, uint64_t account, const std::string& password) :
|
||||
Mph(type), Body(account, password), Cqi() {
|
||||
// 账户或者 手机号|邮箱|账户 请求 登陆注册
|
||||
Request::Request(mp::MP_TYPE type, mp::MP_SUB_TYPE subType, const std::string& account, const std::string& password) :
|
||||
Mph(type), Body(subType, account, password), Cqi() {
|
||||
|
||||
}
|
||||
|
||||
// IM 文本聊天请求
|
||||
Request::Request(mp::MP_TYPE type, uint64_t target, uint64_t source, const std::string& data) :
|
||||
Mph(type), Body(target, source, data), Cqi() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Request::init() {
|
||||
memset(temp, 0 , 256);
|
||||
request = new mp::request();
|
||||
@@ -40,3 +41,5 @@ Request::~Request() {
|
||||
delete request;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_mp_2ebody_2eproto::offsets[] P
|
||||
PROTOBUF_FIELD_OFFSET(::mp::body, target_),
|
||||
PROTOBUF_FIELD_OFFSET(::mp::body, source_),
|
||||
PROTOBUF_FIELD_OFFSET(::mp::body, data_),
|
||||
PROTOBUF_FIELD_OFFSET(::mp::body, email_),
|
||||
PROTOBUF_FIELD_OFFSET(::mp::body, phone_),
|
||||
};
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{ 0, -1, sizeof(::mp::body)},
|
||||
@@ -60,11 +62,11 @@ static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] =
|
||||
};
|
||||
|
||||
const char descriptor_table_protodef_mp_2ebody_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\rmp.body.proto\022\002mp\032\014mp.mph.proto\"|\n\004bod"
|
||||
"y\022#\n\nsubcommand\030\001 \001(\0162\017.mp.MP_SUB_TYPE\022\017"
|
||||
"\n\007account\030\002 \001(\004\022\020\n\010password\030\003 \001(\t\022\016\n\006tar"
|
||||
"get\030\004 \001(\004\022\016\n\006source\030\005 \001(\004\022\014\n\004data\030\006 \001(\tb"
|
||||
"\006proto3"
|
||||
"\n\rmp.body.proto\022\002mp\032\014mp.mph.proto\"\232\001\n\004bo"
|
||||
"dy\022#\n\nsubcommand\030\001 \001(\0162\017.mp.MP_SUB_TYPE\022"
|
||||
"\017\n\007account\030\002 \001(\t\022\020\n\010password\030\003 \001(\t\022\016\n\006ta"
|
||||
"rget\030\004 \001(\004\022\016\n\006source\030\005 \001(\004\022\014\n\004data\030\006 \001(\t"
|
||||
"\022\r\n\005email\030\007 \001(\t\022\r\n\005phone\030\010 \001(\004b\006proto3"
|
||||
;
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_mp_2ebody_2eproto_deps[1] = {
|
||||
&::descriptor_table_mp_2emph_2eproto,
|
||||
@@ -74,7 +76,7 @@ static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_mp_
|
||||
};
|
||||
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_mp_2ebody_2eproto_once;
|
||||
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_mp_2ebody_2eproto = {
|
||||
false, false, descriptor_table_protodef_mp_2ebody_2eproto, "mp.body.proto", 167,
|
||||
false, false, descriptor_table_protodef_mp_2ebody_2eproto, "mp.body.proto", 198,
|
||||
&descriptor_table_mp_2ebody_2eproto_once, descriptor_table_mp_2ebody_2eproto_sccs, descriptor_table_mp_2ebody_2eproto_deps, 1, 1,
|
||||
schemas, file_default_instances, TableStruct_mp_2ebody_2eproto::offsets,
|
||||
file_level_metadata_mp_2ebody_2eproto, 1, file_level_enum_descriptors_mp_2ebody_2eproto, file_level_service_descriptors_mp_2ebody_2eproto,
|
||||
@@ -101,6 +103,11 @@ body::body(::PROTOBUF_NAMESPACE_ID::Arena* arena)
|
||||
body::body(const body& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
account_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
if (!from._internal_account().empty()) {
|
||||
account_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_account(),
|
||||
GetArena());
|
||||
}
|
||||
password_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
if (!from._internal_password().empty()) {
|
||||
password_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_password(),
|
||||
@@ -111,19 +118,26 @@ body::body(const body& from)
|
||||
data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_data(),
|
||||
GetArena());
|
||||
}
|
||||
::memcpy(&account_, &from.account_,
|
||||
email_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
if (!from._internal_email().empty()) {
|
||||
email_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_email(),
|
||||
GetArena());
|
||||
}
|
||||
::memcpy(&target_, &from.target_,
|
||||
static_cast<size_t>(reinterpret_cast<char*>(&subcommand_) -
|
||||
reinterpret_cast<char*>(&account_)) + sizeof(subcommand_));
|
||||
reinterpret_cast<char*>(&target_)) + sizeof(subcommand_));
|
||||
// @@protoc_insertion_point(copy_constructor:mp.body)
|
||||
}
|
||||
|
||||
void body::SharedCtor() {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_body_mp_2ebody_2eproto.base);
|
||||
account_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
password_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
::memset(&account_, 0, static_cast<size_t>(
|
||||
email_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
::memset(&target_, 0, static_cast<size_t>(
|
||||
reinterpret_cast<char*>(&subcommand_) -
|
||||
reinterpret_cast<char*>(&account_)) + sizeof(subcommand_));
|
||||
reinterpret_cast<char*>(&target_)) + sizeof(subcommand_));
|
||||
}
|
||||
|
||||
body::~body() {
|
||||
@@ -134,8 +148,10 @@ body::~body() {
|
||||
|
||||
void body::SharedDtor() {
|
||||
GOOGLE_DCHECK(GetArena() == nullptr);
|
||||
account_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
password_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
data_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
email_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
|
||||
void body::ArenaDtor(void* object) {
|
||||
@@ -159,11 +175,13 @@ void body::Clear() {
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
account_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
password_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
data_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
::memset(&account_, 0, static_cast<size_t>(
|
||||
email_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
::memset(&target_, 0, static_cast<size_t>(
|
||||
reinterpret_cast<char*>(&subcommand_) -
|
||||
reinterpret_cast<char*>(&account_)) + sizeof(subcommand_));
|
||||
reinterpret_cast<char*>(&target_)) + sizeof(subcommand_));
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
@@ -183,10 +201,12 @@ const char* body::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
|
||||
_internal_set_subcommand(static_cast<::mp::MP_SUB_TYPE>(val));
|
||||
} else goto handle_unusual;
|
||||
continue;
|
||||
// uint64 account = 2;
|
||||
// string account = 2;
|
||||
case 2:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
|
||||
account_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
|
||||
auto str = _internal_mutable_account();
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
|
||||
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "mp.body.account"));
|
||||
CHK_(ptr);
|
||||
} else goto handle_unusual;
|
||||
continue;
|
||||
@@ -222,6 +242,22 @@ const char* body::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
|
||||
CHK_(ptr);
|
||||
} else goto handle_unusual;
|
||||
continue;
|
||||
// string email = 7;
|
||||
case 7:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
|
||||
auto str = _internal_mutable_email();
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
|
||||
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "mp.body.email"));
|
||||
CHK_(ptr);
|
||||
} else goto handle_unusual;
|
||||
continue;
|
||||
// uint64 phone = 8;
|
||||
case 8:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 64)) {
|
||||
phone_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
|
||||
CHK_(ptr);
|
||||
} else goto handle_unusual;
|
||||
continue;
|
||||
default: {
|
||||
handle_unusual:
|
||||
if ((tag & 7) == 4 || tag == 0) {
|
||||
@@ -257,10 +293,14 @@ failure:
|
||||
1, this->_internal_subcommand(), target);
|
||||
}
|
||||
|
||||
// uint64 account = 2;
|
||||
if (this->account() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(2, this->_internal_account(), target);
|
||||
// string account = 2;
|
||||
if (this->account().size() > 0) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->_internal_account().data(), static_cast<int>(this->_internal_account().length()),
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
|
||||
"mp.body.account");
|
||||
target = stream->WriteStringMaybeAliased(
|
||||
2, this->_internal_account(), target);
|
||||
}
|
||||
|
||||
// string password = 3;
|
||||
@@ -295,6 +335,22 @@ failure:
|
||||
6, this->_internal_data(), target);
|
||||
}
|
||||
|
||||
// string email = 7;
|
||||
if (this->email().size() > 0) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->_internal_email().data(), static_cast<int>(this->_internal_email().length()),
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
|
||||
"mp.body.email");
|
||||
target = stream->WriteStringMaybeAliased(
|
||||
7, this->_internal_email(), target);
|
||||
}
|
||||
|
||||
// uint64 phone = 8;
|
||||
if (this->phone() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(8, this->_internal_phone(), target);
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
|
||||
@@ -311,6 +367,13 @@ size_t body::ByteSizeLong() const {
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// string account = 2;
|
||||
if (this->account().size() > 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
|
||||
this->_internal_account());
|
||||
}
|
||||
|
||||
// string password = 3;
|
||||
if (this->password().size() > 0) {
|
||||
total_size += 1 +
|
||||
@@ -325,11 +388,11 @@ size_t body::ByteSizeLong() const {
|
||||
this->_internal_data());
|
||||
}
|
||||
|
||||
// uint64 account = 2;
|
||||
if (this->account() != 0) {
|
||||
// string email = 7;
|
||||
if (this->email().size() > 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
|
||||
this->_internal_account());
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
|
||||
this->_internal_email());
|
||||
}
|
||||
|
||||
// uint64 target = 4;
|
||||
@@ -346,6 +409,13 @@ size_t body::ByteSizeLong() const {
|
||||
this->_internal_source());
|
||||
}
|
||||
|
||||
// uint64 phone = 8;
|
||||
if (this->phone() != 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
|
||||
this->_internal_phone());
|
||||
}
|
||||
|
||||
// .mp.MP_SUB_TYPE subcommand = 1;
|
||||
if (this->subcommand() != 0) {
|
||||
total_size += 1 +
|
||||
@@ -383,14 +453,17 @@ void body::MergeFrom(const body& from) {
|
||||
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (from.account().size() > 0) {
|
||||
_internal_set_account(from._internal_account());
|
||||
}
|
||||
if (from.password().size() > 0) {
|
||||
_internal_set_password(from._internal_password());
|
||||
}
|
||||
if (from.data().size() > 0) {
|
||||
_internal_set_data(from._internal_data());
|
||||
}
|
||||
if (from.account() != 0) {
|
||||
_internal_set_account(from._internal_account());
|
||||
if (from.email().size() > 0) {
|
||||
_internal_set_email(from._internal_email());
|
||||
}
|
||||
if (from.target() != 0) {
|
||||
_internal_set_target(from._internal_target());
|
||||
@@ -398,6 +471,9 @@ void body::MergeFrom(const body& from) {
|
||||
if (from.source() != 0) {
|
||||
_internal_set_source(from._internal_source());
|
||||
}
|
||||
if (from.phone() != 0) {
|
||||
_internal_set_phone(from._internal_phone());
|
||||
}
|
||||
if (from.subcommand() != 0) {
|
||||
_internal_set_subcommand(from._internal_subcommand());
|
||||
}
|
||||
@@ -424,14 +500,16 @@ bool body::IsInitialized() const {
|
||||
void body::InternalSwap(body* other) {
|
||||
using std::swap;
|
||||
_internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
|
||||
account_.Swap(&other->account_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
password_.Swap(&other->password_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
data_.Swap(&other->data_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
email_.Swap(&other->email_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
::PROTOBUF_NAMESPACE_ID::internal::memswap<
|
||||
PROTOBUF_FIELD_OFFSET(body, subcommand_)
|
||||
+ sizeof(body::subcommand_)
|
||||
- PROTOBUF_FIELD_OFFSET(body, account_)>(
|
||||
reinterpret_cast<char*>(&account_),
|
||||
reinterpret_cast<char*>(&other->account_));
|
||||
- PROTOBUF_FIELD_OFFSET(body, target_)>(
|
||||
reinterpret_cast<char*>(&target_),
|
||||
reinterpret_cast<char*>(&other->target_));
|
||||
}
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata body::GetMetadata() const {
|
||||
|
||||
@@ -61,19 +61,24 @@ static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] =
|
||||
const char descriptor_table_protodef_mp_2emph_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\014mp.mph.proto\022\002mp\"b\n\003mph\022\020\n\010mpb_size\030\001 "
|
||||
"\001(\r\022\r\n\005mp_id\030\002 \001(\004\022\016\n\006mp_sum\030\003 \001(\r\022\034\n\007mp"
|
||||
"_type\030\004 \001(\0162\013.mp.MP_TYPE\022\014\n\004path\030\005 \001(\t*\307"
|
||||
"_type\030\004 \001(\0162\013.mp.MP_TYPE\022\014\n\004path\030\005 \001(\t*\370"
|
||||
"\001\n\007MP_TYPE\022\024\n\020MP_REQUEST_LOGIN\020\000\022\025\n\021MP_R"
|
||||
"EQUEST_LOGOUT\020\001\022\027\n\023MP_REQUEST_REGISTER\020\002"
|
||||
"\022\025\n\021MP_RESPONSE_LOGIN\020\024\022\026\n\022MP_RESPONSE_L"
|
||||
"OGOUT\020\025\022\030\n\024MP_RESPONSE_REGISTER\020\026\022\025\n\021MP_"
|
||||
"REQUEST_IM_ADD\020d\022\026\n\022MP_RESPONSE_IM_ADD\020x"
|
||||
"*\366\001\n\013MP_SUB_TYPE\022!\n\035MP_REQUEST_ADD_CONTA"
|
||||
"CT_PERSON\020\000\022$\n MP_REQUEST_REMOVE_CONTACT"
|
||||
"_PERSON\020\001\022(\n$MP_REQUEST_BLACK_LIST_CONTA"
|
||||
"CT_PERSON\020\002\022\"\n\036MP_RESPONSE_ADD_CONTACT_P"
|
||||
"ERSON\020\024\022%\n!MP_RESPONSE_REMOVE_CONTACT_PE"
|
||||
"RSON\020\025\022)\n%MP_RESPONSE_BLACK_LIST_CONTACT"
|
||||
"_PERSON\020\026b\006proto3"
|
||||
"OGOUT\020\025\022\030\n\024MP_RESPONSE_REGISTER\020\026\022\026\n\022MP_"
|
||||
"REQUEST_PE_CODE\020(\022\027\n\023MP_RESPONSE_PE_CODE"
|
||||
"\020<\022\025\n\021MP_REQUEST_IM_ADD\020d\022\026\n\022MP_RESPONSE"
|
||||
"_IM_ADD\020x*\212\003\n\013MP_SUB_TYPE\022\032\n\026MP_REQUEST_"
|
||||
"LOGIN_EMAIL\020\000\022\032\n\026MP_REQUEST_LOGIN_PHONE\020"
|
||||
"\001\022\034\n\030MP_REQUEST_LOGIN_ACCOUNT\020\002\022\035\n\031MP_RE"
|
||||
"QUEST_REGISTER_EMAIL\020\003\022\035\n\031MP_REQUEST_REG"
|
||||
"ISTER_PHONE\020\004\022!\n\035MP_REQUEST_ADD_CONTACT_"
|
||||
"PERSON\020\024\022$\n MP_REQUEST_REMOVE_CONTACT_PE"
|
||||
"RSON\020\025\022(\n$MP_REQUEST_BLACK_LIST_CONTACT_"
|
||||
"PERSON\020\026\022\"\n\036MP_RESPONSE_ADD_CONTACT_PERS"
|
||||
"ON\020(\022%\n!MP_RESPONSE_REMOVE_CONTACT_PERSO"
|
||||
"N\020)\022)\n%MP_RESPONSE_BLACK_LIST_CONTACT_PE"
|
||||
"RSON\020*b\006proto3"
|
||||
;
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_mp_2emph_2eproto_deps[1] = {
|
||||
};
|
||||
@@ -82,7 +87,7 @@ static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_mp_
|
||||
};
|
||||
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_mp_2emph_2eproto_once;
|
||||
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_mp_2emph_2eproto = {
|
||||
false, false, descriptor_table_protodef_mp_2emph_2eproto, "mp.mph.proto", 577,
|
||||
false, false, descriptor_table_protodef_mp_2emph_2eproto, "mp.mph.proto", 774,
|
||||
&descriptor_table_mp_2emph_2eproto_once, descriptor_table_mp_2emph_2eproto_sccs, descriptor_table_mp_2emph_2eproto_deps, 1, 0,
|
||||
schemas, file_default_instances, TableStruct_mp_2emph_2eproto::offsets,
|
||||
file_level_metadata_mp_2emph_2eproto, 1, file_level_enum_descriptors_mp_2emph_2eproto, file_level_service_descriptors_mp_2emph_2eproto,
|
||||
@@ -103,6 +108,8 @@ bool MP_TYPE_IsValid(int value) {
|
||||
case 20:
|
||||
case 21:
|
||||
case 22:
|
||||
case 40:
|
||||
case 60:
|
||||
case 100:
|
||||
case 120:
|
||||
return true;
|
||||
@@ -120,9 +127,14 @@ bool MP_SUB_TYPE_IsValid(int value) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 20:
|
||||
case 21:
|
||||
case 22:
|
||||
case 40:
|
||||
case 41:
|
||||
case 42:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -60,7 +60,7 @@ static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] =
|
||||
const char descriptor_table_protodef_mp_2esri_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\014mp.sri.proto\022\002mp\"]\n\003sri\022\034\n\010sri_code\030\001 "
|
||||
"\001(\0162\n.mp.MP_SRI\022\024\n\014sri_username\030\002 \001(\t\022\017\n"
|
||||
"\007sri_msg\030\003 \001(\t\022\021\n\tsri_token\030\004 \001(\t*\346\002\n\006MP"
|
||||
"\007sri_msg\030\003 \001(\t\022\021\n\tsri_token\030\004 \001(\t*\262\003\n\006MP"
|
||||
"_SRI\022\030\n\024MP_LOGIN_ACCOUNT_NOT\020\000\022\024\n\020MP_LOG"
|
||||
"IN_SUCCESS\020\001\022\021\n\rMP_LOGIN_FAIL\020\002\022\027\n\023MP_RE"
|
||||
"GISTER_SUCCESS\020\n\022\025\n\021MP_REGISTER_EXIST\020\013\022"
|
||||
@@ -69,8 +69,9 @@ const char descriptor_table_protodef_mp_2esri_2eproto[] PROTOBUF_SECTION_VARIABL
|
||||
"IENDS\020\036\022\024\n\020MP_ADD_FRIENDS_0\020\037\022\024\n\020MP_ADD_"
|
||||
"FRIENDS_1\020 \022\024\n\020MP_ADD_FRIENDS_2\020!\022\026\n\022MP_"
|
||||
"ADD_FRIENDS_ERR\020\"\022\033\n\027MP_ADD_FRIENDS_NOT_"
|
||||
"TYPE\020#\022\032\n\026MP_ADD_FRIENDS_SQL_ERR\020$b\006prot"
|
||||
"o3"
|
||||
"TYPE\020#\022\032\n\026MP_ADD_FRIENDS_SQL_ERR\020$\022\035\n\031MP"
|
||||
"_ADD_FRIENDS_ANSWER_ERR\020%\022\026\n\022MP_PE_CODE_"
|
||||
"SUCCESS\0202\022\023\n\017MP_PE_CODE_FAIL\0203b\006proto3"
|
||||
;
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_mp_2esri_2eproto_deps[1] = {
|
||||
};
|
||||
@@ -79,7 +80,7 @@ static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_mp_
|
||||
};
|
||||
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_mp_2esri_2eproto_once;
|
||||
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_mp_2esri_2eproto = {
|
||||
false, false, descriptor_table_protodef_mp_2esri_2eproto, "mp.sri.proto", 482,
|
||||
false, false, descriptor_table_protodef_mp_2esri_2eproto, "mp.sri.proto", 558,
|
||||
&descriptor_table_mp_2esri_2eproto_once, descriptor_table_mp_2esri_2eproto_sccs, descriptor_table_mp_2esri_2eproto_deps, 1, 0,
|
||||
schemas, file_default_instances, TableStruct_mp_2esri_2eproto::offsets,
|
||||
file_level_metadata_mp_2esri_2eproto, 1, file_level_enum_descriptors_mp_2esri_2eproto, file_level_service_descriptors_mp_2esri_2eproto,
|
||||
@@ -109,6 +110,9 @@ bool MP_SRI_IsValid(int value) {
|
||||
case 34:
|
||||
case 35:
|
||||
case 36:
|
||||
case 37:
|
||||
case 50:
|
||||
case 51:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -43,7 +43,7 @@ void handler::add_user(const std::shared_ptr<agreement_request>& request) {
|
||||
auto ele = new userinfo();
|
||||
ele->bev = request->m_bev;
|
||||
sprintf(ele->ip, "%s", inet_ntoa(request->m_addr->sin_addr));
|
||||
user_fd.insert({request->m_body.account(), ele});
|
||||
user_fd.insert({strtol(request->m_body.account().c_str(), nullptr, 0), ele});
|
||||
}
|
||||
|
||||
void handler::remove_user(bufferevent *bev) {
|
||||
@@ -60,11 +60,11 @@ void handler::remove_user(bufferevent *bev) {
|
||||
|
||||
void handler::remove_user(const std::shared_ptr<agreement_request>& request) {
|
||||
bufferevent_free(request->m_bev);
|
||||
user_fd.erase(request->m_body.account());
|
||||
user_fd.erase(strtol(request->m_body.account().c_str(), nullptr, 0));
|
||||
}
|
||||
|
||||
bool handler::is_user(uint64_t account) {
|
||||
if( user_fd.find(account) == user_fd.cend() ){
|
||||
bool handler::is_user(const std::string& account) {
|
||||
if( user_fd.find(strtol(account.c_str(), nullptr, 0)) == user_fd.cend() ){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
static void add_user(const std::shared_ptr<agreement_request>& request);
|
||||
static void remove_user(const std::shared_ptr<agreement_request>& request);
|
||||
static void remove_user(bufferevent* bev);
|
||||
static bool is_user(uint64_t account);
|
||||
static bool is_user(const std::string& account);
|
||||
static std::map<uint64_t, userinfo*>::iterator find_user_fd(uint64_t account);
|
||||
|
||||
static void resp(const std::shared_ptr<agreement_request>& request, const std::shared_ptr<agreement_response>& response);
|
||||
|
||||
@@ -21,6 +21,10 @@ mapping::mapping() {
|
||||
map.insert( std::pair<mp::MP_TYPE, handler*>(mp::MP_REQUEST_REGISTER, userProve));
|
||||
map.insert( std::pair<mp::MP_TYPE, handler*>(mp::MP_REQUEST_LOGOUT, userProve));
|
||||
|
||||
// 验证码
|
||||
auto peVerifCode = new PEVerifCode();
|
||||
map.insert( std::pair<mp::MP_TYPE, handler*>(mp::MP_REQUEST_PE_CODE, peVerifCode));
|
||||
|
||||
// 用户添加好友群组类操作
|
||||
auto improve = new IMProveController();
|
||||
map.insert({mp::MP_REQUEST_IM_ADD, improve});
|
||||
|
||||
@@ -5,7 +5,7 @@ aux_source_directory(service DIR_WORKS_SERVICE)
|
||||
aux_source_directory(db DIR_WORKS_DB)
|
||||
aux_source_directory(db/po DIR_WORKS_DB_PO)
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/MS/mmm)
|
||||
include_directories(../mmm)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/MDB/imm_mysqldb)
|
||||
|
||||
add_library(works
|
||||
|
||||
23
MS/works/controller/PEVerifCode.cpp
Normal file
23
MS/works/controller/PEVerifCode.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Created by dongl on 23-5-8.
|
||||
//
|
||||
|
||||
#include "PEVerifCode.h"
|
||||
#include <experimental/random>
|
||||
|
||||
void PEVerifCode::run(std::shared_ptr<agreement_request> request, std::shared_ptr<agreement_response> response) {
|
||||
std::string code;
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
code.push_back((char )std::experimental::randint(33, 126));
|
||||
}
|
||||
|
||||
code;
|
||||
auto sri = new mp::sri();
|
||||
|
||||
|
||||
sri->set_sri_code(mp::MP_PE_CODE_SUCCESS);
|
||||
sri->set_sri_msg("验证码已发送");
|
||||
|
||||
response->set(sri, request->m_bev);
|
||||
delete sri;
|
||||
}
|
||||
17
MS/works/controller/PEVerifCode.h
Normal file
17
MS/works/controller/PEVerifCode.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// Created by dongl on 23-5-8.
|
||||
//
|
||||
|
||||
#ifndef IM2_PEVERIFCODE_H
|
||||
#define IM2_PEVERIFCODE_H
|
||||
|
||||
|
||||
#include "../../mmm/handler.h"
|
||||
|
||||
class PEVerifCode : public handler{
|
||||
public:
|
||||
void run(std::shared_ptr<agreement_request> request, std::shared_ptr<agreement_response> response) override;
|
||||
};
|
||||
|
||||
|
||||
#endif //IM2_PEVERIFCODE_H
|
||||
@@ -5,16 +5,21 @@
|
||||
#include "UserProveController.h"
|
||||
|
||||
void UserProveController::run(std::shared_ptr<agreement_request> request, std::shared_ptr<agreement_response> response) {
|
||||
// 登陆
|
||||
if (request->m_mph->mp_type() == mp::MP_REQUEST_LOGIN) {
|
||||
auto sri = service.login(request->m_body.account(), request->m_body.password());
|
||||
auto sri = service.login(request->m_body.subcommand(),
|
||||
request->m_body.account(), request->m_body.password());
|
||||
response->set(sri, request->m_bev);
|
||||
handler::add_user(request);
|
||||
|
||||
} else if (request->m_mph->mp_type() == mp::MP_REQUEST_REGISTER) {
|
||||
auto sri = service.register_(request->m_body.account(), request->m_body.password());
|
||||
}
|
||||
// 注册
|
||||
else if (request->m_mph->mp_type() == mp::MP_REQUEST_REGISTER) {
|
||||
auto sri = service.register_(request->m_body.subcommand(),
|
||||
request->m_body.email(), request->m_body.password());
|
||||
response->set(sri, request->m_bev);
|
||||
|
||||
} else if (request->m_mph->mp_type() == mp::MP_REQUEST_LOGOUT) {
|
||||
}
|
||||
// 退出登陆
|
||||
else if (request->m_mph->mp_type() == mp::MP_REQUEST_LOGOUT) {
|
||||
// 查看当前用户是否在线
|
||||
bool state = handler::is_user(request->m_body.account());
|
||||
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
|
||||
#include "UserProveController.h"
|
||||
#include "IMProveController.h"
|
||||
#include "PEVerifCode.h"
|
||||
|
||||
#endif //IM2_WORKS_H
|
||||
|
||||
@@ -8,21 +8,23 @@
|
||||
/// 0505 19:34 im_user 重定义
|
||||
|
||||
// select user info
|
||||
std::tuple<bool, PoUser> UserDB::select_user(uint64_t account) {
|
||||
std::tuple<bool, PoUser> UserDB::select_user(uint64_t account, const std::string& by_field) {
|
||||
conn = LinkDB::safe_grab();
|
||||
auto query = conn->query("select * from im_user where account=%0:account;");
|
||||
auto query = conn->query("select * from im_user where %2:field=%1:account;");
|
||||
query.template_defaults[1] = account;
|
||||
query.template_defaults[2] = by_field.c_str();
|
||||
query.parse();
|
||||
|
||||
std::vector<im_user> user;
|
||||
query.storein(user, account);
|
||||
query.storein(user);
|
||||
|
||||
return {user.empty(), user.empty() ? PoUser() :
|
||||
return {!user.empty(), user.empty() ? PoUser() :
|
||||
PoUser(user[0].account, user[0].username, user[0].password, user[0].password_salt, user[0].client_info.c_str())};
|
||||
}
|
||||
|
||||
// select key account is existed
|
||||
// select key account is existed by account
|
||||
bool UserDB::select_user_exist(uint64_t account) {
|
||||
auto [exist, PoUser] = select_user(account);
|
||||
auto [exist, PoUser] = select_user(account, "account");
|
||||
return exist;
|
||||
}
|
||||
|
||||
@@ -38,7 +40,7 @@ bool UserDB::insert_user(uint64_t account, const std::string &password, const st
|
||||
}
|
||||
|
||||
// insert user friends info
|
||||
bool UserDB::insert_user_friends(uint64_t account) {
|
||||
bool UserDB::insert_user_friends(uint64_t account, uint64_t friends) {
|
||||
// 生成附属表字段 并添加自己为好友 以后官方通知通过此接口发送
|
||||
conn = LinkDB::safe_grab();
|
||||
auto q = conn->query("insert into im_user_friends (account, friends, restrictions) "
|
||||
@@ -46,7 +48,7 @@ bool UserDB::insert_user_friends(uint64_t account) {
|
||||
"JSON_OBJECT('belong_grouping', 0, 'add_time', %3:time, 'add_source', 0)), 0)");
|
||||
|
||||
q.template_defaults[1] = account;
|
||||
q.template_defaults[2] = account;
|
||||
q.template_defaults[2] = friends == 0 ? account : friends;
|
||||
q.template_defaults[3] = time(nullptr);
|
||||
q.parse();
|
||||
|
||||
@@ -79,6 +81,54 @@ bool UserDB::test(uint64_t account) {
|
||||
}
|
||||
|
||||
|
||||
// 号码池 取号
|
||||
std::optional<uint64_t> UserDB::fetch_account() {
|
||||
conn = LinkDB::safe_grab();
|
||||
auto query = conn->query("select account from account_pool limit 0,1");
|
||||
|
||||
auto ret = query.store();
|
||||
|
||||
if (ret.num_rows() < 1) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return std::strtol(ret[0][0], nullptr,0);
|
||||
}
|
||||
|
||||
// 号池内删除帐号
|
||||
bool UserDB::remove_pool_account(uint64_t account) {
|
||||
conn = LinkDB::safe_grab();
|
||||
auto query = conn->query("delete from account_pool where account=%1:account");
|
||||
query.template_defaults[1] = account;
|
||||
query.parse();
|
||||
|
||||
return query.exec();
|
||||
}
|
||||
|
||||
// 帐号 绑定邮箱
|
||||
bool UserDB::bind_email(uint64_t account, const std::string &email) {
|
||||
conn = LinkDB::safe_grab();
|
||||
auto query = conn->query("update im_user set email=%2q:email where account=%1:account");
|
||||
query.template_defaults[1] = account;
|
||||
query.template_defaults[2] = email.c_str();
|
||||
|
||||
query.parse();
|
||||
return query.exec();
|
||||
}
|
||||
|
||||
bool UserDB::bind_phone(uint64_t account, const std::string &phone) {
|
||||
conn = LinkDB::safe_grab();
|
||||
auto query = conn->query("update im_user set phone=%2q:email where account=%1:account");
|
||||
query.template_defaults[1] = account;
|
||||
query.template_defaults[2] = phone.c_str();
|
||||
|
||||
query.parse();
|
||||
return query.exec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,18 +9,33 @@
|
||||
#include "linkDB.h"
|
||||
#include "DB.h"
|
||||
#include "po/po.h"
|
||||
#include <optional>
|
||||
|
||||
class UserDB : public DB {
|
||||
/// login ...
|
||||
public:
|
||||
std::tuple<bool, PoUser> select_user(uint64_t account);
|
||||
// 查询用户
|
||||
std::tuple<bool, PoUser> select_user(uint64_t account, const std::string& by_field);
|
||||
// 查询用户是否存在
|
||||
bool select_user_exist(uint64_t account);
|
||||
// 添加用户
|
||||
bool insert_user(uint64_t account, const std::string &password, const std::string &password_salt,
|
||||
const std::string& client_info = "");
|
||||
bool insert_user_friends(uint64_t account);
|
||||
bool test(uint64_t account);
|
||||
|
||||
// 插入用户好友 初始好友 自己
|
||||
bool insert_user_friends(uint64_t account, uint64_t friends = 0);
|
||||
// 删除用户
|
||||
bool remove_user(uint64_t account);
|
||||
|
||||
// 号池取号
|
||||
std::optional<uint64_t> fetch_account();
|
||||
// 号池内删除帐号
|
||||
bool remove_pool_account(uint64_t account);
|
||||
// 绑定邮箱
|
||||
bool bind_email(uint64_t account, const std::string& email);
|
||||
// 绑定手机
|
||||
bool bind_phone(uint64_t account, const std::string& phone);
|
||||
|
||||
bool test(uint64_t account);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -34,20 +34,32 @@ bool UserFriendsDB::add_friends(uint64_t account, uint64_t friends) {
|
||||
return query.exec();
|
||||
}
|
||||
|
||||
std::vector<uint64_t> UserFriendsDB::select_friends_all(uint64_t account) {
|
||||
void UserFriendsDB::insert_friends_to_be_added(uint64_t account, uint64_t friends) {
|
||||
conn = LinkDB::safe_grab();
|
||||
|
||||
auto q = conn->query("select friends from im_user_friends where account=783556037");
|
||||
|
||||
auto ret = q.store();
|
||||
std::vector<uint64_t> v;
|
||||
return v;
|
||||
}
|
||||
|
||||
rapidjson::Document UserFriendsDB::select_friends_info(uint64_t account, uint64_t friends) {
|
||||
std::optional<rapidjson::Document> UserFriendsDB::select_friends_all(uint64_t account) {
|
||||
conn = LinkDB::safe_grab();
|
||||
rapidjson::Document document;
|
||||
auto q = conn->query("select friends from im_user_friends where account=%0:account");
|
||||
q.parse();
|
||||
auto ret = q.store(account);
|
||||
|
||||
if (ret.num_rows() < 1) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::string friends;
|
||||
ret[0][0].to_string(friends);
|
||||
|
||||
rapidjson::Document document;
|
||||
document.Parse(friends.c_str());
|
||||
|
||||
return document;
|
||||
}
|
||||
|
||||
std::optional<rapidjson::Document>
|
||||
UserFriendsDB::select_friends_info(uint64_t account, uint64_t friends) {
|
||||
conn = LinkDB::safe_grab();
|
||||
auto q = conn->query("select JSON_EXTRACT(friends, '$.\"%2:friends\"') as friend_info "
|
||||
"from im_user_friends where account=%1:account");
|
||||
q.template_defaults[1] = account;
|
||||
@@ -60,7 +72,7 @@ rapidjson::Document UserFriendsDB::select_friends_info(uint64_t account, uint64_
|
||||
printf("%zu\n", ret.num_rows());
|
||||
|
||||
if (ret.num_rows() < 1) {
|
||||
return document;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// 取json字符串
|
||||
@@ -68,15 +80,14 @@ rapidjson::Document UserFriendsDB::select_friends_info(uint64_t account, uint64_
|
||||
ret[0][0].to_string(friend_info);
|
||||
|
||||
// 解析json
|
||||
rapidjson::Document document;
|
||||
document.Parse(friend_info.c_str());
|
||||
|
||||
printf("%d\n", document["add_time"].GetInt());
|
||||
printf("user[%ld] friend_info-> %ld : %s", account, friends, friend_info.c_str());
|
||||
// printf("%u\n", document.Size());
|
||||
return document;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//std::tuple<mp::MP_SRI, mp::MP_SRI, std::string> UserFriendsDB::update_add_info(char type, mp::body *body) {
|
||||
// // 如果是0 直接添加
|
||||
// if (type == '0') {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifndef IM2_USERFRIENDSDB_H
|
||||
#define IM2_USERFRIENDSDB_H
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "DB.h"
|
||||
#include "proto/mp.sri.pb.h"
|
||||
@@ -15,8 +16,9 @@ class UserFriendsDB : public DB {
|
||||
public:
|
||||
char select_add_type(uint64_t account);
|
||||
bool add_friends(uint64_t source, uint64_t target);
|
||||
std::vector<uint64_t> select_friends_all(uint64_t account);
|
||||
rapidjson::Document select_friends_info(uint64_t account, uint64_t friends);
|
||||
std::optional<rapidjson::Document> select_friends_all(uint64_t account);
|
||||
std::optional<rapidjson::Document> select_friends_info(uint64_t account, uint64_t friends);
|
||||
void insert_friends_to_be_added(uint64_t account, uint64_t friends);
|
||||
};
|
||||
|
||||
|
||||
|
||||
10
MS/works/db/po/FriendInfo.cpp
Normal file
10
MS/works/db/po/FriendInfo.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// Created by dongl on 23-5-7.
|
||||
//
|
||||
|
||||
#include "FriendInfo.h"
|
||||
|
||||
namespace PoJson {
|
||||
FriendInfo::FriendInfo(uint8_t belongGrouping, time_t addTime, uint8_t addSource) :
|
||||
belong_grouping(belongGrouping),add_time(addTime),add_source(addSource) {}
|
||||
} // PoJson
|
||||
39
MS/works/db/po/FriendInfo.h
Normal file
39
MS/works/db/po/FriendInfo.h
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// Created by dongl on 23-5-7.
|
||||
//
|
||||
|
||||
#ifndef IM2_FRIENDINFO_H
|
||||
#define IM2_FRIENDINFO_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <ctime>
|
||||
|
||||
|
||||
namespace PoJson {
|
||||
enum BELONG {
|
||||
def = 0, // 默认分组 初始分组 我的好友
|
||||
def1 = 1,
|
||||
};
|
||||
|
||||
enum FRIEND_SOURCE {
|
||||
GROUP = 0,
|
||||
SELECT = 1,
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
namespace PoJson {
|
||||
|
||||
class FriendInfo {
|
||||
public:
|
||||
FriendInfo(uint8_t belongGrouping, time_t addTime, uint8_t addSource);
|
||||
|
||||
private:
|
||||
uint8_t belong_grouping; // 所属分组 默认好友列表
|
||||
time_t add_time; // 添加时间
|
||||
uint8_t add_source; // 添加来源
|
||||
};
|
||||
|
||||
} // PoJson
|
||||
|
||||
#endif //IM2_FRIENDINFO_H
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <mysql++/connection.h>
|
||||
#include <proto/mp.sri.pb.h>
|
||||
#include "db/UserDB.h"
|
||||
|
||||
class Service {
|
||||
public:
|
||||
@@ -14,6 +15,10 @@ public:
|
||||
sri = new mp::sri();
|
||||
}
|
||||
|
||||
virtual ~Service() {
|
||||
delete sri;
|
||||
}
|
||||
|
||||
protected:
|
||||
mp::sri* sri;
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
#include "UserFriendsService.h"
|
||||
|
||||
UserFriendsService::~UserFriendsService() {
|
||||
delete sri;
|
||||
}
|
||||
UserFriendsService::~UserFriendsService() {}
|
||||
|
||||
// 好友群组 添加删除 任务组 决策接口
|
||||
mp::sri *UserFriendsService::imProve(mp::body* body) {
|
||||
sri_clear();
|
||||
if (body->target() == 0 || body->source() == 0) {
|
||||
printf("请求数据有缺\n");
|
||||
sri->set_sri_msg("请求数据有缺");
|
||||
@@ -33,28 +33,44 @@ mp::sri *UserFriendsService::imProve(mp::body* body) {
|
||||
return sri;
|
||||
}
|
||||
|
||||
void UserFriendsService::add_friends(mp::body *body) {
|
||||
bool state1 = userFriendsDb.add_friends(body->source(), body->target());
|
||||
bool state2 = userFriendsDb.add_friends(body->target(), body->source());
|
||||
if (state1 && state2) {
|
||||
sri->set_sri_code((mp::MP_SRI)(mp::MP_ADD_FRIENDS | mp::MP_ADD_FRIENDS_0));
|
||||
sri->set_sri_msg("添加成功");
|
||||
} else {
|
||||
sri->set_sri_code((mp::MP_SRI)(mp::MP_ADD_FRIENDS_ERR | mp::MP_ADD_FRIENDS_SQL_ERR));
|
||||
sri->set_sri_msg("添加失败,请重试");
|
||||
}
|
||||
}
|
||||
|
||||
// 添加好友函数
|
||||
mp::sri* UserFriendsService::add_contact_person(mp::body *body) {
|
||||
// 查看添加目标的权限类型
|
||||
char type = imProveDb.select_add_type(body->target());
|
||||
char type = userFriendsDb.select_add_type(body->target());
|
||||
|
||||
// 直接添加
|
||||
if (type == '0') {
|
||||
|
||||
add_friends(body);
|
||||
}
|
||||
// 回答问题
|
||||
else if (type == '1') {
|
||||
|
||||
if ("") {
|
||||
add_friends(body);
|
||||
} else {
|
||||
sri->set_sri_code((mp::MP_SRI)(mp::MP_ADD_FRIENDS_ERR | mp::MP_ADD_FRIENDS_ANSWER_ERR));
|
||||
sri->set_sri_msg("答案错误");
|
||||
}
|
||||
}
|
||||
// 账户审核
|
||||
else if (type == '2') {
|
||||
|
||||
}
|
||||
|
||||
// auto [is_succ, ret_type, msg] = imProveDb.update_add_info(type, body);
|
||||
|
||||
// sri->set_sri_code(ret_type);
|
||||
// sri->set_sri_msg(msg);
|
||||
return sri;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ public:
|
||||
|
||||
private:
|
||||
mp::sri* add_contact_person(mp::body* body);
|
||||
void add_friends(mp::body* body);
|
||||
|
||||
private:
|
||||
mp::sri* sri = nullptr;
|
||||
UserFriendsDB imProveDb = UserFriendsDB();
|
||||
UserFriendsDB userFriendsDb = UserFriendsDB();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -5,21 +5,39 @@
|
||||
#include "UserService.h"
|
||||
#include <experimental/random>
|
||||
|
||||
mp::sri* UserService::login(uint64_t account, const std::string& password) {
|
||||
///************************************************* 登陆 ***********************************************************///
|
||||
|
||||
// 登陆 按subtype 分类是帐号登陆还是手机登陆
|
||||
mp::sri* UserService::login(mp::MP_SUB_TYPE subType, const std::string& account, const std::string& password) {
|
||||
sri_clear();
|
||||
|
||||
auto exist = userDb.select_user_exist(account);
|
||||
if (subType == mp::MP_REQUEST_LOGIN_EMAIL) {
|
||||
login_fun(account, password, "email");
|
||||
}
|
||||
else if (subType == mp::MP_REQUEST_LOGIN_PHONE) {
|
||||
login_fun(account, password, "phone");
|
||||
}
|
||||
else if (subType == mp::MP_REQUEST_LOGIN_ACCOUNT) {
|
||||
login_fun(account, password, "account");
|
||||
}
|
||||
|
||||
return sri;
|
||||
}
|
||||
|
||||
// 以account登陆
|
||||
void UserService::login_fun(const std::string& account, const std::string& password, const std::string& filed) {
|
||||
|
||||
// 判断密码
|
||||
auto [exist, user] = userDb.select_user(strtol(account.c_str(), nullptr, 0), filed);
|
||||
|
||||
// 无账户
|
||||
if (!exist) {
|
||||
sri->set_sri_msg("无此账户");
|
||||
sri->set_sri_code(mp::MP_LOGIN_ACCOUNT_NOT);
|
||||
return sri;
|
||||
return;
|
||||
}
|
||||
|
||||
// 判断密码
|
||||
auto [sql_exist, user] = userDb.select_user(account);
|
||||
std::string source = std::to_string(account) + password + user.password_salt;
|
||||
std::string source = account + password + user.password_salt;
|
||||
size_t password_hash = std::hash<std::string>()(source);
|
||||
|
||||
if (user.password == std::to_string(password_hash)) {
|
||||
@@ -36,21 +54,67 @@ mp::sri* UserService::login(uint64_t account, const std::string& password) {
|
||||
printf("登陆失败\n");
|
||||
sri->set_sri_msg("登陆失败!");
|
||||
sri->set_sri_code(mp::MP_LOGIN_FAIL);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///********************************************** 注册 *****************************************************////
|
||||
|
||||
// 注册 邮箱注册
|
||||
mp::sri *UserService::register_(mp::MP_SUB_TYPE subType, const std::string &phone_email, const std::string &password) {
|
||||
sri_clear();
|
||||
|
||||
// 号池取号
|
||||
auto account = userDb.fetch_account();
|
||||
if (account.has_value()) {
|
||||
// 注册
|
||||
bool state = register_(account.value(), password);
|
||||
|
||||
// 注册成功
|
||||
if (state) {
|
||||
bool state1;
|
||||
/// 判断什么方式注册
|
||||
// 邮箱方式
|
||||
if (subType == mp::MP_REQUEST_REGISTER_EMAIL) {
|
||||
// 将邮箱绑定到帐号上
|
||||
state1 = userDb.bind_email(account.value(), phone_email);
|
||||
}
|
||||
// 手机号方式
|
||||
else {
|
||||
// 将手机绑定到帐号上
|
||||
state1 = userDb.bind_phone(account.value(), phone_email);
|
||||
}
|
||||
|
||||
if (!state1) {
|
||||
sri->set_sri_msg("sql:生成的帐号为绑定上本邮箱, 请重新注册");
|
||||
sri->set_sri_code(mp::MP_REGISTER_SQL_ERR);
|
||||
} else {
|
||||
// 注册成功就将取出的号在号池内删除
|
||||
userDb.remove_pool_account(account.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// 号池无号
|
||||
else {
|
||||
sri->set_sri_msg("暂无帐号可提供");
|
||||
sri->set_sri_code(mp::MP_REGISTER_SQL_ERR);
|
||||
}
|
||||
|
||||
return sri;
|
||||
}
|
||||
|
||||
|
||||
mp::sri* UserService::register_(uint64_t account, const std::string &password) {
|
||||
sri_clear();
|
||||
|
||||
// 注册 基函数
|
||||
bool UserService::register_(uint64_t account, const std::string &password) {
|
||||
// 查看账户是否存在
|
||||
auto exist = userDb.select_user_exist(account);
|
||||
if (!exist) {
|
||||
sri->set_sri_msg("账户已经存在");
|
||||
sri->set_sri_code(mp::MP_REGISTER_EXIST);
|
||||
return sri;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 生成salt
|
||||
@@ -68,7 +132,7 @@ mp::sri* UserService::register_(uint64_t account, const std::string &password)
|
||||
if (!add_user) {
|
||||
sri->set_sri_msg("注册失败, 用户表, sql");
|
||||
sri->set_sri_code(mp::MP_REGISTER_SQL_ERR);
|
||||
return sri;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto add_friends_table = userDb.insert_user_friends(account);
|
||||
@@ -80,16 +144,16 @@ mp::sri* UserService::register_(uint64_t account, const std::string &password)
|
||||
|
||||
sri->set_sri_msg("注册失败, 附属好友表, sql");
|
||||
sri->set_sri_code(mp::MP_REGISTER_SQL_ERR);
|
||||
return sri;
|
||||
return false;
|
||||
}
|
||||
|
||||
sri->set_sri_msg("注册成功");
|
||||
sri->set_sri_code(mp::MP_REGISTER_SUCCESS);
|
||||
|
||||
return sri;
|
||||
return true;
|
||||
}
|
||||
|
||||
mp::sri *UserService::logout(uint64_t account, bool state) {
|
||||
mp::sri *UserService::logout(const std::string& account, bool state) {
|
||||
// return userDb.logout(account, state);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -106,6 +170,14 @@ mp::sri *UserService::logout(uint64_t account, bool state) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,14 +7,28 @@
|
||||
|
||||
#include "proto/mp.body.pb.h"
|
||||
#include "Service.h"
|
||||
#include "db/UserDB.h"
|
||||
|
||||
class UserService : public Service {
|
||||
|
||||
public:
|
||||
mp::sri* login(uint64_t account, const std::string& password);
|
||||
mp::sri* register_(uint64_t account, const std::string& password);
|
||||
mp::sri* logout(uint64_t account, bool state);
|
||||
// 登陆 按subtype 分类是帐号登陆还是手机登陆
|
||||
mp::sri* login(mp::MP_SUB_TYPE subType, const std::string& account, const std::string& password);
|
||||
|
||||
public:
|
||||
// 注册 邮箱注册
|
||||
mp::sri* register_(mp::MP_SUB_TYPE subType, const std::string& email, const std::string& password);
|
||||
|
||||
|
||||
public:
|
||||
// 注销 退出登陆
|
||||
mp::sri* logout(const std::string& account, bool state);
|
||||
|
||||
|
||||
private:
|
||||
// 注册 基函数
|
||||
bool register_(uint64_t account, const std::string &password);
|
||||
// 以account登陆
|
||||
void login_fun(const std::string& account, const std::string& password, const std::string& filed);
|
||||
|
||||
private:
|
||||
UserDB userDb = UserDB();
|
||||
|
||||
@@ -33,11 +33,51 @@ TEST(add_friends, add_friends__Test) {
|
||||
|
||||
TEST(UserDB, UserDB_Ues_Test) {
|
||||
auto i = UserDB();
|
||||
// i.insert_user_friends(1111111);
|
||||
i.test(2222222);
|
||||
}
|
||||
|
||||
TEST(select_friends, select_friends_Test) {
|
||||
auto i = UserFriendsDB();
|
||||
i.select_friends_info(2725096176, 783556037);
|
||||
}
|
||||
|
||||
TEST(select_friends_all, select_friends_Test) {
|
||||
auto i = UserFriendsDB();
|
||||
auto doc = i.select_friends_all(2725096176);
|
||||
if (doc.has_value())
|
||||
for (auto member = doc.value().MemberBegin(); member != doc.value().MemberEnd(); ++member) {
|
||||
auto belong_grouping = member->value.GetObject().FindMember("belong_grouping");
|
||||
auto add_time = member->value.GetObject().FindMember("add_time");
|
||||
auto add_source = member->value.GetObject().FindMember("add_source");
|
||||
printf("%s - %s:%d, %s:%d, %s:%d ",member->name.GetString(),
|
||||
belong_grouping->name.GetString(), belong_grouping->value.GetInt(),
|
||||
add_time->name.GetString(), add_time->value.GetInt(),
|
||||
add_source->name.GetString(), add_source->value.GetInt());
|
||||
}
|
||||
}
|
||||
|
||||
TEST(fetch_account, fetch_account__Test) {
|
||||
auto i = new UserDB();
|
||||
if (i->fetch_account().has_value())
|
||||
printf("%zu", i->fetch_account());
|
||||
else
|
||||
printf("号码池空");
|
||||
}
|
||||
|
||||
TEST(bind_account_email, bind_account__Test) {
|
||||
auto i = new UserDB();
|
||||
printf("%d", i->bind_email(2725096176, "dongl@tholen.cn"));
|
||||
}
|
||||
|
||||
TEST(bind_account_phone, bind_account__Test) {
|
||||
auto i = new UserDB();
|
||||
printf("%d", i->bind_phone(2725096176, "18900000000"));
|
||||
}
|
||||
|
||||
|
||||
TEST(UserDB_select_user, UserDB_Ues_Test) {
|
||||
auto i = UserDB();
|
||||
auto [state, po] = i.select_user(2725096176, "account");
|
||||
if (state)
|
||||
printf("%lu", po.account);
|
||||
}
|
||||
@@ -9,7 +9,9 @@
|
||||
|
||||
class Body {
|
||||
public:
|
||||
Body(uint64_t account, const std::string& password) {
|
||||
|
||||
// account 可能是 账户 手机号 邮箱
|
||||
Body(mp::MP_SUB_TYPE subType, const std::string& account, const std::string& password) {
|
||||
body = new mp::body();
|
||||
|
||||
body->set_account(account);
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
|
||||
class Request : public Mph, Body, Cqi {
|
||||
public:
|
||||
Request(mp::MP_TYPE type, uint64_t account, const std::string& password);
|
||||
|
||||
Request(mp::MP_TYPE type, mp::MP_SUB_TYPE subType, const std::string& account, const std::string& password);
|
||||
Request(mp::MP_TYPE type, uint64_t target, uint64_t source, const std::string& data);
|
||||
|
||||
~Request() override;
|
||||
|
||||
@@ -180,13 +180,40 @@ class body PROTOBUF_FINAL :
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kAccountFieldNumber = 2,
|
||||
kPasswordFieldNumber = 3,
|
||||
kDataFieldNumber = 6,
|
||||
kAccountFieldNumber = 2,
|
||||
kEmailFieldNumber = 7,
|
||||
kTargetFieldNumber = 4,
|
||||
kSourceFieldNumber = 5,
|
||||
kPhoneFieldNumber = 8,
|
||||
kSubcommandFieldNumber = 1,
|
||||
};
|
||||
// string account = 2;
|
||||
void clear_account();
|
||||
const std::string& account() const;
|
||||
void set_account(const std::string& value);
|
||||
void set_account(std::string&& value);
|
||||
void set_account(const char* value);
|
||||
void set_account(const char* value, size_t size);
|
||||
std::string* mutable_account();
|
||||
std::string* release_account();
|
||||
void set_allocated_account(std::string* account);
|
||||
GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
|
||||
" string fields are deprecated and will be removed in a"
|
||||
" future release.")
|
||||
std::string* unsafe_arena_release_account();
|
||||
GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
|
||||
" string fields are deprecated and will be removed in a"
|
||||
" future release.")
|
||||
void unsafe_arena_set_allocated_account(
|
||||
std::string* account);
|
||||
private:
|
||||
const std::string& _internal_account() const;
|
||||
void _internal_set_account(const std::string& value);
|
||||
std::string* _internal_mutable_account();
|
||||
public:
|
||||
|
||||
// string password = 3;
|
||||
void clear_password();
|
||||
const std::string& password() const;
|
||||
@@ -237,13 +264,29 @@ class body PROTOBUF_FINAL :
|
||||
std::string* _internal_mutable_data();
|
||||
public:
|
||||
|
||||
// uint64 account = 2;
|
||||
void clear_account();
|
||||
::PROTOBUF_NAMESPACE_ID::uint64 account() const;
|
||||
void set_account(::PROTOBUF_NAMESPACE_ID::uint64 value);
|
||||
// string email = 7;
|
||||
void clear_email();
|
||||
const std::string& email() const;
|
||||
void set_email(const std::string& value);
|
||||
void set_email(std::string&& value);
|
||||
void set_email(const char* value);
|
||||
void set_email(const char* value, size_t size);
|
||||
std::string* mutable_email();
|
||||
std::string* release_email();
|
||||
void set_allocated_email(std::string* email);
|
||||
GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
|
||||
" string fields are deprecated and will be removed in a"
|
||||
" future release.")
|
||||
std::string* unsafe_arena_release_email();
|
||||
GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
|
||||
" string fields are deprecated and will be removed in a"
|
||||
" future release.")
|
||||
void unsafe_arena_set_allocated_email(
|
||||
std::string* email);
|
||||
private:
|
||||
::PROTOBUF_NAMESPACE_ID::uint64 _internal_account() const;
|
||||
void _internal_set_account(::PROTOBUF_NAMESPACE_ID::uint64 value);
|
||||
const std::string& _internal_email() const;
|
||||
void _internal_set_email(const std::string& value);
|
||||
std::string* _internal_mutable_email();
|
||||
public:
|
||||
|
||||
// uint64 target = 4;
|
||||
@@ -264,6 +307,15 @@ class body PROTOBUF_FINAL :
|
||||
void _internal_set_source(::PROTOBUF_NAMESPACE_ID::uint64 value);
|
||||
public:
|
||||
|
||||
// uint64 phone = 8;
|
||||
void clear_phone();
|
||||
::PROTOBUF_NAMESPACE_ID::uint64 phone() const;
|
||||
void set_phone(::PROTOBUF_NAMESPACE_ID::uint64 value);
|
||||
private:
|
||||
::PROTOBUF_NAMESPACE_ID::uint64 _internal_phone() const;
|
||||
void _internal_set_phone(::PROTOBUF_NAMESPACE_ID::uint64 value);
|
||||
public:
|
||||
|
||||
// .mp.MP_SUB_TYPE subcommand = 1;
|
||||
void clear_subcommand();
|
||||
::mp::MP_SUB_TYPE subcommand() const;
|
||||
@@ -280,11 +332,13 @@ class body PROTOBUF_FINAL :
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
typedef void InternalArenaConstructable_;
|
||||
typedef void DestructorSkippable_;
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr account_;
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr password_;
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr data_;
|
||||
::PROTOBUF_NAMESPACE_ID::uint64 account_;
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr email_;
|
||||
::PROTOBUF_NAMESPACE_ID::uint64 target_;
|
||||
::PROTOBUF_NAMESPACE_ID::uint64 source_;
|
||||
::PROTOBUF_NAMESPACE_ID::uint64 phone_;
|
||||
int subcommand_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
friend struct ::TableStruct_mp_2ebody_2eproto;
|
||||
@@ -320,25 +374,86 @@ inline void body::set_subcommand(::mp::MP_SUB_TYPE value) {
|
||||
// @@protoc_insertion_point(field_set:mp.body.subcommand)
|
||||
}
|
||||
|
||||
// uint64 account = 2;
|
||||
// string account = 2;
|
||||
inline void body::clear_account() {
|
||||
account_ = PROTOBUF_ULONGLONG(0);
|
||||
account_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
}
|
||||
inline ::PROTOBUF_NAMESPACE_ID::uint64 body::_internal_account() const {
|
||||
return account_;
|
||||
}
|
||||
inline ::PROTOBUF_NAMESPACE_ID::uint64 body::account() const {
|
||||
inline const std::string& body::account() const {
|
||||
// @@protoc_insertion_point(field_get:mp.body.account)
|
||||
return _internal_account();
|
||||
}
|
||||
inline void body::_internal_set_account(::PROTOBUF_NAMESPACE_ID::uint64 value) {
|
||||
|
||||
account_ = value;
|
||||
}
|
||||
inline void body::set_account(::PROTOBUF_NAMESPACE_ID::uint64 value) {
|
||||
inline void body::set_account(const std::string& value) {
|
||||
_internal_set_account(value);
|
||||
// @@protoc_insertion_point(field_set:mp.body.account)
|
||||
}
|
||||
inline std::string* body::mutable_account() {
|
||||
// @@protoc_insertion_point(field_mutable:mp.body.account)
|
||||
return _internal_mutable_account();
|
||||
}
|
||||
inline const std::string& body::_internal_account() const {
|
||||
return account_.Get();
|
||||
}
|
||||
inline void body::_internal_set_account(const std::string& value) {
|
||||
|
||||
account_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena());
|
||||
}
|
||||
inline void body::set_account(std::string&& value) {
|
||||
|
||||
account_.Set(
|
||||
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena());
|
||||
// @@protoc_insertion_point(field_set_rvalue:mp.body.account)
|
||||
}
|
||||
inline void body::set_account(const char* value) {
|
||||
GOOGLE_DCHECK(value != nullptr);
|
||||
|
||||
account_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
|
||||
GetArena());
|
||||
// @@protoc_insertion_point(field_set_char:mp.body.account)
|
||||
}
|
||||
inline void body::set_account(const char* value,
|
||||
size_t size) {
|
||||
|
||||
account_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(
|
||||
reinterpret_cast<const char*>(value), size), GetArena());
|
||||
// @@protoc_insertion_point(field_set_pointer:mp.body.account)
|
||||
}
|
||||
inline std::string* body::_internal_mutable_account() {
|
||||
|
||||
return account_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
}
|
||||
inline std::string* body::release_account() {
|
||||
// @@protoc_insertion_point(field_release:mp.body.account)
|
||||
return account_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
}
|
||||
inline void body::set_allocated_account(std::string* account) {
|
||||
if (account != nullptr) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
account_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), account,
|
||||
GetArena());
|
||||
// @@protoc_insertion_point(field_set_allocated:mp.body.account)
|
||||
}
|
||||
inline std::string* body::unsafe_arena_release_account() {
|
||||
// @@protoc_insertion_point(field_unsafe_arena_release:mp.body.account)
|
||||
GOOGLE_DCHECK(GetArena() != nullptr);
|
||||
|
||||
return account_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
|
||||
GetArena());
|
||||
}
|
||||
inline void body::unsafe_arena_set_allocated_account(
|
||||
std::string* account) {
|
||||
GOOGLE_DCHECK(GetArena() != nullptr);
|
||||
if (account != nullptr) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
account_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
|
||||
account, GetArena());
|
||||
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:mp.body.account)
|
||||
}
|
||||
|
||||
// string password = 3;
|
||||
inline void body::clear_password() {
|
||||
@@ -542,6 +657,107 @@ inline void body::unsafe_arena_set_allocated_data(
|
||||
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:mp.body.data)
|
||||
}
|
||||
|
||||
// string email = 7;
|
||||
inline void body::clear_email() {
|
||||
email_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
}
|
||||
inline const std::string& body::email() const {
|
||||
// @@protoc_insertion_point(field_get:mp.body.email)
|
||||
return _internal_email();
|
||||
}
|
||||
inline void body::set_email(const std::string& value) {
|
||||
_internal_set_email(value);
|
||||
// @@protoc_insertion_point(field_set:mp.body.email)
|
||||
}
|
||||
inline std::string* body::mutable_email() {
|
||||
// @@protoc_insertion_point(field_mutable:mp.body.email)
|
||||
return _internal_mutable_email();
|
||||
}
|
||||
inline const std::string& body::_internal_email() const {
|
||||
return email_.Get();
|
||||
}
|
||||
inline void body::_internal_set_email(const std::string& value) {
|
||||
|
||||
email_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena());
|
||||
}
|
||||
inline void body::set_email(std::string&& value) {
|
||||
|
||||
email_.Set(
|
||||
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena());
|
||||
// @@protoc_insertion_point(field_set_rvalue:mp.body.email)
|
||||
}
|
||||
inline void body::set_email(const char* value) {
|
||||
GOOGLE_DCHECK(value != nullptr);
|
||||
|
||||
email_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
|
||||
GetArena());
|
||||
// @@protoc_insertion_point(field_set_char:mp.body.email)
|
||||
}
|
||||
inline void body::set_email(const char* value,
|
||||
size_t size) {
|
||||
|
||||
email_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(
|
||||
reinterpret_cast<const char*>(value), size), GetArena());
|
||||
// @@protoc_insertion_point(field_set_pointer:mp.body.email)
|
||||
}
|
||||
inline std::string* body::_internal_mutable_email() {
|
||||
|
||||
return email_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
}
|
||||
inline std::string* body::release_email() {
|
||||
// @@protoc_insertion_point(field_release:mp.body.email)
|
||||
return email_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
|
||||
}
|
||||
inline void body::set_allocated_email(std::string* email) {
|
||||
if (email != nullptr) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
email_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), email,
|
||||
GetArena());
|
||||
// @@protoc_insertion_point(field_set_allocated:mp.body.email)
|
||||
}
|
||||
inline std::string* body::unsafe_arena_release_email() {
|
||||
// @@protoc_insertion_point(field_unsafe_arena_release:mp.body.email)
|
||||
GOOGLE_DCHECK(GetArena() != nullptr);
|
||||
|
||||
return email_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
|
||||
GetArena());
|
||||
}
|
||||
inline void body::unsafe_arena_set_allocated_email(
|
||||
std::string* email) {
|
||||
GOOGLE_DCHECK(GetArena() != nullptr);
|
||||
if (email != nullptr) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
email_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
|
||||
email, GetArena());
|
||||
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:mp.body.email)
|
||||
}
|
||||
|
||||
// uint64 phone = 8;
|
||||
inline void body::clear_phone() {
|
||||
phone_ = PROTOBUF_ULONGLONG(0);
|
||||
}
|
||||
inline ::PROTOBUF_NAMESPACE_ID::uint64 body::_internal_phone() const {
|
||||
return phone_;
|
||||
}
|
||||
inline ::PROTOBUF_NAMESPACE_ID::uint64 body::phone() const {
|
||||
// @@protoc_insertion_point(field_get:mp.body.phone)
|
||||
return _internal_phone();
|
||||
}
|
||||
inline void body::_internal_set_phone(::PROTOBUF_NAMESPACE_ID::uint64 value) {
|
||||
|
||||
phone_ = value;
|
||||
}
|
||||
inline void body::set_phone(::PROTOBUF_NAMESPACE_ID::uint64 value) {
|
||||
_internal_set_phone(value);
|
||||
// @@protoc_insertion_point(field_set:mp.body.phone)
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
@@ -72,6 +72,8 @@ enum MP_TYPE : int {
|
||||
MP_RESPONSE_LOGIN = 20,
|
||||
MP_RESPONSE_LOGOUT = 21,
|
||||
MP_RESPONSE_REGISTER = 22,
|
||||
MP_REQUEST_PE_CODE = 40,
|
||||
MP_RESPONSE_PE_CODE = 60,
|
||||
MP_REQUEST_IM_ADD = 100,
|
||||
MP_RESPONSE_IM_ADD = 120,
|
||||
MP_TYPE_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
|
||||
@@ -97,17 +99,22 @@ inline bool MP_TYPE_Parse(
|
||||
MP_TYPE_descriptor(), name, value);
|
||||
}
|
||||
enum MP_SUB_TYPE : int {
|
||||
MP_REQUEST_ADD_CONTACT_PERSON = 0,
|
||||
MP_REQUEST_REMOVE_CONTACT_PERSON = 1,
|
||||
MP_REQUEST_BLACK_LIST_CONTACT_PERSON = 2,
|
||||
MP_RESPONSE_ADD_CONTACT_PERSON = 20,
|
||||
MP_RESPONSE_REMOVE_CONTACT_PERSON = 21,
|
||||
MP_RESPONSE_BLACK_LIST_CONTACT_PERSON = 22,
|
||||
MP_REQUEST_LOGIN_EMAIL = 0,
|
||||
MP_REQUEST_LOGIN_PHONE = 1,
|
||||
MP_REQUEST_LOGIN_ACCOUNT = 2,
|
||||
MP_REQUEST_REGISTER_EMAIL = 3,
|
||||
MP_REQUEST_REGISTER_PHONE = 4,
|
||||
MP_REQUEST_ADD_CONTACT_PERSON = 20,
|
||||
MP_REQUEST_REMOVE_CONTACT_PERSON = 21,
|
||||
MP_REQUEST_BLACK_LIST_CONTACT_PERSON = 22,
|
||||
MP_RESPONSE_ADD_CONTACT_PERSON = 40,
|
||||
MP_RESPONSE_REMOVE_CONTACT_PERSON = 41,
|
||||
MP_RESPONSE_BLACK_LIST_CONTACT_PERSON = 42,
|
||||
MP_SUB_TYPE_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
|
||||
MP_SUB_TYPE_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max()
|
||||
};
|
||||
bool MP_SUB_TYPE_IsValid(int value);
|
||||
constexpr MP_SUB_TYPE MP_SUB_TYPE_MIN = MP_REQUEST_ADD_CONTACT_PERSON;
|
||||
constexpr MP_SUB_TYPE MP_SUB_TYPE_MIN = MP_REQUEST_LOGIN_EMAIL;
|
||||
constexpr MP_SUB_TYPE MP_SUB_TYPE_MAX = MP_RESPONSE_BLACK_LIST_CONTACT_PERSON;
|
||||
constexpr int MP_SUB_TYPE_ARRAYSIZE = MP_SUB_TYPE_MAX + 1;
|
||||
|
||||
|
||||
@@ -81,12 +81,15 @@ enum MP_SRI : int {
|
||||
MP_ADD_FRIENDS_ERR = 34,
|
||||
MP_ADD_FRIENDS_NOT_TYPE = 35,
|
||||
MP_ADD_FRIENDS_SQL_ERR = 36,
|
||||
MP_ADD_FRIENDS_ANSWER_ERR = 37,
|
||||
MP_PE_CODE_SUCCESS = 50,
|
||||
MP_PE_CODE_FAIL = 51,
|
||||
MP_SRI_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
|
||||
MP_SRI_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max()
|
||||
};
|
||||
bool MP_SRI_IsValid(int value);
|
||||
constexpr MP_SRI MP_SRI_MIN = MP_LOGIN_ACCOUNT_NOT;
|
||||
constexpr MP_SRI MP_SRI_MAX = MP_ADD_FRIENDS_SQL_ERR;
|
||||
constexpr MP_SRI MP_SRI_MAX = MP_PE_CODE_FAIL;
|
||||
constexpr int MP_SRI_ARRAYSIZE = MP_SRI_MAX + 1;
|
||||
|
||||
const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* MP_SRI_descriptor();
|
||||
|
||||
@@ -5,9 +5,11 @@ import "mp.mph.proto";
|
||||
|
||||
message body {
|
||||
MP_SUB_TYPE subcommand = 1;
|
||||
uint64 account = 2;
|
||||
string account = 2;
|
||||
string password = 3;
|
||||
uint64 target = 4;
|
||||
uint64 source = 5;
|
||||
string data = 6;
|
||||
string email = 7;
|
||||
uint64 phone = 8;
|
||||
}
|
||||
@@ -12,6 +12,13 @@ enum MP_TYPE {
|
||||
MP_RESPONSE_LOGOUT = 21;
|
||||
MP_RESPONSE_REGISTER = 22;
|
||||
|
||||
// 40 - 59
|
||||
MP_REQUEST_PE_CODE = 40; // 请求验证码
|
||||
|
||||
// 60 - 79
|
||||
MP_RESPONSE_PE_CODE = 60;
|
||||
|
||||
|
||||
MP_REQUEST_IM_ADD = 100;
|
||||
MP_RESPONSE_IM_ADD = 120;
|
||||
|
||||
@@ -19,13 +26,19 @@ enum MP_TYPE {
|
||||
}
|
||||
|
||||
enum MP_SUB_TYPE {
|
||||
MP_REQUEST_ADD_CONTACT_PERSON = 0;
|
||||
MP_REQUEST_REMOVE_CONTACT_PERSON = 1;
|
||||
MP_REQUEST_BLACK_LIST_CONTACT_PERSON = 2;
|
||||
MP_REQUEST_LOGIN_EMAIL = 0;
|
||||
MP_REQUEST_LOGIN_PHONE = 1;
|
||||
MP_REQUEST_LOGIN_ACCOUNT = 2;
|
||||
MP_REQUEST_REGISTER_EMAIL = 3;
|
||||
MP_REQUEST_REGISTER_PHONE = 4;
|
||||
|
||||
MP_RESPONSE_ADD_CONTACT_PERSON = 20;
|
||||
MP_RESPONSE_REMOVE_CONTACT_PERSON = 21;
|
||||
MP_RESPONSE_BLACK_LIST_CONTACT_PERSON = 22;
|
||||
MP_REQUEST_ADD_CONTACT_PERSON = 20;
|
||||
MP_REQUEST_REMOVE_CONTACT_PERSON = 21;
|
||||
MP_REQUEST_BLACK_LIST_CONTACT_PERSON = 22;
|
||||
|
||||
MP_RESPONSE_ADD_CONTACT_PERSON = 40;
|
||||
MP_RESPONSE_REMOVE_CONTACT_PERSON = 41;
|
||||
MP_RESPONSE_BLACK_LIST_CONTACT_PERSON = 42;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,10 @@ enum MP_SRI {
|
||||
MP_ADD_FRIENDS_ERR = 34;
|
||||
MP_ADD_FRIENDS_NOT_TYPE = 35;
|
||||
MP_ADD_FRIENDS_SQL_ERR = 36;
|
||||
MP_ADD_FRIENDS_ANSWER_ERR = 37;
|
||||
|
||||
MP_PE_CODE_SUCCESS = 50;
|
||||
MP_PE_CODE_FAIL = 51;
|
||||
}
|
||||
|
||||
message sri {
|
||||
|
||||
Reference in New Issue
Block a user