Mod aaa-12 新增用户管理配置恢复、修改数据库连接
RCA: SOL: 修改人:zhouzian 检视人:zhouzian
This commit is contained in:
parent
18f6d87a82
commit
243b95c390
|
@ -42,6 +42,7 @@
|
||||||
|
|
||||||
#define USER_MANAGER_CONFIG_GROUP (uint64)((uint64)USER_MANAGER_CONFIG_MODULE<<32|1)
|
#define USER_MANAGER_CONFIG_GROUP (uint64)((uint64)USER_MANAGER_CONFIG_MODULE<<32|1)
|
||||||
#define USER_MANAGER_CONFIG_USER (uint64)((uint64)USER_MANAGER_CONFIG_MODULE<<32|2)
|
#define USER_MANAGER_CONFIG_USER (uint64)((uint64)USER_MANAGER_CONFIG_MODULE<<32|2)
|
||||||
|
#define USER_MANAGER_CONFIG_RECOVER (uint64)((uint64)USER_MANAGER_CONFIG_MODULE<<32|3)
|
||||||
|
|
||||||
#define AUTHFREE_CONFIG (uint64)((uint64)LOCALAUTH_CONFIG_MODULE<<32|1)
|
#define AUTHFREE_CONFIG (uint64)((uint64)LOCALAUTH_CONFIG_MODULE<<32|1)
|
||||||
#define FREEPARAMETERS_CONFIG (uint64)((uint64)LOCALAUTH_CONFIG_MODULE<<32|2)
|
#define FREEPARAMETERS_CONFIG (uint64)((uint64)LOCALAUTH_CONFIG_MODULE<<32|2)
|
||||||
|
|
|
@ -34,7 +34,7 @@ COMMON_SRCS = configserver.c \
|
||||||
web_config/config-adm/user_authpara.c \
|
web_config/config-adm/user_authpara.c \
|
||||||
web_config/config-adm/user_authfree.c \
|
web_config/config-adm/user_authfree.c \
|
||||||
web_config/authfree.c web_config/auth_parameters.c\
|
web_config/authfree.c web_config/auth_parameters.c\
|
||||||
user_manager_config/user_group_config.c user_manager_config/user_account_config.c user_manager_config/usermanager-server/array_index.c \
|
user_manager_config/user_recover_config.c user_manager_config/user_group_config.c user_manager_config/user_account_config.c user_manager_config/usermanager-server/array_index.c \
|
||||||
user_manager_config/usermanager-server/user_group.c user_manager_config/usermanager-server/user_mod.c user_manager_config/usermanager-server/user.c \
|
user_manager_config/usermanager-server/user_group.c user_manager_config/usermanager-server/user_mod.c user_manager_config/usermanager-server/user.c \
|
||||||
log_config/log_config_console.c log_config/log_config_init.c log_config/log_config_cm.c log_config/log_config_monitor.c log_config/log_config_remote.c log_config/log_config_file.c \
|
log_config/log_config_console.c log_config/log_config_init.c log_config/log_config_cm.c log_config/log_config_monitor.c log_config/log_config_remote.c log_config/log_config_file.c \
|
||||||
nat_config/natconfig.c
|
nat_config/natconfig.c
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "../../../../../Common/commuapinl.h"
|
#include "../../../../../Common/commuapinl.h"
|
||||||
#include "../user_manager_config/user_group_config.h"
|
#include "../user_manager_config/user_group_config.h"
|
||||||
#include "../user_manager_config/user_account_config.h"
|
#include "../user_manager_config/user_account_config.h"
|
||||||
|
#include "../user_manager_config/user_recover_config.h"
|
||||||
#include "netconfig.h"
|
#include "netconfig.h"
|
||||||
#include "log_config.h"
|
#include "log_config.h"
|
||||||
#include "../web_config/authfree.h"
|
#include "../web_config/authfree.h"
|
||||||
|
@ -84,6 +85,15 @@
|
||||||
usergroup_config_get, \
|
usergroup_config_get, \
|
||||||
usergroup_config_get_all \
|
usergroup_config_get_all \
|
||||||
},\
|
},\
|
||||||
|
{\
|
||||||
|
USER_MANAGER_CONFIG_RECOVER, \
|
||||||
|
CONFIG_FROM_RECOVER1, \
|
||||||
|
TRUE, \
|
||||||
|
userecover_config_chk, \
|
||||||
|
userecover_config_proc, \
|
||||||
|
userecover_config_get, \
|
||||||
|
userecover_config_get_all \
|
||||||
|
},\
|
||||||
{ \
|
{ \
|
||||||
AUTHFREE_CONFIG, \
|
AUTHFREE_CONFIG, \
|
||||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||||
|
|
|
@ -92,7 +92,7 @@ ret_code user_config_chk(uint source, uint *config_type,
|
||||||
|
|
||||||
* 0:成功、1:失败
|
* 0:成功、1:失败
|
||||||
*/
|
*/
|
||||||
static ret_code user_config_get_detail_proc(uint source, uint config_type,
|
static ret_code user_config_get_detail_proc(uint source,
|
||||||
pointer input, int input_len,
|
pointer input, int input_len,
|
||||||
pointer output, int *output_len)
|
pointer output, int *output_len)
|
||||||
{
|
{
|
||||||
|
@ -215,7 +215,7 @@ static ret_code user_config_get_detail_proc(uint source, uint config_type,
|
||||||
|
|
||||||
* 0:成功、1:失败
|
* 0:成功、1:失败
|
||||||
*/
|
*/
|
||||||
static ret_code user_config_get_uuid_proc(uint source, uint config_type,
|
static ret_code user_config_get_uuid_proc(uint source,
|
||||||
pointer input, int input_len,
|
pointer input, int input_len,
|
||||||
pointer output, int *output_len)
|
pointer output, int *output_len)
|
||||||
{
|
{
|
||||||
|
@ -300,7 +300,7 @@ static ret_code user_config_get_uuid_proc(uint source, uint config_type,
|
||||||
}
|
}
|
||||||
* 0:成功、1:失败
|
* 0:成功、1:失败
|
||||||
*/
|
*/
|
||||||
static ret_code user_config_get_list_proc(uint source, uint config_type,
|
static ret_code user_config_get_list_proc(uint source,
|
||||||
pointer input, int input_len,
|
pointer input, int input_len,
|
||||||
pointer output, int *output_len)
|
pointer output, int *output_len)
|
||||||
{
|
{
|
||||||
|
@ -1067,16 +1067,16 @@ ret_code user_config_proc(uint source, uint config_type,
|
||||||
input, input_len,
|
input, input_len,
|
||||||
output, output_len);
|
output, output_len);
|
||||||
break;
|
break;
|
||||||
case USER_CONFIG_GET:
|
// case USER_CONFIG_GET:
|
||||||
ret = user_config_get_detail_proc(source, config_type,
|
// ret = user_config_get_detail_proc(source, config_type,
|
||||||
input, input_len,
|
// input, input_len,
|
||||||
output, output_len);
|
// output, output_len);
|
||||||
break;
|
// break;
|
||||||
case USER_CONFIG_GET_ALL:
|
// case USER_CONFIG_GET_ALL:
|
||||||
ret = user_config_get_list_proc(source, config_type,
|
// ret = user_config_get_list_proc(source, config_type,
|
||||||
input, input_len,
|
// input, input_len,
|
||||||
output, output_len);
|
// output, output_len);
|
||||||
break;
|
// break;
|
||||||
case USER_CONFIG_MOD_LINE:
|
case USER_CONFIG_MOD_LINE:
|
||||||
ret = user_config_mod_line_proc(source, config_type,
|
ret = user_config_mod_line_proc(source, config_type,
|
||||||
input, input_len,
|
input, input_len,
|
||||||
|
@ -1087,8 +1087,54 @@ ret_code user_config_proc(uint source, uint config_type,
|
||||||
input, input_len,
|
input, input_len,
|
||||||
output, output_len);
|
output, output_len);
|
||||||
break;
|
break;
|
||||||
|
// case USER_CONFIG_GET_UUID:
|
||||||
|
// ret = user_config_get_uuid_proc(source, config_type,
|
||||||
|
// input, input_len,
|
||||||
|
// output, output_len);
|
||||||
|
// break;
|
||||||
|
default:
|
||||||
|
ret = RET_NOTSUPPORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 查询函数接口
|
||||||
|
* iuput格式:{"type": 0,"data": {xxx}}
|
||||||
|
*/
|
||||||
|
ret_code user_config_get(uint source,
|
||||||
|
pointer input, int input_len,
|
||||||
|
pointer output, int *output_len)
|
||||||
|
{
|
||||||
|
ret_code ret = RET_OK;
|
||||||
|
cJSON *root, *type_json;
|
||||||
|
int fun_type;
|
||||||
|
|
||||||
|
/* 获取对应的函数type */
|
||||||
|
FUNCTYPE_GET(input, fun_type);
|
||||||
|
|
||||||
|
if(ERR_FUNC_TYPE == fun_type)
|
||||||
|
{
|
||||||
|
ret = RET_INPUTERR;
|
||||||
|
//ASSERT_RET(ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(fun_type)
|
||||||
|
{
|
||||||
|
case USER_CONFIG_GET:
|
||||||
|
ret = user_config_get_detail_proc(source,
|
||||||
|
input, input_len,
|
||||||
|
output, output_len);
|
||||||
|
break;
|
||||||
|
case USER_CONFIG_GET_ALL:
|
||||||
|
ret = user_config_get_list_proc(source,
|
||||||
|
input, input_len,
|
||||||
|
output, output_len);
|
||||||
|
break;
|
||||||
case USER_CONFIG_GET_UUID:
|
case USER_CONFIG_GET_UUID:
|
||||||
ret = user_config_get_uuid_proc(source, config_type,
|
ret = user_config_get_uuid_proc(source,
|
||||||
input, input_len,
|
input, input_len,
|
||||||
output, output_len);
|
output, output_len);
|
||||||
break;
|
break;
|
||||||
|
@ -1099,14 +1145,6 @@ ret_code user_config_proc(uint source, uint config_type,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret_code user_config_get(uint source,
|
|
||||||
pointer input, int input_len,
|
|
||||||
pointer output, int *output_len)
|
|
||||||
{
|
|
||||||
ret_code ret = RET_OK;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret_code user_config_get_all(uint source,
|
ret_code user_config_get_all(uint source,
|
||||||
pointer output, int *output_len)
|
pointer output, int *output_len)
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,7 +87,7 @@ ret_code usergroup_config_chk(uint source, uint *config_type,
|
||||||
|
|
||||||
* 0:成功、1:失败
|
* 0:成功、1:失败
|
||||||
*/
|
*/
|
||||||
static ret_code usergroup_config_get_list_proc(uint source, uint config_type,
|
static ret_code usergroup_config_get_list_proc(uint source,
|
||||||
pointer input, int input_len,
|
pointer input, int input_len,
|
||||||
pointer output, int *output_len)
|
pointer output, int *output_len)
|
||||||
{
|
{
|
||||||
|
@ -178,7 +178,7 @@ static ret_code usergroup_config_get_list_proc(uint source, uint config_type,
|
||||||
|
|
||||||
* 0:成功、1:失败
|
* 0:成功、1:失败
|
||||||
*/
|
*/
|
||||||
static ret_code usergroup_config_get_uuid_proc(uint source, uint config_type,
|
static ret_code usergroup_config_get_uuid_proc(uint source,
|
||||||
pointer input, int input_len,
|
pointer input, int input_len,
|
||||||
pointer output, int *output_len)
|
pointer output, int *output_len)
|
||||||
{
|
{
|
||||||
|
@ -490,7 +490,7 @@ static ret_code usergroup_config_del_proc(uint source, uint config_type,
|
||||||
|
|
||||||
/*用户组配置处理
|
/*用户组配置处理
|
||||||
*input格式:{"type": 0,"data": {xxx}}
|
*input格式:{"type": 0,"data": {xxx}}
|
||||||
*output格式:{"result": 0}
|
*output格式:
|
||||||
*/
|
*/
|
||||||
ret_code usergroup_config_proc(uint source, uint config_type,
|
ret_code usergroup_config_proc(uint source, uint config_type,
|
||||||
pointer input, int input_len,
|
pointer input, int input_len,
|
||||||
|
@ -527,13 +527,54 @@ ret_code usergroup_config_proc(uint source, uint config_type,
|
||||||
input, input_len,
|
input, input_len,
|
||||||
output, output_len);
|
output, output_len);
|
||||||
break;
|
break;
|
||||||
|
// case USERGROUP_CONFIG_GET_ALL:
|
||||||
|
// ret = usergroup_config_get_list_proc(source, config_type,
|
||||||
|
// input, input_len,
|
||||||
|
// output, output_len);
|
||||||
|
// break;
|
||||||
|
// case USERGROUP_CONFIG_GET_UUID:
|
||||||
|
// ret = usergroup_config_get_uuid_proc(source, config_type,
|
||||||
|
// input, input_len,
|
||||||
|
// output, output_len);
|
||||||
|
// break;
|
||||||
|
default:
|
||||||
|
ret = RET_NOTSUPPORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*用户组查询
|
||||||
|
*input格式:{"type": 0,"data": {xxx}}
|
||||||
|
*output格式:
|
||||||
|
*/
|
||||||
|
ret_code usergroup_config_get(uint source,
|
||||||
|
pointer input, int input_len,
|
||||||
|
pointer output, int *output_len)
|
||||||
|
{
|
||||||
|
ret_code ret = RET_OK;
|
||||||
|
int fun_type;
|
||||||
|
cJSON *root, *type_json;
|
||||||
|
|
||||||
|
/* 获取对应的函数type */
|
||||||
|
FUNCTYPE_GET(input, fun_type);
|
||||||
|
|
||||||
|
if(ERR_FUNC_TYPE == fun_type)
|
||||||
|
{
|
||||||
|
ret = RET_INPUTERR;
|
||||||
|
//ASSERT_RET(ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(fun_type)
|
||||||
|
{
|
||||||
case USERGROUP_CONFIG_GET_ALL:
|
case USERGROUP_CONFIG_GET_ALL:
|
||||||
ret = usergroup_config_get_list_proc(source, config_type,
|
ret = usergroup_config_get_list_proc(source,
|
||||||
input, input_len,
|
input, input_len,
|
||||||
output, output_len);
|
output, output_len);
|
||||||
break;
|
break;
|
||||||
case USERGROUP_CONFIG_GET_UUID:
|
case USERGROUP_CONFIG_GET_UUID:
|
||||||
ret = usergroup_config_get_uuid_proc(source, config_type,
|
ret = usergroup_config_get_uuid_proc(source,
|
||||||
input, input_len,
|
input, input_len,
|
||||||
output, output_len);
|
output, output_len);
|
||||||
break;
|
break;
|
||||||
|
@ -544,14 +585,6 @@ ret_code usergroup_config_proc(uint source, uint config_type,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret_code usergroup_config_get(uint source,
|
|
||||||
pointer input, int input_len,
|
|
||||||
pointer output, int *output_len)
|
|
||||||
{
|
|
||||||
ret_code ret = RET_OK;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret_code usergroup_config_get_all(uint source,
|
ret_code usergroup_config_get_all(uint source,
|
||||||
pointer output, int *output_len)
|
pointer output, int *output_len)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,175 @@
|
||||||
|
#include <cjson/cJSON.h>
|
||||||
|
#include "configm.h"
|
||||||
|
#include "user_recover_config.h"
|
||||||
|
#include "usermanager-server/include/user_group.h"
|
||||||
|
#include "usermanager-server/include/user.h"
|
||||||
|
#include "usermanager-server/include/common_user.h"
|
||||||
|
#include "usermanager-server/include/array_index.h"
|
||||||
|
#include "rpc.h"
|
||||||
|
#include "parsefile.h"
|
||||||
|
#include "database.h"
|
||||||
|
#include "s2j/s2j.h"
|
||||||
|
#include "s2j/s2jdef.h"
|
||||||
|
|
||||||
|
void * um_hdbc = NULL;//用户管理数据库连接句柄
|
||||||
|
extern ARRAY g_user_index_head;
|
||||||
|
extern ARRAY g_group_index_head;
|
||||||
|
extern USERACCOUNT g_user_table[];
|
||||||
|
extern USERGROUP g_group_table[];
|
||||||
|
|
||||||
|
ret_code userecover_config_chk(uint source, uint *config_type,
|
||||||
|
pointer input, int *input_len,
|
||||||
|
pointer output, int *output_len)
|
||||||
|
{
|
||||||
|
ret_code ret = RET_OK;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ret_code userecover_config_proc(uint source, uint config_type,
|
||||||
|
pointer input, int input_len,
|
||||||
|
pointer output, int *output_len)
|
||||||
|
{
|
||||||
|
ret_code ret = RET_OK;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret_code userecover_config_get(uint source,
|
||||||
|
pointer input, int input_len,
|
||||||
|
pointer output, int *output_len)
|
||||||
|
{
|
||||||
|
ret_code ret = RET_OK;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret_code userecover_config_get_all(uint source,
|
||||||
|
pointer output, int *output_len)
|
||||||
|
{
|
||||||
|
ret_code ret = RET_OK;
|
||||||
|
char * group_db = NULL;
|
||||||
|
char * user_db = NULL;
|
||||||
|
|
||||||
|
if(CONFIG_FROM_RECOVER1 != source)
|
||||||
|
{
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
um_hdbc = connect_database(USER_MANAGER_DBID);
|
||||||
|
|
||||||
|
if(NULL == um_hdbc)
|
||||||
|
{
|
||||||
|
ret = RET_SYSERR;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
init_group();
|
||||||
|
init_user();
|
||||||
|
|
||||||
|
um_getgroup_db(&group_db);
|
||||||
|
if(NULL != group_db)
|
||||||
|
{
|
||||||
|
cJSON * root_g = cJSON_Parse(group_db);
|
||||||
|
if(NULL == root_g)
|
||||||
|
{
|
||||||
|
UCHAR_FREE(group_db);
|
||||||
|
ret = RET_ERR;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON * array_g = cJSON_GetObjectItem(root_g, "data");
|
||||||
|
if(NULL == array_g)
|
||||||
|
{
|
||||||
|
UCHAR_FREE(group_db);
|
||||||
|
cJSON_Delete(root_g);
|
||||||
|
ret = RET_ERR;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mun_g = cJSON_GetArraySize(array_g);
|
||||||
|
if(0 == mun_g)
|
||||||
|
{
|
||||||
|
UCHAR_FREE(group_db);
|
||||||
|
cJSON_Delete(root_g);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
s2j_create_struct_obj(temp_group, USERGROUP);
|
||||||
|
|
||||||
|
for (int i = 0; i < mun_g; i++)
|
||||||
|
{
|
||||||
|
cJSON * group = cJSON_GetArrayItem(array_g, i);
|
||||||
|
|
||||||
|
s2j_struct_get_basic_element(temp_group, group, int, ID);
|
||||||
|
s2j_struct_get_basic_element(temp_group, group, string, gname);
|
||||||
|
s2j_struct_get_basic_element(temp_group, group, string, gdescription);
|
||||||
|
|
||||||
|
g_group_table[temp_group->ID].ID = temp_group->ID;
|
||||||
|
strcpy(g_group_table[temp_group->ID].gname, temp_group->gname);
|
||||||
|
strcpy(g_group_table[temp_group->ID].gdescription, temp_group->gdescription);
|
||||||
|
|
||||||
|
alloc_index_special(&g_group_index_head, temp_group->ID);
|
||||||
|
}
|
||||||
|
s2j_delete_struct_obj(temp_group);
|
||||||
|
UCHAR_FREE(group_db);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
um_getuser_db(&user_db);
|
||||||
|
if(NULL != user_db)
|
||||||
|
{
|
||||||
|
cJSON * root_u = cJSON_Parse(user_db);
|
||||||
|
if(NULL == root_u)
|
||||||
|
{
|
||||||
|
UCHAR_FREE(user_db);
|
||||||
|
ret = RET_ERR;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
cJSON * array_u = cJSON_GetObjectItem(root_u, "data");
|
||||||
|
if(NULL == array_u)
|
||||||
|
{
|
||||||
|
UCHAR_FREE(user_db);
|
||||||
|
cJSON_Delete(root_u);
|
||||||
|
ret = RET_ERR;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
int mun_u = cJSON_GetArraySize(array_u);
|
||||||
|
if(0 == mun_u)
|
||||||
|
{
|
||||||
|
UCHAR_FREE(user_db);
|
||||||
|
cJSON_Delete(root_u);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
s2j_create_struct_obj(temp_user, USERLIST);
|
||||||
|
|
||||||
|
for (int i = 0; i < mun_u; i++)
|
||||||
|
{
|
||||||
|
cJSON * user = cJSON_GetArrayItem(array_u, i);
|
||||||
|
|
||||||
|
s2j_struct_get_basic_element(temp_user, user, int, ID);
|
||||||
|
s2j_struct_get_basic_element(temp_user, user, int, GID);
|
||||||
|
s2j_struct_get_basic_element(temp_user, user, int, multi);
|
||||||
|
s2j_struct_get_basic_element(temp_user, user, int, valid);
|
||||||
|
s2j_struct_get_basic_element(temp_user, user, string, uname);
|
||||||
|
s2j_struct_get_basic_element(temp_user, user, string, udescription);
|
||||||
|
s2j_struct_get_basic_element(temp_user, user, string, valid_begin_time);
|
||||||
|
s2j_struct_get_basic_element(temp_user, user, string, valid_end_time);
|
||||||
|
|
||||||
|
g_user_table[temp_user->ID].ID = temp_user->ID;
|
||||||
|
g_user_table[temp_user->ID].GID = temp_user->ID;
|
||||||
|
g_user_table[temp_user->ID].multi_valid = MULTI_VALID(temp_user->multi, temp_user->valid);
|
||||||
|
strcpy(g_user_table[temp_user->ID].uname, temp_user->uname);
|
||||||
|
strcpy(g_user_table[temp_user->ID].udescription, temp_user->udescription);
|
||||||
|
if (1 == temp_user->valid)
|
||||||
|
{
|
||||||
|
STRING2TIME_T(temp_user->valid_begin_time, g_user_table[temp_user->ID].valid_begin_time);
|
||||||
|
STRING2TIME_T(temp_user->valid_end_time, g_user_table[temp_user->ID].valid_end_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
alloc_index_special(&g_user_index_head, temp_user->ID);
|
||||||
|
}
|
||||||
|
s2j_delete_struct_obj(temp_user);
|
||||||
|
UCHAR_FREE(user_db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef USER_RECOVER_CONFIG_H_
|
||||||
|
#define USER_RECOVER_CONFIG_H_
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include <cjson/cJSON.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include "configmapi.h"
|
||||||
|
#include "rpc_common.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* user 恢复 config */
|
||||||
|
ret_code userecover_config_chk(uint source, uint *config_type,
|
||||||
|
pointer input, int *input_len,
|
||||||
|
pointer output, int *output_len);
|
||||||
|
|
||||||
|
ret_code userecover_config_proc(uint source, uint config_type,
|
||||||
|
pointer input, int input_len,
|
||||||
|
pointer output, int *output_len);
|
||||||
|
|
||||||
|
ret_code userecover_config_get(uint source,
|
||||||
|
pointer input, int input_len,
|
||||||
|
pointer output, int *output_len);
|
||||||
|
|
||||||
|
ret_code userecover_config_get_all(uint source,
|
||||||
|
pointer output, int *output_len);
|
||||||
|
|
||||||
|
#endif
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#define USER_TABLE "user_account"
|
#define USER_TABLE "user_account"
|
||||||
#define USER_GROUP_TABLE "user_group"
|
#define USER_GROUP_TABLE "user_group"
|
||||||
|
#define USER_MANAGER_DBID 3
|
||||||
|
|
||||||
#define TIME_T2STRING(time_int, time_char) (strftime((time_char), 20, "%Y-%m-%d %H:%M:%S", (localtime(&time_int))))
|
#define TIME_T2STRING(time_int, time_char) (strftime((time_char), 20, "%Y-%m-%d %H:%M:%S", (localtime(&time_int))))
|
||||||
#define STRING2TIME_T(time_char,time_int) \
|
#define STRING2TIME_T(time_char,time_int) \
|
||||||
|
@ -31,6 +32,7 @@ do { \
|
||||||
#define MULTI_SET(element, value) (((element) & VALID_MASK) | (((value) << 1) & MULTI_MASK))
|
#define MULTI_SET(element, value) (((element) & VALID_MASK) | (((value) << 1) & MULTI_MASK))
|
||||||
#define VALID_GET(element) ((element) & VALID_MASK)
|
#define VALID_GET(element) ((element) & VALID_MASK)
|
||||||
#define VALID_SET(element, value) (((element) & MULTI_MASK) | ((value) & VALID_MASK))
|
#define VALID_SET(element, value) (((element) & MULTI_MASK) | ((value) & VALID_MASK))
|
||||||
|
#define MULTI_VALID(multi, valid) ((((multi) << 1) & MULTI_MASK) | ((valid) & VALID_MASK))
|
||||||
|
|
||||||
#define FUNCTYPE_GET(input,fun_type) \
|
#define FUNCTYPE_GET(input,fun_type) \
|
||||||
do { \
|
do { \
|
||||||
|
|
|
@ -119,4 +119,7 @@ void offline_force_one_user(unsigned short user_id);
|
||||||
/* 查询用户列表 */
|
/* 查询用户列表 */
|
||||||
bool useraccount_showlist(int group_id, char * user_name, int page_start, int page_counts, char ** user_list);
|
bool useraccount_showlist(int group_id, char * user_name, int page_start, int page_counts, char ** user_list);
|
||||||
|
|
||||||
|
/* 查询 user_account 内存恢复 */
|
||||||
|
void um_getuser_db(char ** user_db);
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -85,5 +85,11 @@ void offline_force_by_groupid(char *groupid);
|
||||||
/*解析用户组id的json字符串 --> 用户组id*/
|
/*解析用户组id的json字符串 --> 用户组id*/
|
||||||
unsigned short id_json2int(char * gid, char * para_name);
|
unsigned short id_json2int(char * gid, char * para_name);
|
||||||
|
|
||||||
|
/*查user_group表 内存恢复*/
|
||||||
|
void um_getgroup_db(char ** group_db);
|
||||||
|
|
||||||
|
/*数据库重连*/
|
||||||
|
void re_connect();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
extern ARRAY g_user_index_head;
|
extern ARRAY g_user_index_head;
|
||||||
extern USERGROUP g_group_table[];
|
extern USERGROUP g_group_table[];
|
||||||
extern exce_mod_user g_user_modfunc_table[];
|
extern exce_mod_user g_user_modfunc_table[];
|
||||||
|
extern void * um_hdbc;
|
||||||
//extern USER_AUTH_LIST g_user_auth_ret_table[];
|
//extern USER_AUTH_LIST g_user_auth_ret_table[];
|
||||||
USERACCOUNT g_user_table[USER_INDEX_MAX];
|
USERACCOUNT g_user_table[USER_INDEX_MAX];
|
||||||
|
|
||||||
|
@ -36,7 +37,6 @@ int init_user()
|
||||||
/*添加元素-新增用户*/
|
/*添加元素-新增用户*/
|
||||||
void usermanager_add_user(char* uname, char* gname, char* udesp, char* pwd, int multi, int valid, char* valid_begin_time, char* valid_end_time, USERADD* uaddres)
|
void usermanager_add_user(char* uname, char* gname, char* udesp, char* pwd, int multi, int valid, char* valid_begin_time, char* valid_end_time, USERADD* uaddres)
|
||||||
{
|
{
|
||||||
void *adduser_hdbc;
|
|
||||||
time_t begin_time;
|
time_t begin_time;
|
||||||
time_t end_time;
|
time_t end_time;
|
||||||
|
|
||||||
|
@ -104,8 +104,9 @@ void usermanager_add_user(char* uname, char* gname, char* udesp, char* pwd, int
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 连接数据库 */
|
/* 连接数据库 */
|
||||||
adduser_hdbc = connect_database(USER_ACCOUNT_DATABASE_ID);
|
//adduser_hdbc = connect_database(USER_ACCOUNT_DATABASE_ID);
|
||||||
if(NULL == adduser_hdbc)
|
re_connect();
|
||||||
|
if(NULL == um_hdbc)
|
||||||
{
|
{
|
||||||
/* 记录日志 */
|
/* 记录日志 */
|
||||||
uaddres->result = ADDUSER_FAIL_DATABASE;
|
uaddres->result = ADDUSER_FAIL_DATABASE;
|
||||||
|
@ -113,18 +114,16 @@ void usermanager_add_user(char* uname, char* gname, char* udesp, char* pwd, int
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 根据用户组名查询用户组ID */
|
/* 根据用户组名查询用户组ID */
|
||||||
unsigned short GID_temp = get_groupid_by_name(gname, adduser_hdbc);
|
unsigned short GID_temp = get_groupid_by_name(gname, um_hdbc);
|
||||||
if(INVALID_INDEX == GID_temp)
|
if(INVALID_INDEX == GID_temp)
|
||||||
{
|
{
|
||||||
disconnect_database(USER_ACCOUNT_DATABASE_ID, adduser_hdbc); // ret_release记录日志
|
|
||||||
uaddres->result = ADDUSER_FAIL_NOGROUP;
|
uaddres->result = ADDUSER_FAIL_NOGROUP;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 校验重名 */
|
/* 校验重名 */
|
||||||
if(0 != get_userid_by_name(uname, adduser_hdbc))
|
if(0 != get_userid_by_name(uname, um_hdbc))
|
||||||
{
|
{
|
||||||
disconnect_database(USER_ACCOUNT_DATABASE_ID, adduser_hdbc); // ret_release记录日志
|
|
||||||
uaddres->result =ADDUSER_FAIL_NAMEDUP;
|
uaddres->result =ADDUSER_FAIL_NAMEDUP;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +132,6 @@ void usermanager_add_user(char* uname, char* gname, char* udesp, char* pwd, int
|
||||||
unsigned short ID = alloc_index(&g_user_index_head);
|
unsigned short ID = alloc_index(&g_user_index_head);
|
||||||
if (INVALID_INDEX == ID)
|
if (INVALID_INDEX == ID)
|
||||||
{
|
{
|
||||||
disconnect_database(USER_ACCOUNT_DATABASE_ID, adduser_hdbc); // ret_release记录日志
|
|
||||||
uaddres->result = ADDUSER_FAIL_USERFULL;
|
uaddres->result = ADDUSER_FAIL_USERFULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +139,7 @@ void usermanager_add_user(char* uname, char* gname, char* udesp, char* pwd, int
|
||||||
/* 连接数据库,存user_account表 */
|
/* 连接数据库,存user_account表 */
|
||||||
char *adduser_sql = "INSERT INTO `user_account` SET id = ?, group_id = ?, user_name = ?, password = ?, udescription = ?, \
|
char *adduser_sql = "INSERT INTO `user_account` SET id = ?, group_id = ?, user_name = ?, password = ?, udescription = ?, \
|
||||||
multi_player = ?, valid_always = ?, valid_begin_time = ?, valid_end_time = ?";
|
multi_player = ?, valid_always = ?, valid_begin_time = ?, valid_end_time = ?";
|
||||||
int ret_adduser = update_database(USER_ACCOUNT_DATABASE_ID, adduser_hdbc, DB_OP_INSERT, USER_TABLE, adduser_sql, 9,
|
int ret_adduser = update_database(USER_MANAGER_DBID, um_hdbc, DB_OP_INSERT, USER_TABLE, adduser_sql, 9,
|
||||||
DB_DATA_INT_TYPE, sizeof(ID), ID,
|
DB_DATA_INT_TYPE, sizeof(ID), ID,
|
||||||
DB_DATA_INT_TYPE, sizeof(GID_temp), GID_temp,
|
DB_DATA_INT_TYPE, sizeof(GID_temp), GID_temp,
|
||||||
DB_DATA_STRING_TYPE, strlen(uname)+1, uname,
|
DB_DATA_STRING_TYPE, strlen(uname)+1, uname,
|
||||||
|
@ -151,11 +149,9 @@ void usermanager_add_user(char* uname, char* gname, char* udesp, char* pwd, int
|
||||||
DB_DATA_INT_TYPE, sizeof(valid), valid,
|
DB_DATA_INT_TYPE, sizeof(valid), valid,
|
||||||
DB_DATA_STRING_TYPE, strlen(valid_begin_time)+1, valid_begin_time,
|
DB_DATA_STRING_TYPE, strlen(valid_begin_time)+1, valid_begin_time,
|
||||||
DB_DATA_STRING_TYPE, strlen(valid_end_time)+1,valid_end_time);
|
DB_DATA_STRING_TYPE, strlen(valid_end_time)+1,valid_end_time);
|
||||||
disconnect_database(USER_ACCOUNT_DATABASE_ID, adduser_hdbc); // ret_release记录日志
|
|
||||||
if(DB_RET_OK != ret_adduser)
|
if(DB_RET_OK != ret_adduser)
|
||||||
{
|
{
|
||||||
free_index(&g_user_index_head, ID);
|
free_index(&g_user_index_head, ID);
|
||||||
//disconnect_database(USER_ACCOUNT_DATABASE_ID, adduser_hdbc); // ret_release记录日志
|
|
||||||
uaddres->result = ADDUSER_FAIL_DATABASE;
|
uaddres->result = ADDUSER_FAIL_DATABASE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +172,6 @@ void usermanager_add_user(char* uname, char* gname, char* udesp, char* pwd, int
|
||||||
g_user_table[ID].valid_end_time = end_time;
|
g_user_table[ID].valid_end_time = end_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
//int ret_release = disconnect_database(USER_ACCOUNT_DATABASE_ID, adduser_hdbc); // ret_release记录日志
|
|
||||||
uaddres->result = ADDUSER_SUCCESS;
|
uaddres->result = ADDUSER_SUCCESS;
|
||||||
uaddres->userID = ID;
|
uaddres->userID = ID;
|
||||||
return;
|
return;
|
||||||
|
@ -185,7 +180,6 @@ void usermanager_add_user(char* uname, char* gname, char* udesp, char* pwd, int
|
||||||
/* 按照用户uuid查询用户详情 */
|
/* 按照用户uuid查询用户详情 */
|
||||||
bool get_user_detail_by_user_uuid(int user_uuid, char ** user_detail)
|
bool get_user_detail_by_user_uuid(int user_uuid, char ** user_detail)
|
||||||
{
|
{
|
||||||
void * gud_hdbc;
|
|
||||||
char * point;
|
char * point;
|
||||||
int num;
|
int num;
|
||||||
if (NULL == user_detail)
|
if (NULL == user_detail)
|
||||||
|
@ -193,8 +187,9 @@ bool get_user_detail_by_user_uuid(int user_uuid, char ** user_detail)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
gud_hdbc = connect_database(USER_ACCOUNT_DATABASE_ID);
|
//gud_hdbc = connect_database(USER_ACCOUNT_DATABASE_ID);
|
||||||
if (NULL == gud_hdbc)
|
re_connect();
|
||||||
|
if (NULL == um_hdbc)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -202,9 +197,8 @@ bool get_user_detail_by_user_uuid(int user_uuid, char ** user_detail)
|
||||||
char * select_sql = "SELECT U.uuid ID, G.uuid GID, U.user_name uname, G.gname gname, U.udescription udescription,\
|
char * select_sql = "SELECT U.uuid ID, G.uuid GID, U.user_name uname, G.gname gname, U.udescription udescription,\
|
||||||
U.multi_player multi, U.valid_always valid, U.valid_begin_time, U.valid_end_time \
|
U.multi_player multi, U.valid_always valid, U.valid_begin_time, U.valid_end_time \
|
||||||
FROM user_account U, user_group G WHERE U.group_id = G.id AND U.uuid = ? ";
|
FROM user_account U, user_group G WHERE U.group_id = G.id AND U.uuid = ? ";
|
||||||
char * udetail = select_datebase_by_number(USER_ACCOUNT_DATABASE_ID, gud_hdbc, USER_TABLE, select_sql, 1, 0, &num, 1,
|
char * udetail = select_datebase_by_number(USER_MANAGER_DBID, um_hdbc, USER_TABLE, select_sql, 1, 0, &num, 1,
|
||||||
DB_DATA_INT_TYPE, sizeof(user_uuid), user_uuid);
|
DB_DATA_INT_TYPE, sizeof(user_uuid), user_uuid);
|
||||||
int ret_discon = disconnect_database(USER_ACCOUNT_DATABASE_ID, gud_hdbc);
|
|
||||||
|
|
||||||
if (0 == num || NULL == udetail)
|
if (0 == num || NULL == udetail)
|
||||||
{
|
{
|
||||||
|
@ -277,7 +271,6 @@ void get_user_by_id(unsigned short ID, USERLIST* ulist)
|
||||||
/* 修改用户-web */
|
/* 修改用户-web */
|
||||||
bool mod_user_web(USERLIST* ulist)
|
bool mod_user_web(USERLIST* ulist)
|
||||||
{
|
{
|
||||||
void *moduser_web_hdbc;
|
|
||||||
int ret_release;
|
int ret_release;
|
||||||
time_t cur_time;
|
time_t cur_time;
|
||||||
char *temp_begin_time, *temp_end_time, *temp_pwd, *temp_udes, *temp_user_json;
|
char *temp_begin_time, *temp_end_time, *temp_pwd, *temp_udes, *temp_user_json;
|
||||||
|
@ -326,8 +319,6 @@ bool mod_user_web(USERLIST* ulist)
|
||||||
temp_pwd = ulist->passwd;
|
temp_pwd = ulist->passwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
//get_user_by_id(ulist->ID, &temp_user);
|
|
||||||
|
|
||||||
/* 获取修改前的数据 - 这里的temp_user_json需要释放 */
|
/* 获取修改前的数据 - 这里的temp_user_json需要释放 */
|
||||||
bool ret_getuser = get_user_detail_by_user_uuid(ulist->ID, &temp_user_json);
|
bool ret_getuser = get_user_detail_by_user_uuid(ulist->ID, &temp_user_json);
|
||||||
if (!ret_getuser)
|
if (!ret_getuser)
|
||||||
|
@ -382,19 +373,19 @@ bool mod_user_web(USERLIST* ulist)
|
||||||
UCHAR_FREE(temp_user_json);
|
UCHAR_FREE(temp_user_json);
|
||||||
|
|
||||||
/* 连接数据库,更新user表 */
|
/* 连接数据库,更新user表 */
|
||||||
moduser_web_hdbc = connect_database(USER_ACCOUNT_DATABASE_ID);
|
//moduser_web_hdbc = connect_database(USER_ACCOUNT_DATABASE_ID);
|
||||||
if(NULL == moduser_web_hdbc)
|
re_connect();
|
||||||
|
if(NULL == um_hdbc)
|
||||||
{
|
{
|
||||||
s2j_delete_struct_obj(temp_user);
|
s2j_delete_struct_obj(temp_user);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short user_id = get_userid_by_name(ulist->uname, moduser_web_hdbc);
|
unsigned short user_id = get_userid_by_name(ulist->uname, um_hdbc);
|
||||||
unsigned short group_id = get_groupid_by_name(ulist->gname, moduser_web_hdbc);
|
unsigned short group_id = get_groupid_by_name(ulist->gname, um_hdbc);
|
||||||
if(INVALID_INDEX == user_id || INVALID_INDEX == group_id)
|
if(INVALID_INDEX == user_id || INVALID_INDEX == group_id)
|
||||||
{
|
{
|
||||||
s2j_delete_struct_obj(temp_user);
|
s2j_delete_struct_obj(temp_user);
|
||||||
ret_release = disconnect_database(USER_ACCOUNT_DATABASE_ID, moduser_web_hdbc); //ret_release记录日志
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +395,7 @@ bool mod_user_web(USERLIST* ulist)
|
||||||
{
|
{
|
||||||
moduser_web_sql = "UPDATE `user_account` SET group_id = (SELECT user_group.id FROM user_group WHERE user_group.uuid = ?),\
|
moduser_web_sql = "UPDATE `user_account` SET group_id = (SELECT user_group.id FROM user_group WHERE user_group.uuid = ?),\
|
||||||
udescription = ?, password = ?, multi_player = ?, valid_always = ?, valid_begin_time = ?, valid_end_time = ? WHERE uuid = ?";
|
udescription = ?, password = ?, multi_player = ?, valid_always = ?, valid_begin_time = ?, valid_end_time = ? WHERE uuid = ?";
|
||||||
ret_moduser_web = update_database(USER_ACCOUNT_DATABASE_ID, moduser_web_hdbc, DB_OP_UPDATE, USER_TABLE, moduser_web_sql, 8,
|
ret_moduser_web = update_database(USER_MANAGER_DBID, um_hdbc, DB_OP_UPDATE, USER_TABLE, moduser_web_sql, 8,
|
||||||
DB_DATA_INT_TYPE, sizeof(ulist->GID), ulist->GID,
|
DB_DATA_INT_TYPE, sizeof(ulist->GID), ulist->GID,
|
||||||
DB_DATA_STRING_TYPE, strlen(temp_udes)+1, temp_udes,
|
DB_DATA_STRING_TYPE, strlen(temp_udes)+1, temp_udes,
|
||||||
DB_DATA_STRING_TYPE, strlen(temp_pwd)+1, temp_pwd,
|
DB_DATA_STRING_TYPE, strlen(temp_pwd)+1, temp_pwd,
|
||||||
|
@ -417,7 +408,7 @@ bool mod_user_web(USERLIST* ulist)
|
||||||
{
|
{
|
||||||
moduser_web_sql = "UPDATE `user_account` SET group_id = (SELECT user_group.id FROM user_group WHERE user_group.uuid = ?),\
|
moduser_web_sql = "UPDATE `user_account` SET group_id = (SELECT user_group.id FROM user_group WHERE user_group.uuid = ?),\
|
||||||
udescription = ?, multi_player = ?, valid_always = ?, valid_begin_time = ?, valid_end_time = ? WHERE uuid = ?";
|
udescription = ?, multi_player = ?, valid_always = ?, valid_begin_time = ?, valid_end_time = ? WHERE uuid = ?";
|
||||||
ret_moduser_web = update_database(USER_ACCOUNT_DATABASE_ID, moduser_web_hdbc, DB_OP_UPDATE, USER_TABLE, moduser_web_sql, 7,
|
ret_moduser_web = update_database(USER_MANAGER_DBID, um_hdbc, DB_OP_UPDATE, USER_TABLE, moduser_web_sql, 7,
|
||||||
DB_DATA_INT_TYPE, sizeof(ulist->GID), ulist->GID,
|
DB_DATA_INT_TYPE, sizeof(ulist->GID), ulist->GID,
|
||||||
DB_DATA_STRING_TYPE, strlen(temp_udes)+1, temp_udes,
|
DB_DATA_STRING_TYPE, strlen(temp_udes)+1, temp_udes,
|
||||||
DB_DATA_INT_TYPE, sizeof(ulist->multi), ulist->multi,
|
DB_DATA_INT_TYPE, sizeof(ulist->multi), ulist->multi,
|
||||||
|
@ -427,7 +418,6 @@ bool mod_user_web(USERLIST* ulist)
|
||||||
DB_DATA_INT_TYPE, sizeof(ulist->ID), ulist->ID);
|
DB_DATA_INT_TYPE, sizeof(ulist->ID), ulist->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret_release = disconnect_database(USER_ACCOUNT_DATABASE_ID, moduser_web_hdbc); //ret_release记录日志
|
|
||||||
if(DB_RET_OK != ret_moduser_web)
|
if(DB_RET_OK != ret_moduser_web)
|
||||||
{
|
{
|
||||||
s2j_delete_struct_obj(temp_user);
|
s2j_delete_struct_obj(temp_user);
|
||||||
|
@ -549,8 +539,7 @@ bool uuid_json2int(char * gid, char * name, unsigned short * id)
|
||||||
bool get_user_uuid_by_name(char* uname, unsigned short * user_uuid)
|
bool get_user_uuid_by_name(char* uname, unsigned short * user_uuid)
|
||||||
{
|
{
|
||||||
char *uid = NULL;
|
char *uid = NULL;
|
||||||
int num, discon;
|
int num;
|
||||||
void * uhdbc;
|
|
||||||
unsigned short uuid_temp = INVALID_INDEX;
|
unsigned short uuid_temp = INVALID_INDEX;
|
||||||
|
|
||||||
if (NULL == uname || NULL == user_uuid)
|
if (NULL == uname || NULL == user_uuid)
|
||||||
|
@ -558,19 +547,17 @@ bool get_user_uuid_by_name(char* uname, unsigned short * user_uuid)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uhdbc = connect_database(USER_ACCOUNT_DATABASE_ID);
|
//uhdbc = connect_database(USER_ACCOUNT_DATABASE_ID);
|
||||||
if (NULL == uhdbc)
|
re_connect();
|
||||||
|
if (NULL == um_hdbc)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 连接数据库,根据用户名查询user表中的uuid */
|
/* 连接数据库,根据用户名查询user表中的uuid */
|
||||||
char* select_sql = "SELECT uuid FROM user_account WHERE user_name = ?";
|
char* select_sql = "SELECT uuid FROM user_account WHERE user_name = ?";
|
||||||
uid = select_datebase_by_number(USER_ACCOUNT_DATABASE_ID, uhdbc, USER_TABLE, select_sql, 1, 0, &num, 1,
|
uid = select_datebase_by_number(USER_MANAGER_DBID, um_hdbc, USER_TABLE, select_sql, 1, 0, &num, 1,
|
||||||
DB_DATA_STRING_TYPE, strlen(uname)+1, uname);
|
DB_DATA_STRING_TYPE, strlen(uname)+1, uname);
|
||||||
/* 删除数据连接 */
|
|
||||||
discon = disconnect_database(USER_ACCOUNT_DATABASE_ID, uhdbc); //discon记录日志
|
|
||||||
|
|
||||||
if(0 == num)
|
if(0 == num)
|
||||||
{
|
{
|
||||||
*user_uuid = INVALID_INDEX;
|
*user_uuid = INVALID_INDEX;
|
||||||
|
@ -604,7 +591,7 @@ unsigned short get_userid_by_name(char* uname, void* hdbc)
|
||||||
|
|
||||||
/* 连接数据库,根据用户名查询user表中的id */
|
/* 连接数据库,根据用户名查询user表中的id */
|
||||||
char* select_sql = "SELECT id FROM user_account WHERE user_name = ?";
|
char* select_sql = "SELECT id FROM user_account WHERE user_name = ?";
|
||||||
uid = select_datebase_by_number(USER_ACCOUNT_DATABASE_ID, hdbc, USER_TABLE, select_sql, 1, 0, &num, 1,
|
uid = select_datebase_by_number(USER_MANAGER_DBID, hdbc, USER_TABLE, select_sql, 1, 0, &num, 1,
|
||||||
DB_DATA_STRING_TYPE, strlen(uname)+1, uname);
|
DB_DATA_STRING_TYPE, strlen(uname)+1, uname);
|
||||||
if(0 == num)
|
if(0 == num)
|
||||||
{
|
{
|
||||||
|
@ -619,7 +606,6 @@ unsigned short get_userid_by_name(char* uname, void* hdbc)
|
||||||
/* 修改用户-命令行 */
|
/* 修改用户-命令行 */
|
||||||
bool mod_user_line(char* uname, const int intype, char* in)
|
bool mod_user_line(char* uname, const int intype, char* in)
|
||||||
{
|
{
|
||||||
void *moduser_line_hdbc;
|
|
||||||
unsigned short uid;
|
unsigned short uid;
|
||||||
bool result = true;
|
bool result = true;
|
||||||
if (NULL == uname || NULL == in)
|
if (NULL == uname || NULL == in)
|
||||||
|
@ -634,16 +620,15 @@ bool mod_user_line(char* uname, const int intype, char* in)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 连接数据库,更新user表 */
|
/* 连接数据库,更新user表 */
|
||||||
moduser_line_hdbc = connect_database(13);
|
re_connect();
|
||||||
if(NULL == moduser_line_hdbc)
|
//moduser_line_hdbc = connect_database(13);
|
||||||
|
if(NULL == um_hdbc)
|
||||||
{
|
{
|
||||||
/* 记录日志 */
|
|
||||||
//printf("moduser_line_hdbc连接数据库失败 .\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 根据用户名查询用户ID */
|
/* 根据用户名查询用户ID */
|
||||||
uid = get_userid_by_name(uname, moduser_line_hdbc);
|
uid = get_userid_by_name(uname, um_hdbc);
|
||||||
|
|
||||||
if (INVALID_INDEX == uid)
|
if (INVALID_INDEX == uid)
|
||||||
{
|
{
|
||||||
|
@ -651,9 +636,7 @@ bool mod_user_line(char* uname, const int intype, char* in)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*(0)描述、(1)所属组名、(2)登陆密码、(3)公用账号、(4)永久有效、(5)有效期开始时间、(6)有效期结束时间 */
|
/*(0)描述、(1)所属组名、(2)登陆密码、(3)公用账号、(4)永久有效、(5)有效期开始时间、(6)有效期结束时间 */
|
||||||
result = g_user_modfunc_table[intype](uid, in, moduser_line_hdbc);
|
result = g_user_modfunc_table[intype](uid, in, um_hdbc);
|
||||||
|
|
||||||
int ret_release = disconnect_database(USER_ACCOUNT_DATABASE_ID, moduser_line_hdbc); //ret_release记录日志
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -661,7 +644,6 @@ bool mod_user_line(char* uname, const int intype, char* in)
|
||||||
/* 修改用户-移动分组 */
|
/* 修改用户-移动分组 */
|
||||||
bool move_user_group(int flag_all, unsigned short new_group_uuid, unsigned short old_group_uuid, unsigned short * user_uuid, int user_uuid_num)
|
bool move_user_group(int flag_all, unsigned short new_group_uuid, unsigned short old_group_uuid, unsigned short * user_uuid, int user_uuid_num)
|
||||||
{
|
{
|
||||||
void * moveug_hdbc,* selectgid_hdbc;;
|
|
||||||
char * moveug_sql;
|
char * moveug_sql;
|
||||||
char * selectuid_sql;
|
char * selectuid_sql;
|
||||||
char * ret_userids;
|
char * ret_userids;
|
||||||
|
@ -676,31 +658,20 @@ bool move_user_group(int flag_all, unsigned short new_group_uuid, unsigned short
|
||||||
}
|
}
|
||||||
|
|
||||||
//连接数据库
|
//连接数据库
|
||||||
moveug_hdbc = connect_database(USER_ACCOUNT_DATABASE_ID); //更新用户表
|
//moveug_hdbc = connect_database(USER_ACCOUNT_DATABASE_ID); //更新用户表
|
||||||
if (NULL == moveug_hdbc || NULL == selectgid_hdbc)
|
re_connect();
|
||||||
|
if (NULL == um_hdbc)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据新组的uuid获取新组的id
|
//根据新组的uuid获取新组的id
|
||||||
temp_groupid = get_groupid_by_uuid(new_group_uuid, moveug_hdbc);
|
temp_groupid = get_groupid_by_uuid(new_group_uuid, um_hdbc);
|
||||||
if (INVALID_INDEX == temp_groupid)
|
if (INVALID_INDEX == temp_groupid)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// char * ret_new_groupid_json = select_datebase_by_number(USER_GROUP_DATABASE_ID, selectgid_hdbc, USER_GROUP_TABLE, "SELECT id FROM `user_group` WHERE uuid = ?",
|
|
||||||
// 1, 0, &sql_num, 1,
|
|
||||||
// DB_DATA_INT_TYPE, sizeof(new_group_uuid), new_group_uuid);
|
|
||||||
// if (0 == sql_num || NULL == ret_new_groupid_json)
|
|
||||||
// {
|
|
||||||
// ret_discon = disconnect_database(USER_GROUP_DATABASE_ID, selectgid_hdbc);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ARRAYJSON2INT(ret_new_groupid_json, "id", &temp_groupid);
|
|
||||||
//temp_groupid = id_json2int(temp_test01, "id");
|
|
||||||
|
|
||||||
//按照group_uuid移动
|
//按照group_uuid移动
|
||||||
if (0 == flag_all || NULL ==user_uuid)
|
if (0 == flag_all || NULL ==user_uuid)
|
||||||
{
|
{
|
||||||
|
@ -722,26 +693,23 @@ bool move_user_group(int flag_all, unsigned short new_group_uuid, unsigned short
|
||||||
)";
|
)";
|
||||||
selectuid_sql = "SELECT id FROM `user_account` WHERE group_id = (SELECT user_group.id FROM user_group WHERE user_group.uuid = ?)";
|
selectuid_sql = "SELECT id FROM `user_account` WHERE group_id = (SELECT user_group.id FROM user_group WHERE user_group.uuid = ?)";
|
||||||
|
|
||||||
ret_userids = select_datebase_by_number(USER_ACCOUNT_DATABASE_ID, moveug_hdbc, USER_TABLE, selectuid_sql, 1, 0, &sql_num, 1,
|
ret_userids = select_datebase_by_number(USER_MANAGER_DBID, um_hdbc, USER_TABLE, selectuid_sql, 1, 0, &sql_num, 1,
|
||||||
DB_DATA_INT_TYPE, sizeof(old_group_uuid), old_group_uuid);
|
DB_DATA_INT_TYPE, sizeof(old_group_uuid), old_group_uuid);
|
||||||
//解析ret_userids --> temp_userids
|
//解析ret_userids --> temp_userids
|
||||||
if(0 == sql_num || NULL == ret_userids)
|
if(0 == sql_num || NULL == ret_userids)
|
||||||
{
|
{
|
||||||
ret_discon = disconnect_database(USER_ACCOUNT_DATABASE_ID, moveug_hdbc);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cJSON * ret_root_json = cJSON_Parse(ret_userids);
|
cJSON * ret_root_json = cJSON_Parse(ret_userids);
|
||||||
if (NULL == ret_root_json)
|
if (NULL == ret_root_json)
|
||||||
{
|
{
|
||||||
ret_discon = disconnect_database(USER_ACCOUNT_DATABASE_ID, moveug_hdbc);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cJSON * ret_data_json = cJSON_GetObjectItem(ret_root_json, "data");
|
cJSON * ret_data_json = cJSON_GetObjectItem(ret_root_json, "data");
|
||||||
if(NULL == ret_data_json)
|
if(NULL == ret_data_json)
|
||||||
{
|
{
|
||||||
ret_discon = disconnect_database(USER_ACCOUNT_DATABASE_ID, moveug_hdbc);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -752,17 +720,15 @@ bool move_user_group(int flag_all, unsigned short new_group_uuid, unsigned short
|
||||||
cJSON * ret_id_json = cJSON_GetArrayItem(ret_data_json, i);
|
cJSON * ret_id_json = cJSON_GetArrayItem(ret_data_json, i);
|
||||||
if (NULL == ret_id_json)
|
if (NULL == ret_id_json)
|
||||||
{
|
{
|
||||||
ret_discon = disconnect_database(USER_ACCOUNT_DATABASE_ID, moveug_hdbc);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
temp_userids[ret_id_json->valueint] = ret_id_json->valueint;
|
temp_userids[ret_id_json->valueint] = ret_id_json->valueint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret_sql = update_database(USER_ACCOUNT_DATABASE_ID, moveug_hdbc, DB_OP_UPDATE, USER_TABLE, moveug_sql, 2,
|
ret_sql = update_database(USER_MANAGER_DBID, um_hdbc, DB_OP_UPDATE, USER_TABLE, moveug_sql, 2,
|
||||||
DB_DATA_INT_TYPE, sizeof(temp_groupid), temp_groupid,
|
DB_DATA_INT_TYPE, sizeof(temp_groupid), temp_groupid,
|
||||||
DB_DATA_INT_TYPE, sizeof(old_group_uuid), old_group_uuid);
|
DB_DATA_INT_TYPE, sizeof(old_group_uuid), old_group_uuid);
|
||||||
ret_discon = disconnect_database(USER_ACCOUNT_DATABASE_ID, moveug_hdbc);
|
|
||||||
if (DB_RET_OK != ret_sql)
|
if (DB_RET_OK != ret_sql)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -774,7 +740,6 @@ bool move_user_group(int flag_all, unsigned short new_group_uuid, unsigned short
|
||||||
{
|
{
|
||||||
if (NULL == user_uuid)
|
if (NULL == user_uuid)
|
||||||
{
|
{
|
||||||
ret_discon = disconnect_database(USER_ACCOUNT_DATABASE_ID, moveug_hdbc);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,27 +748,24 @@ bool move_user_group(int flag_all, unsigned short new_group_uuid, unsigned short
|
||||||
for (int i = 0; i < user_uuid_num; i++)
|
for (int i = 0; i < user_uuid_num; i++)
|
||||||
{
|
{
|
||||||
unsigned short temp_uesr_uuid = 0;
|
unsigned short temp_uesr_uuid = 0;
|
||||||
ret_userids = select_datebase_by_number(USER_ACCOUNT_DATABASE_ID, moveug_hdbc, USER_TABLE, selectuid_sql, 1, 0, &sql_num, 1,
|
ret_userids = select_datebase_by_number(USER_MANAGER_DBID, um_hdbc, USER_TABLE, selectuid_sql, 1, 0, &sql_num, 1,
|
||||||
DB_DATA_INT_TYPE, sizeof(user_uuid[i]), user_uuid[i]);
|
DB_DATA_INT_TYPE, sizeof(user_uuid[i]), user_uuid[i]);
|
||||||
if(0 == sql_num || NULL ==ret_userids)
|
if(0 == sql_num || NULL ==ret_userids)
|
||||||
{
|
{
|
||||||
ret_discon = disconnect_database(USER_ACCOUNT_DATABASE_ID, moveug_hdbc);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ARRAYJSON2INT(ret_userids, "id", &temp_userid);
|
ARRAYJSON2INT(ret_userids, "id", &temp_userid);
|
||||||
temp_userids[temp_userid] = temp_userid;
|
temp_userids[temp_userid] = temp_userid;
|
||||||
|
|
||||||
temp_uesr_uuid = user_uuid[i];
|
temp_uesr_uuid = user_uuid[i];
|
||||||
ret_sql = update_database(USER_ACCOUNT_DATABASE_ID, moveug_hdbc, DB_OP_UPDATE, USER_TABLE, moveug_sql, 2,
|
ret_sql = update_database(USER_MANAGER_DBID, um_hdbc, DB_OP_UPDATE, USER_TABLE, moveug_sql, 2,
|
||||||
DB_DATA_INT_TYPE, sizeof(temp_groupid), temp_groupid,
|
DB_DATA_INT_TYPE, sizeof(temp_groupid), temp_groupid,
|
||||||
DB_DATA_INT_TYPE, sizeof(temp_uesr_uuid), temp_uesr_uuid);
|
DB_DATA_INT_TYPE, sizeof(temp_uesr_uuid), temp_uesr_uuid);
|
||||||
if(DB_RET_OK != ret_sql)
|
if(DB_RET_OK != ret_sql)
|
||||||
{
|
{
|
||||||
ret_discon = disconnect_database(USER_ACCOUNT_DATABASE_ID, moveug_hdbc);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret_discon = disconnect_database(USER_ACCOUNT_DATABASE_ID, moveug_hdbc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改内存
|
//修改内存
|
||||||
|
@ -877,7 +839,6 @@ void offline_force_one_user(unsigned short user_id)
|
||||||
int usermanager_del_user(USER_DEL* in)
|
int usermanager_del_user(USER_DEL* in)
|
||||||
{
|
{
|
||||||
unsigned short user_id_temp;
|
unsigned short user_id_temp;
|
||||||
void * deluser_hdbc;
|
|
||||||
|
|
||||||
if(NULL == in)
|
if(NULL == in)
|
||||||
{
|
{
|
||||||
|
@ -885,8 +846,9 @@ int usermanager_del_user(USER_DEL* in)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 连接数据库 */
|
/* 连接数据库 */
|
||||||
deluser_hdbc = connect_database(12);
|
//deluser_hdbc = connect_database(12);
|
||||||
if(NULL == deluser_hdbc)
|
re_connect();
|
||||||
|
if(NULL == um_hdbc)
|
||||||
{
|
{
|
||||||
/* 记录日志 */
|
/* 记录日志 */
|
||||||
return DELUSER_FAIL_DATABASE;
|
return DELUSER_FAIL_DATABASE;
|
||||||
|
@ -901,7 +863,7 @@ int usermanager_del_user(USER_DEL* in)
|
||||||
{
|
{
|
||||||
return DELUSER_FAIL_NOTEXIST;
|
return DELUSER_FAIL_NOTEXIST;
|
||||||
}
|
}
|
||||||
user_id_temp = get_userid_by_name(in->id_name.uname, deluser_hdbc);
|
user_id_temp = get_userid_by_name(in->id_name.uname, um_hdbc);
|
||||||
if (INVALID_INDEX == user_id_temp)
|
if (INVALID_INDEX == user_id_temp)
|
||||||
{
|
{
|
||||||
return DELUSER_FAIL_NOTEXIST;
|
return DELUSER_FAIL_NOTEXIST;
|
||||||
|
@ -922,13 +884,12 @@ int usermanager_del_user(USER_DEL* in)
|
||||||
|
|
||||||
/* 删数据库user_account */
|
/* 删数据库user_account */
|
||||||
char* deluser_sql = "DELETE FROM user_account WHERE id = ?";
|
char* deluser_sql = "DELETE FROM user_account WHERE id = ?";
|
||||||
int ret_del = update_database(USER_ACCOUNT_DATABASE_ID, deluser_hdbc, DB_OP_DEL, USER_TABLE, deluser_sql, 1,
|
int ret_del = update_database(USER_MANAGER_DBID, um_hdbc, DB_OP_DEL, USER_TABLE, deluser_sql, 1,
|
||||||
DB_DATA_INT_TYPE, sizeof(user_id_temp), user_id_temp);
|
DB_DATA_INT_TYPE, sizeof(user_id_temp), user_id_temp);
|
||||||
|
|
||||||
/* 删内存,根据用户ID删除用户列表中对应的用户 - 释放index、ID置0 */
|
/* 删内存,根据用户ID删除用户列表中对应的用户 - 释放index、ID置0 */
|
||||||
free_index(&g_user_index_head, user_id_temp);
|
free_index(&g_user_index_head, user_id_temp);
|
||||||
g_user_table[user_id_temp].ID = INVALID_INDEX;
|
g_user_table[user_id_temp].ID = INVALID_INDEX;
|
||||||
int ret_release = disconnect_database(USER_ACCOUNT_DATABASE_ID, deluser_hdbc);
|
|
||||||
return DELUSER_SUCCESS;
|
return DELUSER_SUCCESS;
|
||||||
/* 强制用户下线在外面 */
|
/* 强制用户下线在外面 */
|
||||||
}
|
}
|
||||||
|
@ -936,7 +897,6 @@ int usermanager_del_user(USER_DEL* in)
|
||||||
/* 查询用户列表 */
|
/* 查询用户列表 */
|
||||||
bool useraccount_showlist(int uugroup_id, char * user_name, int page_start, int page_counts, char ** user_list)
|
bool useraccount_showlist(int uugroup_id, char * user_name, int page_start, int page_counts, char ** user_list)
|
||||||
{
|
{
|
||||||
void * getulist_hdbc; //数据库句柄
|
|
||||||
int num, arrlen, page_s;
|
int num, arrlen, page_s;
|
||||||
char * ulist, *point, *select_sql;
|
char * ulist, *point, *select_sql;
|
||||||
|
|
||||||
|
@ -965,8 +925,9 @@ bool useraccount_showlist(int uugroup_id, char * user_name, int page_start, int
|
||||||
page_s = (page_start - 1)*page_counts;
|
page_s = (page_start - 1)*page_counts;
|
||||||
|
|
||||||
/* 连接数据库 */
|
/* 连接数据库 */
|
||||||
getulist_hdbc = connect_database(USER_ACCOUNT_DATABASE_ID);
|
//getulist_hdbc = connect_database(USER_ACCOUNT_DATABASE_ID);
|
||||||
if(NULL == getulist_hdbc)
|
re_connect();
|
||||||
|
if(NULL == um_hdbc)
|
||||||
{
|
{
|
||||||
/* 记录日志 */
|
/* 记录日志 */
|
||||||
return false;
|
return false;
|
||||||
|
@ -977,7 +938,7 @@ bool useraccount_showlist(int uugroup_id, char * user_name, int page_start, int
|
||||||
select_sql = "SELECT U.uuid ID, G.uuid GID, U.user_name uname, G.gname gname, U.udescription udescription,\
|
select_sql = "SELECT U.uuid ID, G.uuid GID, U.user_name uname, G.gname gname, U.udescription udescription,\
|
||||||
U.multi_player multi, U.valid_always valid, U.valid_begin_time, U.valid_end_time \
|
U.multi_player multi, U.valid_always valid, U.valid_begin_time, U.valid_end_time \
|
||||||
FROM user_account U, user_group G WHERE U.group_id = G.id AND U.user_name LIKE ? LIMIT ?, ?";
|
FROM user_account U, user_group G WHERE U.group_id = G.id AND U.user_name LIKE ? LIMIT ?, ?";
|
||||||
ulist = select_datebase_by_number(USER_ACCOUNT_DATABASE_ID, getulist_hdbc, USER_GROUP_TABLE, select_sql, 1, 0, &num, 3,
|
ulist = select_datebase_by_number(USER_MANAGER_DBID, um_hdbc, USER_GROUP_TABLE, select_sql, 1, 0, &num, 3,
|
||||||
DB_DATA_STRING_TYPE, arrlen+1, temp_uname,
|
DB_DATA_STRING_TYPE, arrlen+1, temp_uname,
|
||||||
DB_DATA_INT_TYPE, sizeof(page_s), page_s,
|
DB_DATA_INT_TYPE, sizeof(page_s), page_s,
|
||||||
DB_DATA_INT_TYPE, sizeof(page_counts), page_counts);
|
DB_DATA_INT_TYPE, sizeof(page_counts), page_counts);
|
||||||
|
@ -986,13 +947,12 @@ bool useraccount_showlist(int uugroup_id, char * user_name, int page_start, int
|
||||||
select_sql = "SELECT U.uuid ID, G.uuid GID, U.user_name uname, G.gname gname, U.udescription udescription,\
|
select_sql = "SELECT U.uuid ID, G.uuid GID, U.user_name uname, G.gname gname, U.udescription udescription,\
|
||||||
U.multi_player multi, U.valid_always valid, U.valid_begin_time, U.valid_end_time \
|
U.multi_player multi, U.valid_always valid, U.valid_begin_time, U.valid_end_time \
|
||||||
FROM user_account U, user_group G WHERE G.uuid = ? AND U.group_id = G.id AND U.user_name LIKE ? LIMIT ?, ?";
|
FROM user_account U, user_group G WHERE G.uuid = ? AND U.group_id = G.id AND U.user_name LIKE ? LIMIT ?, ?";
|
||||||
ulist = select_datebase_by_number(USER_ACCOUNT_DATABASE_ID, getulist_hdbc, USER_GROUP_TABLE, select_sql, 1, 0, &num, 4,
|
ulist = select_datebase_by_number(USER_MANAGER_DBID, um_hdbc, USER_GROUP_TABLE, select_sql, 1, 0, &num, 4,
|
||||||
DB_DATA_INT_TYPE, sizeof(uugroup_id), uugroup_id,
|
DB_DATA_INT_TYPE, sizeof(uugroup_id), uugroup_id,
|
||||||
DB_DATA_STRING_TYPE, arrlen+1, temp_uname,
|
DB_DATA_STRING_TYPE, arrlen+1, temp_uname,
|
||||||
DB_DATA_INT_TYPE, sizeof(page_s), page_s,
|
DB_DATA_INT_TYPE, sizeof(page_s), page_s,
|
||||||
DB_DATA_INT_TYPE, sizeof(page_counts), page_counts);
|
DB_DATA_INT_TYPE, sizeof(page_counts), page_counts);
|
||||||
}
|
}
|
||||||
int discon = disconnect_database(USER_ACCOUNT_DATABASE_ID, getulist_hdbc); //discon记录日志
|
|
||||||
if (0 == num || NULL == ulist) //查询结果为空
|
if (0 == num || NULL == ulist) //查询结果为空
|
||||||
{
|
{
|
||||||
cJSON * root = cJSON_CreateObject();
|
cJSON * root = cJSON_CreateObject();
|
||||||
|
@ -1020,3 +980,36 @@ bool useraccount_showlist(int uugroup_id, char * user_name, int page_start, int
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 查询 user_account 内存恢复 */
|
||||||
|
void um_getuser_db(char ** user_db)
|
||||||
|
{
|
||||||
|
int num = 0;
|
||||||
|
int size = 0;
|
||||||
|
|
||||||
|
re_connect();
|
||||||
|
if(NULL == um_hdbc)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char * select_sql = "SELECT id ID, group_id GID, multi_player multi, valid_always valid, user_name uname, udescription, valid_begin_time,valid_end_time FROM `user_account`";
|
||||||
|
char * ret_user = select_datebase_by_number(USER_MANAGER_DBID, um_hdbc, USER_TABLE, select_sql, 1, 0, &num, 0);
|
||||||
|
|
||||||
|
if(0 == num || NULL == ret_user)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
size = strlen(ret_user)+1;
|
||||||
|
char * point = (char*)malloc(size);
|
||||||
|
if(NULL == point)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memset(point, 0, size);
|
||||||
|
memcpy(point, ret_user, size);
|
||||||
|
*user_db = point; //在函数外面释放
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
|
@ -13,6 +13,7 @@
|
||||||
extern ARRAY g_group_index_head;
|
extern ARRAY g_group_index_head;
|
||||||
extern ARRAY g_user_index_head;
|
extern ARRAY g_user_index_head;
|
||||||
extern USERACCOUNT g_user_table[];
|
extern USERACCOUNT g_user_table[];
|
||||||
|
extern void * um_hdbc;
|
||||||
USERGROUP g_group_table[GROUP_INDEX_MAX];
|
USERGROUP g_group_table[GROUP_INDEX_MAX];
|
||||||
|
|
||||||
/* 初始化参数 */
|
/* 初始化参数 */
|
||||||
|
@ -31,8 +32,8 @@ int init_group()
|
||||||
/* 添加元素 */
|
/* 添加元素 */
|
||||||
int add_group(char* name, char* description)
|
int add_group(char* name, char* description)
|
||||||
{
|
{
|
||||||
void *addgroup_hdbc;
|
//void *addgroup_hdbc;
|
||||||
int ret_release;
|
//int ret_release;
|
||||||
if (NULL == name)
|
if (NULL == name)
|
||||||
{
|
{
|
||||||
return ADDGROUP_ERROR;
|
return ADDGROUP_ERROR;
|
||||||
|
@ -56,17 +57,17 @@ int add_group(char* name, char* description)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 连接数据库 */
|
/* 连接数据库 */
|
||||||
addgroup_hdbc = connect_database(USER_GROUP_DATABASE_ID);
|
re_connect();
|
||||||
if(NULL == addgroup_hdbc)
|
//addgroup_hdbc = connect_database(USER_GROUP_DATABASE_ID);
|
||||||
|
if(NULL == um_hdbc)
|
||||||
{
|
{
|
||||||
/* 记录日志 */
|
/* 记录日志 */
|
||||||
return ADDGROUP_FAIL_DATABASE;
|
return ADDGROUP_FAIL_DATABASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 校验重名 */
|
/* 校验重名 */
|
||||||
if(0 != get_groupid_by_name(name, addgroup_hdbc))
|
if(0 != get_groupid_by_name(name, um_hdbc))
|
||||||
{
|
{
|
||||||
disconnect_database(USER_GROUP_DATABASE_ID, addgroup_hdbc); // ret_release记录日志
|
|
||||||
return ADDGROUP_FAIL_DUP;
|
return ADDGROUP_FAIL_DUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,13 +75,12 @@ int add_group(char* name, char* description)
|
||||||
unsigned short ID = alloc_index(&g_group_index_head);
|
unsigned short ID = alloc_index(&g_group_index_head);
|
||||||
if (INVALID_INDEX == ID)
|
if (INVALID_INDEX == ID)
|
||||||
{
|
{
|
||||||
disconnect_database(USER_GROUP_DATABASE_ID, addgroup_hdbc); // ret_release记录日志
|
|
||||||
return ADDGROUP_FAIL_FULL;
|
return ADDGROUP_FAIL_FULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 连接数据库,向user_group表中添加:用户组ID、用户组名和用户组描述 */
|
/* 连接数据库,向user_group表中添加:用户组ID、用户组名和用户组描述 */
|
||||||
char *addgroup_sql = "INSERT INTO user_group SET id = ?, gname = ?, gdescription = ?";
|
char *addgroup_sql = "INSERT INTO user_group SET id = ?, gname = ?, gdescription = ?";
|
||||||
int ret_addgroup = update_database(USER_GROUP_DATABASE_ID, addgroup_hdbc, DB_OP_INSERT, USER_GROUP_TABLE, addgroup_sql, 3,
|
int ret_addgroup = update_database(USER_MANAGER_DBID, um_hdbc, DB_OP_INSERT, USER_GROUP_TABLE, addgroup_sql, 3,
|
||||||
DB_DATA_INT_TYPE, sizeof(ID), ID,
|
DB_DATA_INT_TYPE, sizeof(ID), ID,
|
||||||
DB_DATA_STRING_TYPE, strlen(name)+1, name,
|
DB_DATA_STRING_TYPE, strlen(name)+1, name,
|
||||||
DB_DATA_STRING_TYPE, strlen(description)+1,description);
|
DB_DATA_STRING_TYPE, strlen(description)+1,description);
|
||||||
|
@ -88,7 +88,6 @@ int add_group(char* name, char* description)
|
||||||
if(DB_RET_OK != ret_addgroup)
|
if(DB_RET_OK != ret_addgroup)
|
||||||
{
|
{
|
||||||
free_index(&g_group_index_head, ID);
|
free_index(&g_group_index_head, ID);
|
||||||
ret_release = disconnect_database(USER_GROUP_DATABASE_ID, addgroup_hdbc); // ret_release记录日志
|
|
||||||
return ADDGROUP_FAIL_DATABASE;
|
return ADDGROUP_FAIL_DATABASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,16 +96,14 @@ int add_group(char* name, char* description)
|
||||||
strcpy(g_group_table[ID].gname, name);
|
strcpy(g_group_table[ID].gname, name);
|
||||||
strcpy(g_group_table[ID].gdescription, description);
|
strcpy(g_group_table[ID].gdescription, description);
|
||||||
|
|
||||||
ret_release = disconnect_database(USER_GROUP_DATABASE_ID, addgroup_hdbc); // ret_release记录日志
|
|
||||||
|
|
||||||
return ADDGROUP_SUCCESS;
|
return ADDGROUP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 修改用户组描述 */
|
/* 修改用户组描述 */
|
||||||
unsigned short mod_group_desp(int group_uuid, char* gdesp)
|
unsigned short mod_group_desp(int group_uuid, char* gdesp)
|
||||||
{
|
{
|
||||||
void *modgroup_hdbc;
|
//void *modgroup_hdbc;
|
||||||
int ret_release;
|
//int ret_release;
|
||||||
int num;
|
int num;
|
||||||
if(NULL == gdesp)
|
if(NULL == gdesp)
|
||||||
{
|
{
|
||||||
|
@ -114,27 +111,25 @@ unsigned short mod_group_desp(int group_uuid, char* gdesp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 连接数据库 */
|
/* 连接数据库 */
|
||||||
modgroup_hdbc = connect_database(USER_GROUP_DATABASE_ID);
|
re_connect();
|
||||||
if(NULL == modgroup_hdbc)
|
//modgroup_hdbc = connect_database(USER_GROUP_DATABASE_ID);
|
||||||
|
if(NULL == um_hdbc)
|
||||||
{
|
{
|
||||||
/* 记录日志 */
|
/* 记录日志 */
|
||||||
return MODGROUP_FAIL_DATABASE;
|
return MODGROUP_FAIL_DATABASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short group_id = get_groupid_by_uuid(group_uuid, modgroup_hdbc);
|
unsigned short group_id = get_groupid_by_uuid(group_uuid, um_hdbc);
|
||||||
if(INVALID_INDEX == group_id)
|
if(INVALID_INDEX == group_id)
|
||||||
{
|
{
|
||||||
ret_release = disconnect_database(USER_GROUP_DATABASE_ID, modgroup_hdbc); //ret_release记录日志
|
|
||||||
return MODGROUP_FAIL_INPUT;
|
return MODGROUP_FAIL_INPUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 修改数据库 */
|
/* 修改数据库 */
|
||||||
char *modgroup_sql = "UPDATE user_group SET gdescription = ? WHERE uuid = ? ";
|
char *modgroup_sql = "UPDATE user_group SET gdescription = ? WHERE uuid = ? ";
|
||||||
int ret_modgroup = update_database(1, modgroup_hdbc, DB_OP_UPDATE, USER_GROUP_TABLE, modgroup_sql, 2,
|
int ret_modgroup = update_database(USER_MANAGER_DBID, um_hdbc, DB_OP_UPDATE, USER_GROUP_TABLE, modgroup_sql, 2,
|
||||||
DB_DATA_STRING_TYPE, strlen(gdesp), gdesp,
|
DB_DATA_STRING_TYPE, strlen(gdesp), gdesp,
|
||||||
DB_DATA_INT_TYPE, sizeof(group_uuid), group_uuid);
|
DB_DATA_INT_TYPE, sizeof(group_uuid), group_uuid);
|
||||||
ret_release = disconnect_database(USER_GROUP_DATABASE_ID, modgroup_hdbc); //ret_release记录日志
|
|
||||||
|
|
||||||
if(DB_RET_OK != ret_modgroup)
|
if(DB_RET_OK != ret_modgroup)
|
||||||
{
|
{
|
||||||
return MODGROUP_FAIL_DATABASE;
|
return MODGROUP_FAIL_DATABASE;
|
||||||
|
@ -194,15 +189,14 @@ unsigned short get_group_count()
|
||||||
/* 查询用户组列表 */
|
/* 查询用户组列表 */
|
||||||
bool show_group_list(char ** group_list)
|
bool show_group_list(char ** group_list)
|
||||||
{
|
{
|
||||||
void * getglist_hdbc;
|
|
||||||
int num;
|
int num;
|
||||||
if (NULL == group_list)
|
if (NULL == group_list)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getglist_hdbc = connect_database(USER_GROUP_DATABASE_ID);
|
re_connect();
|
||||||
if (NULL == getglist_hdbc)
|
if(NULL == um_hdbc)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -225,7 +219,7 @@ bool show_group_list(char ** group_list)
|
||||||
) t1 ON user_group.id = t1.group_id\
|
) t1 ON user_group.id = t1.group_id\
|
||||||
ORDER BY\
|
ORDER BY\
|
||||||
user_group.uuid";
|
user_group.uuid";
|
||||||
char * glist = select_datebase_by_number(USER_ACCOUNT_DATABASE_ID, getglist_hdbc, USER_GROUP_TABLE, select_sql, 1, 0, &num, 0);
|
char * glist = select_datebase_by_number(USER_MANAGER_DBID, um_hdbc, USER_GROUP_TABLE, select_sql, 1, 0, &num, 0);
|
||||||
|
|
||||||
if (0 == num || NULL == glist) //查询结果为空
|
if (0 == num || NULL == glist) //查询结果为空
|
||||||
{
|
{
|
||||||
|
@ -317,7 +311,7 @@ unsigned short get_groupid_by_uuid(int uugid, void * hdbc)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *select_sql = "SELECT id FROM user_group WHERE uuid = ?";
|
char *select_sql = "SELECT id FROM user_group WHERE uuid = ?";
|
||||||
gid = select_datebase_by_number(USER_GROUP_DATABASE_ID, hdbc, USER_GROUP_TABLE, select_sql, 1, 0, &num, 1,
|
gid = select_datebase_by_number(USER_MANAGER_DBID, hdbc, USER_GROUP_TABLE, select_sql, 1, 0, &num, 1,
|
||||||
DB_DATA_INT_TYPE, sizeof(uugid), uugid);
|
DB_DATA_INT_TYPE, sizeof(uugid), uugid);
|
||||||
|
|
||||||
if(0 == num)
|
if(0 == num)
|
||||||
|
@ -334,8 +328,7 @@ unsigned short get_groupid_by_uuid(int uugid, void * hdbc)
|
||||||
bool get_group_uuid_by_name(char* gname, unsigned short * group_uuid)
|
bool get_group_uuid_by_name(char* gname, unsigned short * group_uuid)
|
||||||
{
|
{
|
||||||
char *gid = NULL;
|
char *gid = NULL;
|
||||||
void * ghdbc;
|
int num;
|
||||||
int num, discon;
|
|
||||||
unsigned short uuid_temp = INVALID_INDEX;
|
unsigned short uuid_temp = INVALID_INDEX;
|
||||||
|
|
||||||
if (NULL == gname || NULL == group_uuid)
|
if (NULL == gname || NULL == group_uuid)
|
||||||
|
@ -343,19 +336,17 @@ bool get_group_uuid_by_name(char* gname, unsigned short * group_uuid)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ghdbc = connect_database(USER_GROUP_DATABASE_ID);
|
//ghdbc = connect_database(USER_GROUP_DATABASE_ID);
|
||||||
if (NULL == ghdbc)
|
re_connect();
|
||||||
|
if (NULL == um_hdbc)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 连接数据库,根据用户名查询user表中的uuid */
|
/* 连接数据库,根据用户名查询user表中的uuid */
|
||||||
char* select_sql = "SELECT uuid FROM user_group WHERE gname = ?";
|
char* select_sql = "SELECT uuid FROM user_group WHERE gname = ?";
|
||||||
gid = select_datebase_by_number(USER_GROUP_DATABASE_ID, ghdbc, USER_GROUP_TABLE, select_sql, 1, 0, &num, 1,
|
gid = select_datebase_by_number(USER_MANAGER_DBID, um_hdbc, USER_GROUP_TABLE, select_sql, 1, 0, &num, 1,
|
||||||
DB_DATA_STRING_TYPE, strlen(gname)+1, gname);
|
DB_DATA_STRING_TYPE, strlen(gname)+1, gname);
|
||||||
/* 删除数据连接 */
|
|
||||||
discon = disconnect_database(USER_GROUP_DATABASE_ID, ghdbc); //discon记录日志
|
|
||||||
|
|
||||||
if(0 == num || NULL == gid)
|
if(0 == num || NULL == gid)
|
||||||
{
|
{
|
||||||
*group_uuid = INVALID_INDEX;
|
*group_uuid = INVALID_INDEX;
|
||||||
|
@ -388,7 +379,7 @@ unsigned short get_groupid_by_name(char* gname, void* hdbc)
|
||||||
|
|
||||||
/* 数据库查询,根据用户组名查询user_grooup表中的id */
|
/* 数据库查询,根据用户组名查询user_grooup表中的id */
|
||||||
char *select_sql = "SELECT id FROM user_group WHERE gname = ?";
|
char *select_sql = "SELECT id FROM user_group WHERE gname = ?";
|
||||||
gid = select_datebase_by_number(USER_GROUP_DATABASE_ID, hdbc, USER_GROUP_TABLE, select_sql, 1, 0, &num, 1,
|
gid = select_datebase_by_number(USER_MANAGER_DBID, hdbc, USER_GROUP_TABLE, select_sql, 1, 0, &num, 1,
|
||||||
DB_DATA_STRING_TYPE, strlen(gname)+1, gname);
|
DB_DATA_STRING_TYPE, strlen(gname)+1, gname);
|
||||||
|
|
||||||
if(0 == num)
|
if(0 == num)
|
||||||
|
@ -431,7 +422,6 @@ void offline_force_by_groupid(char *groupid)
|
||||||
/*删除元素*/
|
/*删除元素*/
|
||||||
unsigned short del_group_by_name(GROUP_DEL* gname)
|
unsigned short del_group_by_name(GROUP_DEL* gname)
|
||||||
{
|
{
|
||||||
void * delgroup_hdbc;
|
|
||||||
unsigned short GID_temp = 0;
|
unsigned short GID_temp = 0;
|
||||||
if (NULL == gname)
|
if (NULL == gname)
|
||||||
{
|
{
|
||||||
|
@ -439,8 +429,8 @@ unsigned short del_group_by_name(GROUP_DEL* gname)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 连接数据库 */
|
/* 连接数据库 */
|
||||||
delgroup_hdbc = connect_database(12);
|
re_connect();
|
||||||
if(NULL == delgroup_hdbc)
|
if(NULL == um_hdbc)
|
||||||
{
|
{
|
||||||
/* 记录日志 */
|
/* 记录日志 */
|
||||||
return DELGROUP_FAIL_DATABASE;
|
return DELGROUP_FAIL_DATABASE;
|
||||||
|
@ -455,7 +445,7 @@ unsigned short del_group_by_name(GROUP_DEL* gname)
|
||||||
{
|
{
|
||||||
return DELGROUP_FAIL_NOTEXIST;
|
return DELGROUP_FAIL_NOTEXIST;
|
||||||
}
|
}
|
||||||
GID_temp = get_groupid_by_name(gname->id_name.gname, delgroup_hdbc);
|
GID_temp = get_groupid_by_name(gname->id_name.gname, um_hdbc);
|
||||||
if (INVALID_INDEX == GID_temp)
|
if (INVALID_INDEX == GID_temp)
|
||||||
{
|
{
|
||||||
return DELGROUP_FAIL_NOTEXIST;
|
return DELGROUP_FAIL_NOTEXIST;
|
||||||
|
@ -490,15 +480,55 @@ unsigned short del_group_by_name(GROUP_DEL* gname)
|
||||||
|
|
||||||
/* 连接数据库,根据用户组ID删除 用户表 中对应数据*/
|
/* 连接数据库,根据用户组ID删除 用户表 中对应数据*/
|
||||||
char* deluser_sql = "DELETE FROM user WHERE group_id = ?";
|
char* deluser_sql = "DELETE FROM user WHERE group_id = ?";
|
||||||
int ret_del = update_database(USER_GROUP_DATABASE_ID, delgroup_hdbc, DB_OP_DEL, USER_TABLE, deluser_sql, 1,
|
int ret_del = update_database(USER_MANAGER_DBID, um_hdbc, DB_OP_DEL, USER_TABLE, deluser_sql, 1,
|
||||||
DB_DATA_INT_TYPE, sizeof(GID_temp), GID_temp);
|
DB_DATA_INT_TYPE, sizeof(GID_temp), GID_temp);
|
||||||
/* 连接数据库,根据用户组ID删除 用户组表 中对应数据*/
|
/* 连接数据库,根据用户组ID删除 用户组表 中对应数据*/
|
||||||
char *delgroup_sql = "DELETE FROM user_group WHERE id = ? ";
|
char *delgroup_sql = "DELETE FROM user_group WHERE id = ? ";
|
||||||
ret_del = update_database(USER_GROUP_DATABASE_ID, delgroup_hdbc, DB_OP_DEL, USER_GROUP_TABLE, delgroup_sql, 1,
|
ret_del = update_database(USER_MANAGER_DBID, um_hdbc, DB_OP_DEL, USER_GROUP_TABLE, delgroup_sql, 1,
|
||||||
DB_DATA_INT_TYPE, sizeof(GID_temp), GID_temp);
|
DB_DATA_INT_TYPE, sizeof(GID_temp), GID_temp);
|
||||||
/* 删除结果记录日志 */
|
|
||||||
int ret_release = disconnect_database(USER_GROUP_DATABASE_ID, delgroup_hdbc);
|
|
||||||
/* 数据库连接释放结果记录日志 */
|
/* 数据库连接释放结果记录日志 */
|
||||||
|
|
||||||
return DELGROUP_SUCCESS;
|
return DELGROUP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*数据库重连*/
|
||||||
|
void re_connect()
|
||||||
|
{
|
||||||
|
if(NULL == um_hdbc)
|
||||||
|
{
|
||||||
|
um_hdbc = connect_database(USER_MANAGER_DBID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 查询 user_group 内存恢复 */
|
||||||
|
void um_getgroup_db(char ** group_db)
|
||||||
|
{
|
||||||
|
int num = 0;
|
||||||
|
int size = 0;
|
||||||
|
|
||||||
|
re_connect();
|
||||||
|
if(NULL == um_hdbc)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char * select_sql = "SELECT user_group.id ID, user_group.gname, user_group.gdescription FROM `user_group`";
|
||||||
|
char * ret_group = select_datebase_by_number(USER_MANAGER_DBID, um_hdbc, USER_GROUP_TABLE, select_sql, 1, 0, &num, 0);
|
||||||
|
|
||||||
|
if(0 == num || NULL == ret_group)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
size = strlen(ret_group)+1;
|
||||||
|
char * point = (char*)malloc(size);
|
||||||
|
if(NULL == point)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memset(point, 0, size);
|
||||||
|
memcpy(point, ret_group, size);
|
||||||
|
*group_db = point; //在函数外面释放
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
|
@ -27,7 +27,7 @@ VPATH = ../user/user_manager/ ../../Platform/user/configm/config-server/user_man
|
||||||
|
|
||||||
# set the source file, don't used .o because of ...
|
# set the source file, don't used .o because of ...
|
||||||
|
|
||||||
COMMON_SRCS = usermanager-test/test_usermanager.c user_account_config.c user_group_config.c usermanager-server/array_index.c usermanager-server/user_group.c \
|
COMMON_SRCS = usermanager-test/test_usermanager.c user_recover_config.c user_account_config.c user_group_config.c usermanager-server/array_index.c usermanager-server/user_group.c \
|
||||||
usermanager-server/user_mod.c usermanager-server/user.c
|
usermanager-server/user_mod.c usermanager-server/user.c
|
||||||
|
|
||||||
# MRS Board Source Files
|
# MRS Board Source Files
|
||||||
|
|
|
@ -10,12 +10,13 @@
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
#include "user_account_config.h"
|
#include "user_account_config.h"
|
||||||
#include "user_group_config.h"
|
#include "user_group_config.h"
|
||||||
|
#include "user_recover_config.h"
|
||||||
#include "user_auth.h"
|
#include "user_auth.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "redisMq.h"
|
#include "redisMq.h"
|
||||||
|
|
||||||
extern USERGROUP g_group_table[GROUP_INDEX_MAX];
|
extern USERGROUP g_group_table[];
|
||||||
extern USERACCOUNT g_user_table[USER_INDEX_MAX];
|
extern USERACCOUNT g_user_table[];
|
||||||
|
|
||||||
// int main1(void)
|
// int main1(void)
|
||||||
// {
|
// {
|
||||||
|
@ -123,8 +124,18 @@ extern USERACCOUNT g_user_table[USER_INDEX_MAX];
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
|
{
|
||||||
|
char * testrec;
|
||||||
|
int testnum;
|
||||||
|
userecover_config_get_all(CONFIG_FROM_RECOVER1,testrec, &testnum);
|
||||||
|
|
||||||
|
printf("hello. \n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main1(void)
|
||||||
{
|
{
|
||||||
char * testin; //input
|
char * testin; //input
|
||||||
char testout[2000]; //output
|
char testout[2000]; //output
|
||||||
|
|
Loading…
Reference in New Issue