0813 21:15 没什么大的改变 改了下链接空闲最大秒数, 还有注册的返回值 加了申请的帐号信息
This commit is contained in:
@@ -18,7 +18,7 @@ void ConnectionPool::destroy(mysqlpp::Connection *connection) {
|
||||
}
|
||||
|
||||
unsigned int ConnectionPool::max_idle_time() {
|
||||
return 1;
|
||||
return 30;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -65,18 +65,19 @@ const char descriptor_table_protodef_mp_2esri_2eproto[] PROTOBUF_SECTION_VARIABL
|
||||
" \001(\0162\n.mp.MP_SRI\022\024\n\014sri_username\030\002 \001(\t\022\023"
|
||||
"\n\013sri_account\030\003 \001(\004\022\021\n\tsri_email\030\004 \001(\t\022\021"
|
||||
"\n\tsri_phone\030\005 \001(\004\022\017\n\007sri_msg\030\006 \001(\t\022\021\n\tsr"
|
||||
"i_token\030\007 \001(\t*\262\003\n\006MP_SRI\022\030\n\024MP_LOGIN_ACC"
|
||||
"i_token\030\007 \001(\t*\360\003\n\006MP_SRI\022\030\n\024MP_LOGIN_ACC"
|
||||
"OUNT_NOT\020\000\022\024\n\020MP_LOGIN_SUCCESS\020\001\022\021\n\rMP_L"
|
||||
"OGIN_FAIL\020\002\022\027\n\023MP_REGISTER_SUCCESS\020\n\022\025\n\021"
|
||||
"MP_REGISTER_EXIST\020\013\022\027\n\023MP_REGISTER_SQL_E"
|
||||
"RR\020\014\022\025\n\021MP_LOGOUT_SUCCESS\020\024\022\022\n\016MP_LOGOUT"
|
||||
"_FAIL\020\025\022\022\n\016MP_ADD_FRIENDS\020\036\022\024\n\020MP_ADD_FR"
|
||||
"IENDS_0\020\037\022\024\n\020MP_ADD_FRIENDS_1\020 \022\024\n\020MP_AD"
|
||||
"D_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_FRI"
|
||||
"ENDS_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_C"
|
||||
"ODE_FAIL\0203b\006proto3"
|
||||
"OGIN_FAIL\020\002\022\027\n\023MP_REGISTER_SUCCESS\020\n\022\035\n\031"
|
||||
"MP_REGISTER_SUCCESS_PHONE\020\013\022\035\n\031MP_REGIST"
|
||||
"ER_SUCCESS_EMAIL\020\014\022\025\n\021MP_REGISTER_EXIST\020"
|
||||
"\r\022\027\n\023MP_REGISTER_SQL_ERR\020\016\022\025\n\021MP_LOGOUT_"
|
||||
"SUCCESS\020\024\022\022\n\016MP_LOGOUT_FAIL\020\025\022\022\n\016MP_ADD_"
|
||||
"FRIENDS\020\036\022\024\n\020MP_ADD_FRIENDS_0\020\037\022\024\n\020MP_AD"
|
||||
"D_FRIENDS_1\020 \022\024\n\020MP_ADD_FRIENDS_2\020!\022\026\n\022M"
|
||||
"P_ADD_FRIENDS_ERR\020\"\022\033\n\027MP_ADD_FRIENDS_NO"
|
||||
"T_TYPE\020#\022\032\n\026MP_ADD_FRIENDS_SQL_ERR\020$\022\035\n\031"
|
||||
"MP_ADD_FRIENDS_ANSWER_ERR\020%\022\026\n\022MP_PE_COD"
|
||||
"E_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] = {
|
||||
};
|
||||
@@ -85,7 +86,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", 618,
|
||||
false, false, descriptor_table_protodef_mp_2esri_2eproto, "mp.sri.proto", 680,
|
||||
&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,
|
||||
@@ -106,6 +107,8 @@ bool MP_SRI_IsValid(int value) {
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 20:
|
||||
case 21:
|
||||
case 30:
|
||||
|
||||
@@ -21,7 +21,7 @@ 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 PEVerifCodeController();
|
||||
map.insert( std::pair<mp::MP_TYPE, handler*>(mp::MP_REQUEST_PE_CODE, peVerifCode));
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
/// curr mem user curd user session
|
||||
void session::add_user(mp::sri* sri, std::shared_ptr<agreement_request>& request) {
|
||||
if (sri->sri_code() == mp::MP_LOGIN_SUCCESS) {
|
||||
printf("1111\n");
|
||||
auto ele = new userinfo();
|
||||
ele->bev = request->m_bev;
|
||||
sprintf(ele->ip, "%s", inet_ntoa(request->m_addr->sin_addr));
|
||||
|
||||
@@ -18,6 +18,7 @@ void UserProveController::run(std::shared_ptr<agreement_request> request, std::s
|
||||
else if (request->m_mph->mp_type() == mp::MP_REQUEST_REGISTER) {
|
||||
auto sri = service.register_(request->m_body.subcommand(),
|
||||
request->m_body.account(), request->m_body.password());
|
||||
|
||||
response->set(sri, request->m_bev);
|
||||
}
|
||||
// 退出登陆
|
||||
|
||||
@@ -82,11 +82,15 @@ mp::sri *UserService::register_(mp::MP_SUB_TYPE subType, const std::string &phon
|
||||
if (subType == mp::MP_REQUEST_REGISTER_EMAIL) {
|
||||
// 将邮箱绑定到帐号上
|
||||
state1 = userDb.bind_email(account.value(), phone_email);
|
||||
sri->set_sri_email(phone_email);
|
||||
sri->set_sri_code(mp::MP_REGISTER_SUCCESS_EMAIL);
|
||||
}
|
||||
// 手机号方式
|
||||
else {
|
||||
// 将手机绑定到帐号上
|
||||
state1 = userDb.bind_phone(account.value(), phone_email);
|
||||
sri->set_sri_phone(strtol(phone_email.c_str(), nullptr, 0));
|
||||
sri->set_sri_code(mp::MP_REGISTER_SUCCESS_PHONE);
|
||||
}
|
||||
|
||||
if (!state1) {
|
||||
@@ -98,7 +102,6 @@ mp::sri *UserService::register_(mp::MP_SUB_TYPE subType, const std::string &phon
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// 号池无号
|
||||
else {
|
||||
@@ -141,8 +144,9 @@ bool UserService::register_(uint64_t account, const std::string &password) {
|
||||
auto add_friends_table = userDb.insert_user_friends(account);
|
||||
if (!add_friends_table) {
|
||||
if (!userDb.remove_user(account)) {
|
||||
sri->set_sri_msg("注册失败, 附属好友表生成失败,但用户已添加, sql");
|
||||
sri->set_sri_msg("注册失败, 用户已添加, 但附属好友表生成失败, sql");
|
||||
sri->set_sri_code(mp::MP_REGISTER_SQL_ERR);
|
||||
return false;
|
||||
}
|
||||
|
||||
sri->set_sri_msg("注册失败, 附属好友表, sql");
|
||||
|
||||
@@ -70,8 +70,10 @@ enum MP_SRI : int {
|
||||
MP_LOGIN_SUCCESS = 1,
|
||||
MP_LOGIN_FAIL = 2,
|
||||
MP_REGISTER_SUCCESS = 10,
|
||||
MP_REGISTER_EXIST = 11,
|
||||
MP_REGISTER_SQL_ERR = 12,
|
||||
MP_REGISTER_SUCCESS_PHONE = 11,
|
||||
MP_REGISTER_SUCCESS_EMAIL = 12,
|
||||
MP_REGISTER_EXIST = 13,
|
||||
MP_REGISTER_SQL_ERR = 14,
|
||||
MP_LOGOUT_SUCCESS = 20,
|
||||
MP_LOGOUT_FAIL = 21,
|
||||
MP_ADD_FRIENDS = 30,
|
||||
|
||||
@@ -7,8 +7,10 @@ enum MP_SRI {
|
||||
MP_LOGIN_FAIL = 2;
|
||||
|
||||
MP_REGISTER_SUCCESS = 10;
|
||||
MP_REGISTER_EXIST = 11;
|
||||
MP_REGISTER_SQL_ERR = 12;
|
||||
MP_REGISTER_SUCCESS_PHONE = 11;
|
||||
MP_REGISTER_SUCCESS_EMAIL = 12;
|
||||
MP_REGISTER_EXIST = 13;
|
||||
MP_REGISTER_SQL_ERR = 14;
|
||||
|
||||
MP_LOGOUT_SUCCESS = 20;
|
||||
MP_LOGOUT_FAIL = 21;
|
||||
|
||||
Reference in New Issue
Block a user