📄 oper_login.c
字号:
/*
* 系统柜员签到
*
*/
#include <stdio.h>
#include <curses.h>
#include <sys/types.h>
#include <time.h>
#include <sys/timeb.h>
#include "db_struct_c.h"
#include "new_monitor.h"
#include "tool.h"
#include "all.h"
#include "color.h"
#define TRYS 3
extern int DispLogo();
extern char G_oper_no[7]; /* 操作员代码 */
extern char G_oper_pwd[9]; /* 操作员口令 */
extern char G_oper_name[11]; /* 操作员名称 */
extern char G_role_code[4]; /* 操作员角色码 */
extern char G_purview[257]; /* 角色权限 */
extern char G_bankid[12]; /* 所属行行号 */
/*
* 系统操作员注册
*/
int OperLogin()
{
/*
* 显示LOGO图
*/
wattron( stdscr, GREEN_BLACK );
DispLogo();
wattroff( stdscr, GREEN_BLACK );
/*
* 显示版本logo画面并注册
*/
VersionLogin(A_NORMAL, "中国新一代", "银 行 卡 勾 对 系 统", "(BCS 1.0版)","北京亚大通讯网络有限责任公司");
}
/*
* 显示软件版本信息,并进行操作员注册
* 主要由BTS_ADM、CMS_ADM、settle中的OperLogin()调用
*/
VersionLogin(svattr, title1, title2, verno, group)
short svattr;
char *title1;
char *title2;
char *verno;
char *group;
{
int ret;
int operator_login(); /* 函数在client_login.c中,主要有获取行号和审计功能*/
ret = version_disp(svattr, title1, title2, verno, group, operator_login);
return(ret);
}
/*
* 操作员注册处理。VersionLogin()中调用。
*/
int operator_login(win, row, col)
WINDOW *win;
int row;
int col;
{
int i,p;
char sql_str[150];
char failtimes = 0, ch;
char pwd_bak[7];
WINDOW *prompt_w;
int ret = 0;
alarm(0);
/*
* 屏幕最后一行作为提示区
*/
prompt_w = newwin(1, 60, LINES-1, 10);
set_prompt( PROMPT_OFF );
touchwin(win);
/*
* 操作员及密码输入错误允许最多三(TRYS)次
*/
while ( failtimes++ < TRYS ) {
mvwprintw(win, row, col, "中心操作员 [ ]");
mvwprintw(win, row+1, col, "操作员密码 [ ]");
wrefresh(win);
memset( G_oper_no, ' ', 6 );
memset( G_oper_pwd, ' ', 6 );
ch = input_item(win, "", row, col+12, G_oper_no, 6, NULL, NULL, 0, 0);
if (ch != ENTER) {
delwin(prompt_w);
return(-1);
}
DelSpace(G_oper_no);
if (!strcmp(G_oper_no, "99")) { /* 操作码输入99,则退出 */
delwin(prompt_w);
return(-1);
}
ch = input_item(win, "", row+1, col+12, G_oper_pwd, 6, NULL, NULL, 2, 0);
if (ch != ENTER) {
delwin(prompt_w);
return(-1);
}
strcpy(pwd_bak, G_oper_pwd);
DelSpace(G_oper_pwd);
/*
* 转换加密密码字串
*/
cy_oper(G_oper_pwd);
sprintf(sql_str,"select count(*) from center_oper where oper_no = \'%s\' and oper_pwd = \'%s\' and use_flag = \'Y\' ",
G_oper_no, G_oper_pwd);
if ( query_count(sql_str) == 0 ) {
clear_wline( prompt_w, 0 );
h_winprompt(prompt_w, 0, 2, "注册失败!", 0, 0 );
continue;
}
/*
* 取出登录操作员名, 以作后用
*/
if (get_cen_oper_name(G_oper_no, G_oper_name) < 0) {
clear_wline( prompt_w, 0 );
h_winprompt( prompt_w, 0, 2, "操作员名获取时出错!", 0, 0 );
continue;
}
/*
* 取出所属行行号, 以作后用
*/
/*
if (get_cen_oper_bankid(G_oper_no, G_bankid) < 0) {
clear_wline( prompt_w, 0 );
h_winprompt( prompt_w, 0, 2, "获取所属行行号时出错!", 0, 0 );
continue;
}
*/
/*
* 取出登录操作员所属角色、权限,以作后用
*/
if (get_role_purview(G_oper_no, G_role_code, G_purview) < 0) {
clear_wline( prompt_w, 0 );
h_winprompt( prompt_w, 0, 2, "操作员所属的角色及操作权限无法获取!", 0, 0 );
continue;
}
/*
* 菜单权限解析。在dbprg/power.ec中
*/
if (init_power(G_oper_no)) {
clear_wline( prompt_w, 0 );
h_winprompt(prompt_w, 0, 2, "权限解析失败!", 0, 0 );
continue;
}
if (misc_audit("登录", prompt_w, 0, 2))
continue;
sprintf(sql_str,
"update center_oper set log_stat = \'I\' where oper_no = \'%s\'",G_oper_no);
sql_run(sql_str);
break;
};
delwin(prompt_w);
if ( failtimes > TRYS )
return(-1);
return(0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -