stoneage8.5/石器时代8.5客户端最新源代码/石器源码/system/onlinegm.cpp

2023 lines
63 KiB
C++
Raw Permalink Normal View History

2020-06-23 15:53:23 +08:00
//cyg 实作第一个系统 (线上回报系统)
2020-06-23 15:27:59 +08:00
#include"../systeminc/version.h"
#include"../systeminc/system.h"
#include"../systeminc/loadrealbin.h"
#include"../systeminc/loadsprbin.h"
#include"../systeminc/anim_tbl.h"
#include"../systeminc/login.h"
#include"../systeminc/menu.h"
#include"../systeminc/map.h"
#include"../systeminc/lssproto_cli.h"
#include"../systeminc/pc.h"
#include"../systeminc/netmain.h"
#include"../systeminc/handletime.h"
#include"../systeminc/character.h"
#include"../other/caryIme.h"
#include"../systeminc/ime_sa.h"
#include"../systeminc/t_music.h"
#include"../systeminc/netproc.h"
#include"../systeminc/tool.h"
#include "time.h"
#include "../wgs/descrypt.h"
#include"../systeminc/onlinegm.h"
char ProblemClass[DEF_CLASS_TOTAL][16]={
2020-06-23 15:53:23 +08:00
"异常问题",
"一般问题"
2020-06-23 15:27:59 +08:00
};
char ProblemC1[DEF_C1_TOTAL][30]={
2020-06-23 15:53:23 +08:00
"卡人卡石",
"网页指正",
"客服产品活动",
"安装与更新",
"会员帐号",
"产品序号",
"赠品序号",
"游戏点数卡购买及储值",
"包月相关",
"超级/炫风来吉卡/周边商品",
"服务器/连线/网路状况反应",
"游戏操作询问",
"非法检举投拆",
"其他"
2020-06-23 15:27:59 +08:00
};
char ProblemC1Help[DEF_C1_TOTAL][60]={
2020-06-23 15:53:23 +08:00
"请注明异常帐号、座标、地点、错误讯息、星系",
"请提供相关连结",
"请先查询游戏专属网站以及过往客服公告",
"请尽量留下您的电脑配备",
"请详述遇到的状况",
"请提供完整的序号",
"请提供完整的序号",
"登入游戏发现扣点不正常,请改选择问题类别为(游戏扣点问题)",
2020-06-23 15:27:59 +08:00
"",
2020-06-23 15:53:23 +08:00
"请先查询专属网页相关活动",
2020-06-23 15:27:59 +08:00
"",
2020-06-23 15:53:23 +08:00
"请先查询网页FAQ",
2020-06-23 15:27:59 +08:00
"",
""
};
char ProblemC2[DEF_C2_TOTAL][16]={
2020-06-23 15:53:23 +08:00
"人物异常",
"道具异常",
"宠物异常",
"交易问题",
"疑似盗用",
"家族问题",
"宠物&道具问题",
"WGS扣点问题",
"其他",
"会员升级",
"星系移民",
2020-06-23 15:27:59 +08:00
};
2020-06-23 15:53:23 +08:00
//人物异常
2020-06-23 15:27:59 +08:00
char ProblemC2_1[3][16]={
2020-06-23 15:53:23 +08:00
"人物消失",
"人物资料异常",
"其他"
2020-06-23 15:27:59 +08:00
};
2020-06-23 15:53:23 +08:00
//道具异常
2020-06-23 15:27:59 +08:00
char ProblemC2_2[3][16]={
2020-06-23 15:53:23 +08:00
"道具消失",
"其他",
"道具功能异常"
2020-06-23 15:27:59 +08:00
};
2020-06-23 15:53:23 +08:00
//宠物异常
2020-06-23 15:27:59 +08:00
char ProblemC2_3[5][16]={
2020-06-23 15:53:23 +08:00
"宠物消失",
"宠物邮件问题",
"溜宠问题",
"宠物蛋问题",
"其他"
2020-06-23 15:27:59 +08:00
};
2020-06-23 15:53:23 +08:00
//交易问题
2020-06-23 15:27:59 +08:00
char ProblemC2_4[2][16]={
2020-06-23 15:53:23 +08:00
"交易后消失",
"其他"
2020-06-23 15:27:59 +08:00
};
2020-06-23 15:53:23 +08:00
//疑似盗用
2020-06-23 15:27:59 +08:00
char ProblemC2_5[2][16]={
2020-06-23 15:53:23 +08:00
"疑似盗用查询",
"其他"
2020-06-23 15:27:59 +08:00
};
2020-06-23 15:53:23 +08:00
//家族问题
2020-06-23 15:27:59 +08:00
char ProblemC2_6[3][16]={
2020-06-23 15:53:23 +08:00
"家族被解散",
"声望异常",
"其他"
2020-06-23 15:27:59 +08:00
};
2020-06-23 15:53:23 +08:00
//星系移民
2020-06-23 15:27:59 +08:00
char ProblemC2_7[3][16]={
2020-06-23 15:53:23 +08:00
"道具消失",
"人物消失",
"其他"
2020-06-23 15:27:59 +08:00
};
2020-06-23 15:53:23 +08:00
//HELP中使用到的页资料结构
2020-06-23 15:27:59 +08:00
typedef struct PAGE{
2020-06-23 15:53:23 +08:00
short desc_index; //说明结构开始的索引号(此desc_index为根据seg_index在help_index取得DESC的阵列的index)
int desc_num;//BYTE desc_num; //说明的结构数
2020-06-23 15:27:59 +08:00
}*LPPAGE;
2020-06-23 15:53:23 +08:00
//注意事项
//HELP中使用到说明的文字资料结构
2020-06-23 15:27:59 +08:00
typedef struct DESC{
2020-06-23 15:53:23 +08:00
BYTE color; //颜色
char description[60]; //说明文字
2020-06-23 15:27:59 +08:00
}*LPDESC;
2020-06-23 15:53:23 +08:00
// 问题参数储存结构 cyg
2020-06-23 15:27:59 +08:00
typedef struct{
char no[20];
char state[40];
char okdate[10];
int okH;
char wrongdate[10];
int wrongH;
int class0;
char class1[40];
char cont[4000];
char answer[4000];
char error[2000];
BOOL delflag;
}PRODATA;
DESC Prohelp_desc1[]={
2020-06-23 15:53:23 +08:00
//颜色与说明 //fix
{ 4 , "1. 使用说明"},
{ 0 , " 线上留单上限为20笔若已达上限须先将旧有问题单删除才能"},
{ 0 , " 继续留单或至网页留单。异常问题须输入正常日期与错误日期。"},
{ 0 , " ※ 最新问题单会显示在最上方。"},
{ 4 , "2. 宠物蛋异常"},
{ 0 , " 于2003/12/31日服务器更新时己放置修正宠物蛋设定的程式"},
{ 0 , " ,即日起客服中心将不再受理玩家宠物蛋能力异常的情况,修正"},
{ 0 , " 后的宠物蛋设定如下:"},
{ 0 , " ※ 人物在线上喂养设定和以往一样,超过一小时会有能力下"},
{ 0 , " 降的情况。人物离线或宠物蛋放置在宠店中,再次登入会"},
{ 0 , " 重新计算喂养的时间。"},
{ 4 , "3. 溜宠消失"},
{ 0 , " 游戏程式设定己可在同一颗服务器内,与萨村门口的[工程人员]"},
2020-06-23 15:27:59 +08:00
};
DESC Prohelp_desc2[]={
2020-06-23 15:53:23 +08:00
{ 0 , " 取回;如无法领取请提供以下资料宠物名称、等级、宠物原持有"},
{ 0 , " 帐号、宠物持有日期、宠物消失日期。"},
{ 4 , "4. 宠邮消失"},
{ 0 , " 游戏程式设定己可在同一颗服务器内,与萨村门口的[工程人员]"},
{ 0 , " 取回;如无法领取请提供以下资料宠物名称、等级、宠物原持有"},
{ 0 , " 帐号、宠物持有日期、宠物消失日期。"},
//{ 4 , "4. 宠物战斗脱逃-无法处理"},
//{ 0 , " 宠物的忠诚度低于20以下在战斗中就会跑走。此为原游戏设定"},
//{ 0 , " ,客服中心不受理回覆宠物。"},
{ 4 , "5. 交易后物品消失-请提供以下资料"},
{ 0 , " 交易方的帐号或人物名称、交易日期、交易的宠物名称以及等级"},
{ 0 , " 、道具名称以及数量。"},
{ 4 , "6. 宠物或道具卖给NPC-无法处理"},
{ 0 , " 此为原游戏设定,客服中心不受理回覆宠物或道具。"},
{ 4 , "7. 宠物或道具丢出后被系统清除-无法处理"},
{ 0 , " 此为原游戏设定,客服中心不受理回覆宠物或道具;玩家可在游"},
2020-06-23 15:27:59 +08:00
};
DESC Prohelp_desc3[]={
2020-06-23 15:53:23 +08:00
{ 0 , " 戏中透过交易介面转移。"},
{ 4 , "8. 家族异常-请提供以下资料"},
{ 0 , " 家族异常请族长本人帐号留单,注明家族名称、家族编号、异常"},
{ 0 , " 状况。如因为家族人数不足,系统自动解散的家族,连同家族银"},
{ 0 , " 行存款客服中心无法受理。"},
{ 0 , " ※ 对于家族解散与成员因过久未上线而自动退出家族设定,系"},
{ 0 , " 统每天会不定时的扫描、侦测。"},
{ 0 , " ※ 目前家族成员设定在退出后7日内无法再加入家族。"},
{ 4 , "9. 人物DP异常-无法处理 "},
{ 0 , " 由于DP对于游戏中并不会有影响并无开放此功能供玩家查询。"},
{ 4 , "10. 人物名片消失-无法处理"},
{ 0 , " 由于名片的对应会有一对多的情况(一个人物拥有多位玩家的名"},
{ 0 , " 片),若单方面仅处理一名玩家并无法使资料正确,并无开放此"},
2020-06-23 15:27:59 +08:00
};
DESC Prohelp_desc4[]={
2020-06-23 15:53:23 +08:00
{ 0 , " 功能供玩家查询。"},
{ 4 , "11. 盗用&诈骗案件-请提供以下资料"},
{ 0 , " 宠物名称、等级以及道具名称、数量、疑似盗用日期 工程人员"},
{ 0 , " 可查询人物删除纪录,需请玩家不要创立新人物以便回覆空人物"},
{ 0 , " (没有宠物、道具以及石币)。 工程人员仅以玩家提供之道具、"},
{ 0 , " 宠物进行查询的动作。"},
{ 4 , "12. 朱雀转生设定 2003/06/21"},
{ 0 , " 活动赠送之朱雀能力值,于转生后仍有小幅成长空间,但原能力"},
{ 0 , " 值部份不一定能维持转生前高点,在此提醒玩家要转生朱雀时,"},
{ 0 , " 请多加考虑。客服中心不受理回覆转生前朱雀之留单案件。"},
2020-06-23 15:27:59 +08:00
};
//DESC Prohelp_desc5[]={
//};
LPDESC Prohelp_Index[] ={
&Prohelp_desc1[0],
&Prohelp_desc2[0],
&Prohelp_desc3[0],
&Prohelp_desc4[0]
// &Prohelp_desc5[0]
};
PAGE ProHelp_page[]={
{ 0 , sizeof(Prohelp_desc1)/sizeof(Prohelp_desc1[0])},
{ 0 , sizeof(Prohelp_desc2)/sizeof(Prohelp_desc2[0])},
{ 0 , sizeof(Prohelp_desc3)/sizeof(Prohelp_desc3[0])},
{ 0 , sizeof(Prohelp_desc4)/sizeof(Prohelp_desc4[0])}
// { 0 , sizeof(Prohelp_desc5)/sizeof(Prohelp_desc5[0])}
};
2020-06-23 15:53:23 +08:00
INPUT_HISTORY InputHistory ; // 用来记忆每一行的内容,往后才能拿来索引
2020-06-23 15:27:59 +08:00
2020-06-23 15:53:23 +08:00
STR_BUFFER SubBuffer ; // 每一行储存的buf
2020-06-23 15:27:59 +08:00
2020-06-23 15:53:23 +08:00
#ifdef __ONLINEGM // 全关掉
2020-06-23 15:27:59 +08:00
2020-06-23 15:53:23 +08:00
char DataBuffer[500]; // 储存组合好的问题回报一连串的参数
char InputBuffer[8050]; // 储存玩家的输入内容
char ContentBuf[8050]; // 储存组合好的问题内容
2020-06-23 15:27:59 +08:00
2020-06-23 15:53:23 +08:00
PRODATA Prodata[100]; // 假设玩家最多可以建100笔
2020-06-23 15:27:59 +08:00
int PutKey,PushKey ;
2020-06-23 15:53:23 +08:00
int ProNoSelect; // 现在正选择的单号索引
int HistorySelect; // 上次选择查询的单号索引
BOOL ProNoSelectFlag; // 有没有选单号的旗标
int ProNoIndex; // 用来秀问题单号
int ProNoValue; // 表示有几笔问题单号
2020-06-23 15:27:59 +08:00
BOOL TitleFlag ;
2020-06-23 15:53:23 +08:00
int SegmentIndex ; // 一段一段内容的索引
int SegmentTotal ; // 纪录总共有几段
char SegmentBuf[2][2500];// 纪录某笔单号的内容和客服回应
2020-06-23 15:27:59 +08:00
int okY,okM,okD,okH,wrongY,wrongM,wrongD,wrongH;
2020-06-23 15:53:23 +08:00
int ClassIndex , ClassIndex1 , ClassIndex2 ; // 问题类别索引
2020-06-23 15:27:59 +08:00
2020-06-23 15:53:23 +08:00
BOOL DeleteBtnFlag; //要有选到某单号才能删除的旗标
2020-06-23 15:27:59 +08:00
2020-06-23 15:53:23 +08:00
//OnlineGm 的Log 专用区 Begin
2020-06-23 15:27:59 +08:00
#ifdef _STONDEBUG_
char inlogstr[512];
#define filename "onlinegm.log"
#endif
2020-06-23 15:53:23 +08:00
//OnlineGm 的Log 专用区 End
2020-06-23 15:27:59 +08:00
2020-06-23 15:53:23 +08:00
//线回系统 测试Server IP : 10.1.0.17
2020-06-23 15:27:59 +08:00
BOOL QueryOnlineGmIP(char HostName[]);
2020-06-23 15:53:23 +08:00
char *OnlineGmIP; //使用domain name
//char OnlineGmIP[20]; //使用直接ip
2020-06-23 15:27:59 +08:00
#define SMSDomainName "ingame.wayi.com.tw"//"sms.hwaei.com.tw"
2020-06-23 15:53:23 +08:00
int ResultCode; // 传输产生的侦错码
2020-06-23 15:27:59 +08:00
static char *pContent=NULL;
BOOL ResetFlag = TRUE;
BOOL DirFlag = TRUE;
DWORD LastTime = 0;
2020-06-23 15:53:23 +08:00
int iReturnNo; //纪录回传的单号
2020-06-23 15:27:59 +08:00
2020-06-23 15:53:23 +08:00
int TotalAddValue; //纪录玩家目前留单总数
2020-06-23 15:27:59 +08:00
2020-06-23 15:53:23 +08:00
int ProblemType ; //纪录按传送键时问题单的类型 一般0异常1
int SendType ; //纪录传送给server前的问题类型
2020-06-23 15:27:59 +08:00
2020-06-23 15:53:23 +08:00
unsigned int ichecklooptime = 0; //检查连线回圈时间
2020-06-23 15:27:59 +08:00
//*************************************
2020-06-23 15:53:23 +08:00
// 初始资料
2020-06-23 15:27:59 +08:00
//*************************************
void InitOnlineGm( void )
{
int i;
PutKey = 0;
PushKey = 0;
ProNoSelectFlag = FALSE;
ProNoSelect = 0;
2020-06-23 15:53:23 +08:00
HistorySelect = 5000; //无意义 区别用
2020-06-23 15:27:59 +08:00
ProNoIndex = 0;
ProNoValue = 0;
SegmentIndex =0;
SegmentTotal = 0;
okY=okM=okD=okH=wrongY=wrongM=wrongD=wrongH=0;
ClassIndex = 1;
ClassIndex1 = ClassIndex2 =0;
ResetFlag = TRUE ;
DirFlag = TRUE ;
DeleteBtnFlag = FALSE ;
DataBuffer[0] = '\0';
InputBuffer[0] = '\0';
ContentBuf[0] = '\0';
SegmentBuf[0][0]='\0';
SegmentBuf[1][0]='\0';
for( i=0;i<DEF_MAX_ADD_VALUE;i++){
Prodata[i].no[0] = '\0';
Prodata[i].state[0] = '\0';
Prodata[i].okdate[0] = '\0';
Prodata[i].okH = 0;
Prodata[i].wrongdate[0] = '\0';
Prodata[i].wrongH = 0;
Prodata[i].class0 = 0;
Prodata[i].class1[0] = '\0';
Prodata[i].cont[0] = '\0';
Prodata[i].answer[0] = '\0';
Prodata[i].error[0] = '\0';
Prodata[i].delflag = FALSE;
}
LastTime = 0;
iReturnNo = 0;
TotalAddValue = 0;
ProblemType = 0;
SendType = 0;
}
//************************************************
2020-06-23 15:53:23 +08:00
//函式 : 产生Log档(于Local端目录下)的专用函式
//回传值 : None
//附 注 : 只有Debug mode才在硬碟写入log档!!
2020-06-23 15:27:59 +08:00
//************************************************
#ifdef _STONDEBUG_
void WriteInLog( char cData[], char cFile[])
{
char totals[65536];//[1024];
struct tm nowTime;
time_t longTime;
time( &longTime );
localtime_s(&nowTime, &longTime );
sprintf_s(totals,"%02d/%02d/%02d %02d:%02d:%02d ",(nowTime.tm_year % 100), nowTime.tm_mon+1, nowTime.tm_mday,
nowTime.tm_hour, nowTime.tm_min, nowTime.tm_sec);
lstrcat(totals,cData);
lstrcat(totals,"\r\n\r\n\r\n");
FILE *fp;
fp = fopen(filename, "a" );
if(fp)
{
fprintf(fp,totals);
fclose(fp);
}
}
#endif
//************************************************
2020-06-23 15:53:23 +08:00
//函式一 : 处理主程式与ASP间沟通的专用函式
//回传值 : 0 --- 处理完毕 & 问题回报成功
// 1 --- 问题回报发送失败
// 2 --- 手机号码参数错误(时间或类别错误)
// 3 --- 手机讯息参数错误(过长)
// 4 --- 网路端错误
// 5 --- WGS点数(或通数)已不足!!(小于五点)
// 6 --- 连线逾时(或DNS失败)
// 7 --- ASP回传错误
2020-06-23 15:27:59 +08:00
//************************************************
2020-06-23 15:53:23 +08:00
// pid:id ppw:password pdb:内部资料 pinput:玩家输入的内容
2020-06-23 15:27:59 +08:00
int SendProblemMsg(char pid[16], char ppw[16], char pdb[] , char pinput[])
{
2020-06-23 15:53:23 +08:00
char returndata[20] ; //纪录回传的字串
2020-06-23 15:27:59 +08:00
int nRet,wait=1;
if(!QueryOnlineGmIP(SMSDomainName)) return 6;
//if((pdb[0] =='\0') || (lstrlen(pdb) != 23)) return 2;
//if(lstrlen(pc.name)>16) return 3;
#ifdef _FIX_URLENCODE
char OutTmp[8000];
char *pOutTmp ;
char *pInTmp ;
char Hex[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
// do encoding
pInTmp=pinput;
pOutTmp=OutTmp;
while (*pInTmp)
{
if ( (*pInTmp>= '0') && (*pInTmp <= '9')
|| (*pInTmp>= 'a') && (*pInTmp <= 'z')
|| (*pInTmp>= 'A') && (*pInTmp <= 'Z')
)
*pOutTmp++ = *pInTmp;
else
{
if(*pInTmp==0x20&&(!IsDBCSLeadByte(*pInTmp)))
*pOutTmp++ = '+';
else
{
*pOutTmp++ = '%';
*pOutTmp++ = Hex[(*pInTmp>>4)&0x0f];
*pOutTmp++ = Hex[(*pInTmp)&0x0f];
}
}
pInTmp++;
}
*pOutTmp = '\0';
sprintf_s(pinput,8050,"&qcontent=%s",OutTmp);
#endif
SOCKET hSock;
SOCKADDR_IN stName;
fd_set rfds,wfds;
timeval tmTimeOut;
char *result;
int len, cnt, ret ;
tmTimeOut.tv_usec=0;
tmTimeOut.tv_sec=5;
if( INVALID_SOCKET != ( hSock = socket( AF_INET, SOCK_STREAM, 0) ) )
{
DWORD flg = 1;
if( SOCKET_ERROR != ioctlsocket( hSock, FIONBIO, &flg))
{
ZeroMemory( &stName, sizeof(struct sockaddr));
stName.sin_family = PF_INET;
stName.sin_port = htons(80);
stName.sin_addr.s_addr = inet_addr(OnlineGmIP);
ret = connect( hSock, (LPSOCKADDR)&stName, sizeof(struct sockaddr) );
if( SOCKET_ERROR != ret || WSAEWOULDBLOCK == WSAGetLastError() )
{
cnt = 0;
char buf[3000];
if(ProblemType==0){
2020-06-23 15:53:23 +08:00
SendType=0; //一般问题
2020-06-23 15:27:59 +08:00
sprintf_s(buf,"GET //normal_check.asp?wgsid=%s&gamepwd=%s&game=1%s%s",pid,ppw,pdb,pinput);
}else{
2020-06-23 15:53:23 +08:00
SendType=1; //异常问题
2020-06-23 15:27:59 +08:00
sprintf_s(buf,"GET //handle_check.asp?wgsid=%s&gamepwd=%s&game=1%s%s",pid,ppw,pdb,pinput);
}
strcat_s(buf," HTTP/1.1\r\nAccept: text/*\r\nUser-Agent: StoneAge\r\n");
sprintf_s(buf,"%sHost: %s\r\n\r\n",buf,OnlineGmIP);
2020-06-23 15:53:23 +08:00
#ifdef _STONDEBUG_ //写入onlinegm.log
2020-06-23 15:27:59 +08:00
WriteInLog( buf , filename);
#endif
len = lstrlen(buf);
ichecklooptime = TimeGetTime();
while(1)
{
FD_ZERO( &wfds);
FD_SET( hSock, &wfds);
nRet = select( NULL, (fd_set*)NULL, &wfds, (fd_set*)NULL, &tmTimeOut);
if(nRet == SOCKET_ERROR||nRet==-1){
closesocket(hSock);
return 4;
}else if(nRet == 0){
closesocket(hSock);
return 8;
}
if( FD_ISSET( hSock, &wfds) ){
ret = send( hSock, &buf[cnt], len, 0);
cnt += ret;
len -= ret;
if(len<1) break; //ok
}
if( TimeGetTime() - ichecklooptime > 3000 ){
closesocket(hSock);
return 8;
}
}
Sleep(500);
len = (InputHistory.newNo*70)+500 ; //1024;
cnt = 0;
ichecklooptime = TimeGetTime();
while(1)
{
if(wait>=3){
closesocket(hSock);
return 8;
}
FD_ZERO( &rfds);
FD_SET( hSock, &rfds);
select( NULL, &rfds, (fd_set*)NULL, (fd_set*)NULL, &tmTimeOut);
if(nRet == SOCKET_ERROR||nRet==-1){
closesocket(hSock);
return 4;
}
if(nRet == 0){
wait++;
continue;
}
if( FD_ISSET( hSock, &rfds) ){
ret = recv( hSock, &buf[cnt], len, 0);
if(ret<0){
closesocket(hSock);
return 4;
}
}
buf[cnt+ret] = 0;
result = strstr( buf, "\r\n\r\n") + 4;
getStringToken(result ,',',1,sizeof(returndata)-1,returndata);
2020-06-23 15:53:23 +08:00
if(atoi(returndata)!=1){ //如果回传负数表示有误1表示ok
2020-06-23 15:27:59 +08:00
closesocket(hSock);
return atoi(returndata);
}else{
getStringToken(result ,':',2,sizeof(returndata)-1,returndata);
2020-06-23 15:53:23 +08:00
iReturnNo = atoi(returndata); //读出单号
2020-06-23 15:27:59 +08:00
}
if(result) break;
cnt += ret;
len -= ret;
if( TimeGetTime() > ichecklooptime + 3000 ){
closesocket(hSock);
return 8;
}
}
}else{
closesocket(hSock);
return 6;
}
}
closesocket(hSock);
return 1;
}
return 4;
}
//************************************************
2020-06-23 15:53:23 +08:00
// 传送要删除单号的主程式
// 回传值 :0 --- 处理完毕 & 问题删除成功
// 3 --- 参数传递错误
// 4 --- 网路端错误
// 6 --- 连线逾时(或DNS失败)
2020-06-23 15:27:59 +08:00
//************************************************
int SendDeleteMsg(char pid[16], char ppw[16] , char pno[16] )
{
int nRet;
if(!QueryOnlineGmIP(SMSDomainName)) return 6;
int ret,len,cnt,icheck,wait=1;
SOCKET hSock;
SOCKADDR_IN stName;
fd_set rfds,wfds;
timeval tmTimeOut;
char *result;
tmTimeOut.tv_usec=0;
tmTimeOut.tv_sec=5;
if( INVALID_SOCKET != ( hSock = socket( AF_INET, SOCK_STREAM, 0) ) )
{
DWORD flg = 1;
if( SOCKET_ERROR != ioctlsocket( hSock, FIONBIO, &flg))
{
ZeroMemory( &stName, sizeof(struct sockaddr));
stName.sin_family = PF_INET;
stName.sin_port = htons(80);
stName.sin_addr.s_addr = inet_addr(OnlineGmIP);
ret = connect( hSock, (LPSOCKADDR)&stName, sizeof(struct sockaddr) );
if( SOCKET_ERROR != ret || WSAEWOULDBLOCK == WSAGetLastError() )
{
cnt = 0;
char buf[1024];
sprintf_s(buf,"GET //DelForm.asp?wgsid=%s&gamepwd=%s&rcount=1&idno=%s",pid,ppw,pno);
strcat_s(buf," HTTP/1.1\r\nAccept: text/*\r\nUser-Agent: StoneAge\r\n");
sprintf_s(buf,"%sHost: %s\r\n\r\n",buf,OnlineGmIP);
len = lstrlen(buf);
ichecklooptime = TimeGetTime();
while(1)
{
FD_ZERO( &wfds);
FD_SET( hSock, &wfds);
nRet = select( NULL, (fd_set*)NULL, &wfds, (fd_set*)NULL, &tmTimeOut);
if(nRet == SOCKET_ERROR||nRet==-1){
closesocket(hSock);
return 4;
}else if(nRet == 0){
closesocket(hSock);
return 8;
}
if( FD_ISSET( hSock, &wfds) ){
ret = send( hSock, &buf[cnt], len, 0);
cnt += ret;
len -= ret;
if(len<1) break; //ok
}
if( TimeGetTime() > ichecklooptime + 3000 ){
closesocket(hSock);
return 8;
}
}
Sleep(500);
len = 1024;
cnt = 0;
ichecklooptime = TimeGetTime();
while(1)
{
if(wait>=3){
closesocket(hSock);
return 8;
}
FD_ZERO( &rfds);
FD_SET( hSock, &rfds);
nRet = select( NULL, &rfds, (fd_set*)NULL, (fd_set*)NULL, &tmTimeOut);
if(nRet == SOCKET_ERROR||nRet==-1){
closesocket(hSock);
return 4;
}
if(nRet == 0){
wait++;
continue;
}
if( FD_ISSET( hSock, &rfds) ){
ret = recv( hSock, &buf[cnt], len, 0);
if(ret<0){
closesocket(hSock);
return 4;
}
buf[cnt+ret] = 0;
result = strstr( buf, "\r\n\r\n") + 4;
char *sss;
strtok_s(result,",",&sss);
icheck=atoi(result);
if(icheck != 1){
closesocket(hSock);
return icheck;
}
if(result) break;
cnt += ret;
len -= ret;
}
if( TimeGetTime() > ichecklooptime + 3000 ){
closesocket(hSock);
return 8;
}
}
}else{
closesocket(hSock);
return 6;
}
}
closesocket(hSock);
return 1 ;
}
return 4 ;
}
//************************************************
2020-06-23 15:53:23 +08:00
// 向Server要玩家的问题单所有内容
// 回传值 0: 正确无误
// 2: 玩家无任何问题单
// 4: 网路端错误
// 6: 连线逾时(或DNS失败)
2020-06-23 15:27:59 +08:00
//************************************************
int SendDirMsg(char pid[16], char ppw[16] )
{
if(!QueryOnlineGmIP(SMSDomainName)) return 6;
int nRet,i=1;
int wait=1,j=1;
2020-06-23 15:53:23 +08:00
char alldata[65536],getdata[6000],perdata[3000],statedata[100]; //全部的,每笔,每栏,处理状态
2020-06-23 15:27:59 +08:00
char returndata[20] ;
BOOL Okflag = FALSE , Firstflag = TRUE;
#ifdef _STONDEBUG_
char logbuf[50];
#endif
int ret,len,cnt;
SOCKET hSock;
SOCKADDR_IN stName;
fd_set rfds,wfds;
timeval tmTimeOut;
char *result;
tmTimeOut.tv_usec=0;
tmTimeOut.tv_sec=5;
memset(alldata,0,sizeof(alldata));
if( INVALID_SOCKET != ( hSock = socket( AF_INET, SOCK_STREAM, 0) ) )
{
DWORD flg = 1;
if( SOCKET_ERROR != ioctlsocket( hSock, FIONBIO, &flg))
{
ZeroMemory( &stName, sizeof(struct sockaddr));
stName.sin_family = PF_INET;
stName.sin_port = htons(80);
stName.sin_addr.s_addr = inet_addr(OnlineGmIP);
ret = connect( hSock, (LPSOCKADDR)&stName, sizeof(struct sockaddr) );
if( SOCKET_ERROR != ret || WSAEWOULDBLOCK == WSAGetLastError() )
{
cnt = 0;
char buf[65536];
sprintf_s(buf,"GET //userFormList.asp?wgsid=%s&gamepwd=%s",pid,ppw);
strcat_s(buf," HTTP/1.1\r\nAccept: text/*\r\nUser-Agent: StoneAge\r\n");
sprintf_s(buf,"%sHost: %s\r\n\r\n",buf,OnlineGmIP);
len = lstrlen(buf);
ichecklooptime = TimeGetTime();
while(1)
{
FD_ZERO( &wfds);
FD_SET( hSock, &wfds);
nRet = select( NULL, (fd_set*)NULL, &wfds, (fd_set*)NULL, &tmTimeOut);
if(nRet == SOCKET_ERROR||nRet==-1){
closesocket(hSock);
return -400;
}else if(nRet == 0){
closesocket(hSock);
return -800;
}
if( FD_ISSET( hSock, &wfds) ){
ret = send( hSock, &buf[cnt], len, 0);
cnt += ret;
len -= ret;
if(len<1) break; //ok
}
if( TimeGetTime() > ichecklooptime + 3000 ){
closesocket(hSock);
return -800;
}
}
Sleep(500);
len = 65536;//8000;
cnt = 0;
ichecklooptime = TimeGetTime();
while(1)
{
if(wait>=3){
closesocket(hSock);
return -800;
}
FD_ZERO( &rfds);
FD_SET( hSock, &rfds);
nRet = select( NULL, &rfds, (fd_set*)NULL, (fd_set*)NULL, &tmTimeOut);
if(nRet == SOCKET_ERROR||nRet==-1){
closesocket(hSock);
return -400;
}
if(nRet == 0){
wait++;
continue;
}
if( FD_ISSET( hSock, &rfds) ){
ret = recv( hSock, &buf[cnt], len, 0);
if(ret<0){
closesocket(hSock);
return -400;
}
buf[cnt+ret] = 0;
result = strstr( buf, "\r\n\r\n") + 4;
if(strcmp(result,"0")==0){
closesocket(hSock);
return -200;
}
strcpy(alldata,result);
cnt += ret;
len -= ret;
}
if(strstr(alldata,"&#")){ //ok
break;
}
if( TimeGetTime() > ichecklooptime + 3000 ){
closesocket(hSock);
return -800;
}
}
getStringToken(result ,',',1,sizeof(returndata)-1,returndata);
2020-06-23 15:53:23 +08:00
if(atoi(returndata)<0){ //如果回传负数表示有误大于0数子代表单子数量同时也表示ok
2020-06-23 15:27:59 +08:00
closesocket(hSock);
return atoi(returndata);
}else{
TotalAddValue = atoi(returndata);
}
result = alldata;
result = strstr( result , ",") + 1;
strcpy(alldata,result);
}else{
#ifdef _STONDEBUG_
sprintf_s(logbuf,"Get last error:%d",WSAGetLastError());
WriteInLog( logbuf , filename);
#endif
return -600;
}
}
closesocket(hSock);
ProNoValue = 0;
ProNoSelectFlag = FALSE;
2020-06-23 15:53:23 +08:00
#ifdef _STONDEBUG_ //写入onlinegm.log
2020-06-23 15:27:59 +08:00
WriteInLog( alldata , filename);
#endif
perdata[0] = '\0';
getdata[0] = '\0';
2020-06-23 15:53:23 +08:00
//sprintf_s(alldata,"21|测试|*|*|*|*|18|卡人卡石|亲爱的维护部阿俊您好谢谢您的用心与努力~感谢您的支持与爱护!也再次的预祝您修改愉快!顺心如意!|亲爱的维护部阿俊您好谢谢您的用心与努力~感谢您的支持与爱护!也再次的预祝您修改愉快!顺心如意!|&#");
2020-06-23 15:27:59 +08:00
while(getStringToken( alldata,'&',i,sizeof(getdata)-1,getdata)!=1){
while(getStringToken(getdata,'|',j,sizeof(perdata)-1,perdata)!=1){
if( strcmp( perdata , "*")){
switch(j){
case 1:sprintf_s(Prodata[ProNoValue].no,"%s",perdata); break;
case 2:
getStringToken(perdata,'>',2,sizeof(statedata)-1,statedata);
getStringToken(statedata,'<',1,sizeof(statedata)-1,statedata);
if(lstrlen(statedata) == NULL)
sprintf_s(Prodata[ProNoValue].state,"%s",perdata);
else
sprintf_s(Prodata[ProNoValue].state,"%s",statedata);
break;
case 3:sprintf_s(Prodata[ProNoValue].okdate,"%s",perdata);break;
case 4:Prodata[ProNoValue].okH=atoi(perdata); break;
case 5:sprintf_s(Prodata[ProNoValue].wrongdate,"%s",perdata);break;
case 6:Prodata[ProNoValue].wrongH=atoi(perdata); break;
case 7:Prodata[ProNoValue].class0=atoi(perdata);break;
case 8:sprintf_s(Prodata[ProNoValue].class1,"%s",perdata);break;
case 9:sprintf_s(Prodata[ProNoValue].cont,"%s",perdata);break;
case 10:sprintf_s(Prodata[ProNoValue].answer,"%s",perdata);break;
default: sprintf_s(Prodata[ProNoValue].error,"%s",perdata);break;
}
}
perdata[0] = '\0';
j++;
}
getdata[0] = '\0';
ProNoValue++;
j=1;
i++;
}
//TotalAddValue = ProNoValue;
return 1 ; // ok
}
return 4 ;
}
//************************************************
2020-06-23 15:53:23 +08:00
// 查询问题单的内容
2020-06-23 15:27:59 +08:00
//************************************************
void vReadContent( int pno )
{
static char *pRecv ;
char date[10];
char data[40];
char classbuf1[40],classbuf2[40];
int i=1;
ClassIndex=Prodata[pno].class0 - 18;
2020-06-23 15:53:23 +08:00
if(ClassIndex == 0 ){ //异常问题
2020-06-23 15:27:59 +08:00
while(getStringToken(Prodata[pno].okdate,'/',i,sizeof(date)-1,date)!=1){
if( i==1 ) okY = atoi(date);
else if( i==2) okM = atoi(date);
i ++;
}
okD = atoi(date);
okH = Prodata[pno].okH;
i = 1;
date[0] = '\0';
while(getStringToken(Prodata[pno].wrongdate,'/',i,sizeof(date)-1,date)!=1){
if( i==1 ) wrongY = atoi(date);
else if( i==2) wrongM = atoi(date);
i ++;
}
wrongD = atoi(date);
wrongH = Prodata[pno].wrongH;
}
if(getStringToken(Prodata[pno].class1,',',1,sizeof(data)-1,data)!=1){
sprintf_s(classbuf1,"%s",data);
data[0] = '\0';
if(getStringToken(Prodata[pno].class1,',',2,sizeof(data)-1,data)==1)
sprintf_s(classbuf2,"%s",data);
}else{
sprintf_s(classbuf1,"%s",data);
}
2020-06-23 15:53:23 +08:00
if(ClassIndex){ // 一般问题
2020-06-23 15:27:59 +08:00
for(i=0;i<DEF_C1_TOTAL;i++){
if(strcmp(ProblemC1[i],classbuf1)==NULL)
break;
}
ClassIndex1 = i;
2020-06-23 15:53:23 +08:00
}else{ // 异常问题
2020-06-23 15:27:59 +08:00
for(i=0;i<DEF_C2_TOTAL;i++){
if(strcmp(ProblemC2[i],classbuf1)==NULL)
break;
}
ClassIndex1 = i;
switch(ClassIndex1){
case 0: for(i=0;i<3;i++){
if(strcmp(ProblemC2_1[i],classbuf2)==NULL)
break;
}break;
case 1: for(i=0;i<3;i++){
if(strcmp(ProblemC2_2[i],classbuf2)==NULL)
break;
}break;
case 2: for(i=0;i<5;i++){
if(strcmp(ProblemC2_3[i],classbuf2)==NULL)
break;
}break;
case 3: for(i=0;i<2;i++){
if(strcmp(ProblemC2_4[i],classbuf2)==NULL)
break;
}break;
case 4: for(i=0;i<2;i++){
if(strcmp(ProblemC2_5[i],classbuf2)==NULL)
break;
}break;
case 5: for(i=0;i<3;i++){
if(strcmp(ProblemC2_6[i],classbuf2)==NULL)
break;
}break;
case 10:for(i=0;i<3;i++){
if(strcmp(ProblemC2_7[i],classbuf2)==NULL)
break;
}break;
default: i=0;
}
ClassIndex2=i;
}
if (lstrlen(Prodata[pno].cont)!=NULL){
sprintf_s(SegmentBuf[SegmentTotal],"%s",Prodata[pno].cont);
SegmentTotal++;
if(lstrlen(Prodata[pno].answer)!=NULL){
sprintf_s(SegmentBuf[SegmentTotal],"%s",Prodata[pno].answer);
SegmentTotal++;
}
}
}
//************************************************
2020-06-23 15:53:23 +08:00
//函式 : 资料输入栏位的初始化函式
//回传值 : None
2020-06-23 15:27:59 +08:00
//************************************************
void InitOnlineGmInput(int x, int y)
{
int i;
HistorySelect = 5000;
SubBuffer.buffer[0]='\0';
SubBuffer.x = x + 20;
SubBuffer.y = y + 400;
2020-06-23 15:53:23 +08:00
SubBuffer.len = 70; //字数
2020-06-23 15:27:59 +08:00
SubBuffer.color = FONT_PAL_AQUA;
SubBuffer.fontPrio = FONT_PRIO_FRONT;
2020-06-23 15:53:23 +08:00
SubBuffer.lineLen=70; //每行几个字
SubBuffer.lineDist=25; //行与行间隔几个pixel
2020-06-23 15:27:59 +08:00
InputHistory.newNo = 0;
InputHistory.nowNo = 0;
InputHistory.addNo = 0;
InputHistory.lockNo = 0;
for ( i=0;i<115;i++ )
{
InputHistory.str[i][0]='\0';
InputHistory.color[i]=FALSE;
}
int len = lstrlen(SubBuffer.buffer);
if(len){
SubBuffer.cursor = len;
SubBuffer.cnt= len;
}else{
SubBuffer.cnt=0;
SubBuffer.cursor=0;
}
TitleFlag = TRUE;
}
//************************************************
2020-06-23 15:53:23 +08:00
//函式 : 处理问题单号的主函式
//回传值 : None
2020-06-23 15:27:59 +08:00
//************************************************
void ShowProblemNo( int x, int y, int Key )
{
int i,k,word = 0;
int Keyid;
char buf[100]= "/0";
static int fontId[5];
static char *pChar ;
2020-06-23 15:53:23 +08:00
if (Key==1){ //上箭头
2020-06-23 15:27:59 +08:00
ProNoIndex -- ;
if (ProNoIndex < 0 )
ProNoIndex = 0 ;
}
2020-06-23 15:53:23 +08:00
else if(Key==2){ //下箭头
2020-06-23 15:27:59 +08:00
ProNoIndex ++ ;
if (ProNoIndex == ProNoValue)
ProNoIndex = ProNoValue-1;
}
2020-06-23 15:53:23 +08:00
for ( i=0;i<5;i++ ){ // 总共五行
2020-06-23 15:27:59 +08:00
if (ProNoIndex+i>=ProNoValue)
break ;
if (ProNoIndex+i==ProNoSelect && ProNoSelectFlag == TRUE){
sprintf_s(buf,"%s %s",Prodata[ProNoIndex+i].no,Prodata[ProNoIndex+i].state);
fontId[i] = StockFontBuffer( x + 20 , y+7+(i*20) , FONT_PRIO_FRONT, 1 , buf , 2 );
}else{
sprintf_s(buf,"%s %s",Prodata[ProNoIndex+i].no,Prodata[ProNoIndex+i].state);
fontId[i] = StockFontBuffer( x + 20 , y+7+(i*20) , FONT_PRIO_FRONT, 0 , buf, 2 );
}
if(Prodata[ProNoIndex+i].delflag == TRUE){
2020-06-23 15:53:23 +08:00
sprintf_s(buf,"已删除");
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 70 , y+7+(i*20) , FONT_PRIO_FRONT, 4 , buf, 2 );
}
}
Keyid = selFontId( fontId, sizeof( fontId )/sizeof( int ) );
if ( 0 <= Keyid && Keyid < 5 ){
if (ProNoIndex + Keyid < ProNoValue){
2020-06-23 15:53:23 +08:00
//查询某比单号的内容
2020-06-23 15:27:59 +08:00
ProNoSelectFlag = TRUE;
ProNoSelect = ProNoIndex + Keyid;
if ( ProNoSelect != HistorySelect ){
HistorySelect = ProNoSelect;
InitOnlineGmInput(x, y);
SegmentIndex = 0;
SegmentTotal = 0;
SegmentBuf[0][0] = '\0';
SegmentBuf[1][0] = '\0';
vReadContent( ProNoSelect );
}
}
}
2020-06-23 15:53:23 +08:00
if( SegmentTotal > SegmentIndex ){ // 秀出内容
InputHistory.addNo =0; // 非玩家输入所以不用加
2020-06-23 15:27:59 +08:00
GetKeyInputFocus(&SubBuffer);
if( SegmentIndex %2 == 0 ){
if(TitleFlag==TRUE){
2020-06-23 15:53:23 +08:00
StrToNowStrBuffer1("前次问题内容:");
2020-06-23 15:27:59 +08:00
for ( k=0;k<60+10;k++ )
StrToNowStrBuffer(" ");
InputHistory.color[InputHistory.newNo]=TRUE;
pContent = SegmentBuf[SegmentIndex];
TitleFlag = FALSE;
}else{
if(pContent!=NULL){
word = StrToNowStrBuffer2(pContent);
pContent+=word ;
if(word<70){
for ( k=0;k<(80-word);k++ )
StrToNowStrBuffer(" ");
}
if(*pContent == NULL){
pContent = NULL;
SegmentIndex++;
TitleFlag = TRUE;
}
/*
if (i>70){
StrToNowStrBuffer(pContent);
pContent+=70 ;
}else{
StrToNowStrBuffer(pContent);
pContent+=i ;
2020-06-23 15:53:23 +08:00
for ( k=0;k<(70-i);k++ ) //cyg 补空格
2020-06-23 15:27:59 +08:00
StrToNowStrBuffer(" ");
}
if(*pContent == NULL){
pContent = NULL;
SegmentIndex++;
TitleFlag = TRUE;
}
*/
}
}
}else{
if(TitleFlag==TRUE){
2020-06-23 15:53:23 +08:00
StrToNowStrBuffer1("客服解答:");
for ( k=0;k<60+10;k++ ) //cyg 补空格
2020-06-23 15:27:59 +08:00
StrToNowStrBuffer(" ");
InputHistory.color[InputHistory.newNo]=TRUE;
pContent = SegmentBuf[SegmentIndex];
TitleFlag = FALSE;
}else{
if(pContent!=NULL){
word = StrToNowStrBuffer2(pContent);
pContent+=word ;
if(word<70){
for ( k=0;k<(80-word);k++ ){
StrToNowStrBuffer(" ");
}
}
if(*pContent == NULL){
pContent = NULL;
SegmentIndex++;
TitleFlag = TRUE;
}
}
}
}
}else{
if( TitleFlag == TRUE ){
GetKeyInputFocus(&SubBuffer);
2020-06-23 15:53:23 +08:00
StrToNowStrBuffer1("新增问题内容:");
2020-06-23 15:27:59 +08:00
for ( k=0;k<56+10;k++ )
StrToNowStrBuffer(" ");
InputHistory.color[InputHistory.newNo]=TRUE;
TitleFlag = FALSE;
InputHistory.addNo = 0;
InputHistory.lockNo = InputHistory.newNo;
}
}
}
//************************************************
2020-06-23 15:53:23 +08:00
//函式 : 处理资料输入栏位的主函式
//回传值 : None
2020-06-23 15:27:59 +08:00
//************************************************
void InputOnlineGmData( int x, int y, int Key )
{
int Changelineflag = 0;
int i;
if ( InputHistory.newNo - InputHistory.nowNo <= 4)
GetKeyInputFocus(&SubBuffer);
else
pNowStrBuffer = NULL ;
2020-06-23 15:53:23 +08:00
if (Key == 1) //上箭头
2020-06-23 15:27:59 +08:00
{
if (InputHistory.newNo >4 && InputHistory.nowNo ){
InputHistory.nowNo -- ;
if (InputHistory.newNo - (InputHistory.nowNo+4) == 1 ){
strcpy( InputHistory.str[ InputHistory.newNo ],SubBuffer.buffer);
SubBuffer.buffer[0] = NULL ;
}
}
}
2020-06-23 15:53:23 +08:00
if (Key == 2) // 下箭头
2020-06-23 15:27:59 +08:00
{
if (InputHistory.newNo >4){
if (InputHistory.nowNo+4<InputHistory.newNo){
InputHistory.nowNo ++ ;
if (InputHistory.nowNo+4==InputHistory.newNo){
GetKeyInputFocus(&SubBuffer);
strcpy( SubBuffer.buffer,InputHistory.str[ InputHistory.newNo ] );
}
}
}
}
Changelineflag = StockFontBuffer3( &SubBuffer );
2020-06-23 15:53:23 +08:00
if (Changelineflag){ // 换行
2020-06-23 15:27:59 +08:00
if(InputHistory.addNo < 30 ){ //0~29
SubBuffer.cnt=0;
SubBuffer.cursor=0;
if (SubBuffer.y< y + 410)
SubBuffer.y += SubBuffer.lineDist ;
strcpy( InputHistory.str[ InputHistory.newNo ],SubBuffer.buffer);
SubBuffer.buffer[0]='\0';
InputHistory.newNo++;
InputHistory.addNo++;
if (InputHistory.newNo >= 5)
InputHistory.nowNo = InputHistory.newNo -4;
}else{
//SubBuffer.cursor
}
}
2020-06-23 15:53:23 +08:00
for ( i=0;i<5;i++ ) // 总共五行
2020-06-23 15:27:59 +08:00
{
if ((InputHistory.nowNo+i)!=InputHistory.newNo){
if(InputHistory.color[InputHistory.nowNo+i]==FALSE)
StockFontBuffer( SubBuffer.x , y+300+(i*(30-5)) , FONT_PRIO_FRONT, 0 ,InputHistory.str[ InputHistory.nowNo+i ], 0 );
else
StockFontBuffer( SubBuffer.x , y+300+(i*(30-5)) , FONT_PRIO_FRONT, 5 ,InputHistory.str[ InputHistory.nowNo+i ], 0 );
}
}
}
HANDLE GMHandle;
extern char szUser[],szPassword[];
//************************************************
2020-06-23 15:53:23 +08:00
//函式 : 处理查询单号的主函式
//回传值 : OL
2020-06-23 15:27:59 +08:00
//************************************************
DWORD WINAPI DirThread(LPVOID param)
{
ResultCode = -1;
char id[32], password[32];
CopyMemory(id,szUser,32);
ecb_crypt("f;encor1c",id,32,DES_DECRYPT);
CopyMemory(password,szPassword,32);
ecb_crypt("f;encor1c",password,32,DES_DECRYPT);
ResultCode = SendDirMsg( id,password );
switch(ResultCode)
{
case -200:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("无任何问题单纪录!!",FONT_PAL_RED);
StockChatBufferLine("请新增问题单!",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
ProNoValue = 0;
break;
case -400:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("网路发生错误!!",FONT_PAL_RED);
StockChatBufferLine("无法查询问题单!",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
break;
case -600:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("线上回报服务器无法连结!!",FONT_PAL_RED);
StockChatBufferLine("请您稍后再试...",FONT_PAL_WHITE);
2020-06-23 15:27:59 +08:00
break;
case -800:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("网路连线逾时!!",FONT_PAL_RED);
StockChatBufferLine("请您稍后再试...",FONT_PAL_WHITE);
2020-06-23 15:27:59 +08:00
break;
2020-06-23 15:53:23 +08:00
case 1: // 查询成功
2020-06-23 15:27:59 +08:00
break;
case -999:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("网路忙线中!!",FONT_PAL_RED);
StockChatBufferLine("请您稍后再试...",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
break;
default:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("抱歉程式内部错误!!!",FONT_PAL_RED);
StockChatBufferLine("问题单查询失败!",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
break;
}
2020-06-23 15:53:23 +08:00
#ifdef _STONDEBUG_ //写入onlinegm.log
2020-06-23 15:27:59 +08:00
if( ResultCode != 1 ){
2020-06-23 15:53:23 +08:00
sprintf_s(inlogstr,"查询失败错误码%d",ResultCode);
2020-06-23 15:27:59 +08:00
WriteInLog(inlogstr,filename);
}
#endif
CloseHandle(GMHandle);
ExitThread(0);
return 0L;
}
//************************************************
2020-06-23 15:53:23 +08:00
//函式 : 处理删除单号的主函式
//回传值 : OL
2020-06-23 15:27:59 +08:00
//************************************************
DWORD WINAPI DeleteThread(LPVOID param)
{
ResultCode = -1;
char id[32], password[32] ;
CopyMemory(id,szUser,32);
ecb_crypt("f;encor1c",id,32,DES_DECRYPT);
CopyMemory(password,szPassword,32);
ecb_crypt("f;encor1c",password,32,DES_DECRYPT);
#ifdef _STONDEBUG_
inlogstr[0] = 0;
#endif
ResultCode = SendDeleteMsg(id,password,Prodata[ProNoSelect].no);
switch(ResultCode)
{
case 4:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("网路发生错误!!",FONT_PAL_RED);
StockChatBufferLine("无法删除本则单号!",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
break;
case 6:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("线上回报服务器无法连结!!",FONT_PAL_RED);
StockChatBufferLine("请您稍后再试...",FONT_PAL_WHITE);
2020-06-23 15:27:59 +08:00
break;
case 8:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("网路连线逾时!!",FONT_PAL_RED);
StockChatBufferLine("请您稍后再试...",FONT_PAL_WHITE);
2020-06-23 15:27:59 +08:00
break;
case 1:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("问题单号已删除了!",FONT_PAL_YELLOW);
2020-06-23 15:27:59 +08:00
Prodata[ProNoSelect].delflag = TRUE ;
TotalAddValue --;
break;
case -999:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("网路忙线中!!",FONT_PAL_RED);
StockChatBufferLine("请您稍后再试...",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
break;
default:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("抱歉程式内部错误!!!",FONT_PAL_RED);
StockChatBufferLine("本则单号删除失败!",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
break;
}
2020-06-23 15:53:23 +08:00
#ifdef _STONDEBUG_ //写入onlinegm.log
2020-06-23 15:27:59 +08:00
if( ResultCode != 1){
2020-06-23 15:53:23 +08:00
sprintf_s(inlogstr,"删除失败错误码%d",ResultCode);
2020-06-23 15:27:59 +08:00
WriteInLog(inlogstr,filename);
}
#endif
CloseHandle(GMHandle);
ExitThread(0);
return 0L;
}
//************************************************
2020-06-23 15:53:23 +08:00
//函式 : 处理Multithread的主函式
//回传值 : OL
2020-06-23 15:27:59 +08:00
//************************************************
DWORD WINAPI OnlineGmThread(LPVOID param)
{
ResultCode = -1;
char id[32], password[32] ,buf[50];
CopyMemory(id,szUser,32);
ecb_crypt("f;encor1c",id,32,DES_DECRYPT);
CopyMemory(password,szPassword,32);
ecb_crypt("f;encor1c",password,32,DES_DECRYPT);
#ifdef _STONDEBUG_
inlogstr[0] = 0;
#endif
ResultCode = SendProblemMsg(id,password,DataBuffer,InputBuffer);
switch(ResultCode)
{
case 4:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("网路发生错误!!",FONT_PAL_RED);
StockChatBufferLine("无法发送本则问题!",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
break;
case 6:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("线上回报服务器无法连结!!",FONT_PAL_RED);
StockChatBufferLine("请您稍后再试...",FONT_PAL_WHITE);
2020-06-23 15:27:59 +08:00
break;
case 8:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("网路连线逾时!!",FONT_PAL_RED);
StockChatBufferLine("请您稍后再试...",FONT_PAL_WHITE);
2020-06-23 15:27:59 +08:00
break;
case -9:
if(SendType==0){
2020-06-23 15:53:23 +08:00
StockChatBufferLine("每次发送一般问题单",FONT_PAL_RED);
StockChatBufferLine("请间隔三十分钟谢谢...",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
}else{
2020-06-23 15:53:23 +08:00
StockChatBufferLine("每次发送异常问题单",FONT_PAL_RED);
StockChatBufferLine("请间隔一小时谢谢...",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
}
break;
case -999:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("网路忙线中!!",FONT_PAL_RED);
StockChatBufferLine("请您稍后再试...",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
break;
case 1:
2020-06-23 15:53:23 +08:00
sprintf_s(buf,"问题单号%d已送出!",iReturnNo);
2020-06-23 15:27:59 +08:00
StockChatBufferLine( buf ,FONT_PAL_YELLOW);
TotalAddValue ++;
2020-06-23 15:53:23 +08:00
ResetFlag = TRUE ; // 只有成功才reset
2020-06-23 15:27:59 +08:00
DirFlag = TRUE ;
break;
default:
2020-06-23 15:53:23 +08:00
StockChatBufferLine("抱歉程式内部错误!!!",FONT_PAL_RED);
StockChatBufferLine("本则单号传送失败!",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
break;
}
2020-06-23 15:53:23 +08:00
#ifdef _STONDEBUG_ //写入onlinegm.log
2020-06-23 15:27:59 +08:00
if( ResultCode != 1 ){
2020-06-23 15:53:23 +08:00
sprintf_s(inlogstr,"问题单类型:%d 建单失败错误码:%d",SendType,ResultCode);
2020-06-23 15:27:59 +08:00
WriteInLog(inlogstr,filename);
}
#endif
CloseHandle(GMHandle);
ExitThread(0);
return 0L;
}
extern int nServerGroup;
extern short selectServerIndex;
extern short onlinegmProcNo;
extern int sCharSide ;
//**************************************************
2020-06-23 15:53:23 +08:00
//主函式:
//回传值:0 表示视窗开启中 1 表示完成
2020-06-23 15:27:59 +08:00
//**************************************************
int iOnlineGmProc()
{
int i , id ;
static DWORD dwPressTime;
static int btnId[50] , btnState[50] , HelpId[10] , HelpidState[10] ;
static int SureId[2];
char buf[100]= "/0" ; // test
static ACTION *pActOnlineGmWnd = NULL;
static ACTION *pActSureWnd = NULL;
static struct tm nowTime;
time_t longTime;
DWORD PushdirTime;
static LPPAGE page;
static LPDESC desc;
static int desc_index,page_index;
int x, y;
if (onlinegmProcNo == 0)
{
2020-06-23 15:53:23 +08:00
// 打开一个视窗
2020-06-23 15:27:59 +08:00
if (pActOnlineGmWnd == NULL )
{
x = (lpDraw->xSize - 600) / 2;
y = (lpDraw->ySize - 450) / 2;
pActOnlineGmWnd = MakeWindowDisp(x,y,600,450,NULL,-1, FALSE);
x = pActOnlineGmWnd->x;
y = pActOnlineGmWnd->y;
if(ResetFlag==TRUE){
InitOnlineGmInput(x, y);
InitOnlineGm();
dwPressTime = 0;
for ( i = 0 ; i < sizeof(btnId)/sizeof(int) ; i++ )
{
btnId[i] = 0;
btnState[i] = 0;
}
for ( i = 0 ; i < sizeof(HelpId)/sizeof(int) ; i++ )
{
HelpId[i] = 0;
HelpidState[i] = 0;
}
time( &longTime );
localtime_s(&nowTime, &longTime );
wrongY = okY = nowTime.tm_year+1900 ;
/*//fix
wrongM = okM = nowTime.tm_mon+1 ;
wrongD = okD = nowTime.tm_mday ;
wrongH = okH = nowTime.tm_hour ;
*/
2020-06-23 15:53:23 +08:00
//画面reset
2020-06-23 15:27:59 +08:00
ProNoIndex = 0;
desc_index = 0;
page_index = 0;
2020-06-23 15:53:23 +08:00
PushKey = 3; // 自动查询
2020-06-23 15:27:59 +08:00
}
}
else
{
x = pActOnlineGmWnd->x;
y = pActOnlineGmWnd->y;
if (DeleteBtnFlag==FALSE)
{
id = selGraId( btnId, sizeof( btnId )/sizeof( int ) );
if(dwPressTime)
{
if( TimeGetTime()>(dwPressTime+100))
{
for( i = 0 ; i < DEF_BUTTON_TOTAL ; i ++ )
{
if(btnState[i])
{
btnState[i] = 0;
switch (i)
{
2020-06-23 15:53:23 +08:00
case 0://查询
2020-06-23 15:27:59 +08:00
PushdirTime = TimeGetTime();
2020-06-23 15:53:23 +08:00
if ( DirFlag==TRUE || (PushdirTime-LastTime)>5000 ){ //(关闭)有查询过就不能在查
2020-06-23 15:27:59 +08:00
LastTime = TimeGetTime();
PushKey = 3;
DirFlag = FALSE;
}
break;
2020-06-23 15:53:23 +08:00
case 1://删除
if (ProNoSelectFlag){ //要有选到某单号才能删除
2020-06-23 15:27:59 +08:00
DeleteBtnFlag = TRUE ;
}
break;
2020-06-23 15:53:23 +08:00
case 2://传送
2020-06-23 15:27:59 +08:00
DeathAction( pActOnlineGmWnd );
pActOnlineGmWnd = NULL;
onlinegmProcNo = 2;
return 0;
2020-06-23 15:53:23 +08:00
case 3://清除
2020-06-23 15:27:59 +08:00
InitOnlineGmInput(x, y); break;
2020-06-23 15:53:23 +08:00
case 4://注意事项
2020-06-23 15:27:59 +08:00
DeathAction( pActOnlineGmWnd );
pActOnlineGmWnd = NULL;
onlinegmProcNo = 1;
return 0;
2020-06-23 15:53:23 +08:00
case 5://关闭
2020-06-23 15:27:59 +08:00
ResetFlag = TRUE;
DeathAction( pActOnlineGmWnd);
pActOnlineGmWnd = NULL;
return 1 ;
2020-06-23 15:53:23 +08:00
case 6://讯息框上卷
2020-06-23 15:27:59 +08:00
if(ProNoValue){
PushKey = 1;
}
break;
2020-06-23 15:53:23 +08:00
case 7://讯息框下卷
2020-06-23 15:27:59 +08:00
if(ProNoValue){
PushKey = 2;
}
break;
2020-06-23 15:53:23 +08:00
case 8:PutKey = 1; break;//输入框上卷
case 9:PutKey = 2; break;//输入框下卷
case 10://正常年月上卷
2020-06-23 15:27:59 +08:00
okM--;
if (okM<=0){ //fix
okY--;
okM=12;
}
break;
2020-06-23 15:53:23 +08:00
case 11://正常年月下卷
2020-06-23 15:27:59 +08:00
okM++;
if (okM>12){
okY++;
okM=1;
}
break;
2020-06-23 15:53:23 +08:00
case 12://正常日上卷
2020-06-23 15:27:59 +08:00
okD--;
if (okD<=0) okD = 31 ; //fix
break;
2020-06-23 15:53:23 +08:00
case 13://正常日下卷
2020-06-23 15:27:59 +08:00
okD++;
if (okD>31) okD = 1;
break;
2020-06-23 15:53:23 +08:00
case 14://正常时上卷
2020-06-23 15:27:59 +08:00
okH--;
if (okH<0) okH = 23;
break;
2020-06-23 15:53:23 +08:00
case 15://正常时下卷
2020-06-23 15:27:59 +08:00
okH++;
if (okH>23) okH=0;
break;
2020-06-23 15:53:23 +08:00
case 16://错误年月上卷
2020-06-23 15:27:59 +08:00
wrongM--;
if (wrongM<=0){ //fix
wrongY--;
wrongM=12;
}
break;
2020-06-23 15:53:23 +08:00
case 17://错误年月下卷
2020-06-23 15:27:59 +08:00
wrongM++;
if (wrongM>12){
wrongY++;
wrongM=1;
}
break;
2020-06-23 15:53:23 +08:00
case 18://错误日上卷
2020-06-23 15:27:59 +08:00
wrongD--;
if (wrongD<=0) wrongD = 31; //fix
break;
2020-06-23 15:53:23 +08:00
case 19://错误日下卷
2020-06-23 15:27:59 +08:00
wrongD++;
if (wrongD > 31) wrongD = 1;
break;
2020-06-23 15:53:23 +08:00
case 20://错误时上卷
2020-06-23 15:27:59 +08:00
wrongH--;
if (wrongH<0) wrongH = 23;
break;
2020-06-23 15:53:23 +08:00
case 21://错误时下卷
2020-06-23 15:27:59 +08:00
wrongH++;
if (wrongH>23) wrongH = 0;
break;
2020-06-23 15:53:23 +08:00
case 22://类别一上卷
2020-06-23 15:27:59 +08:00
ClassIndex -- ;
ClassIndex1 = 0 ;
ClassIndex2 = 0 ;
if (ClassIndex<0) ClassIndex = DEF_CLASS_TOTAL-1;
break;
2020-06-23 15:53:23 +08:00
case 23://类别一下卷
2020-06-23 15:27:59 +08:00
ClassIndex ++ ;
ClassIndex1 = 0 ;
ClassIndex2 = 0 ;
if (ClassIndex==DEF_CLASS_TOTAL) ClassIndex = 0;
break;
2020-06-23 15:53:23 +08:00
case 24://类别二上卷
2020-06-23 15:27:59 +08:00
ClassIndex1 -- ;
ClassIndex2 = 0 ;
2020-06-23 15:53:23 +08:00
if (ClassIndex==1){ // 一般问题
2020-06-23 15:27:59 +08:00
if (ClassIndex1<0) ClassIndex1 = DEF_C1_TOTAL-1;
}else{
if (ClassIndex1<0) ClassIndex1 = DEF_C2_TOTAL-1;
}
break;
2020-06-23 15:53:23 +08:00
case 25://类别二下卷
2020-06-23 15:27:59 +08:00
ClassIndex1 ++ ;
ClassIndex2 = 0 ;
2020-06-23 15:53:23 +08:00
if (ClassIndex==1){ // 一般问题
2020-06-23 15:27:59 +08:00
if (ClassIndex1==DEF_C1_TOTAL) ClassIndex1=0;
}else{
if (ClassIndex1==DEF_C2_TOTAL) ClassIndex1=0;
}
break;
2020-06-23 15:53:23 +08:00
case 26://类别三上卷
2020-06-23 15:27:59 +08:00
ClassIndex2 -- ;
switch (ClassIndex1)
{
case 0:if (ClassIndex2<0) ClassIndex2=2;break;
case 1:if (ClassIndex2<0) ClassIndex2=2;break;
case 2:if (ClassIndex2<0) ClassIndex2=4;break;
case 3:if (ClassIndex2<0) ClassIndex2=1;break;
case 4:if (ClassIndex2<0) ClassIndex2=1;break;
case 5:if (ClassIndex2<0) ClassIndex2=2;break;
case 10:if (ClassIndex2<0) ClassIndex2=2;break;
default: ClassIndex2=0;break;
}
break;
2020-06-23 15:53:23 +08:00
case 27://类别三下卷
2020-06-23 15:27:59 +08:00
ClassIndex2 ++ ;
switch (ClassIndex1)
{
case 0:if (ClassIndex2>2) ClassIndex2=0;break;
case 1:if (ClassIndex2>2) ClassIndex2=0;break;
case 2:if (ClassIndex2>4) ClassIndex2=0;break;
case 3:if (ClassIndex2>1) ClassIndex2=0;break;
case 4:if (ClassIndex2>1) ClassIndex2=0;break;
case 5:if (ClassIndex2>2) ClassIndex2=0;break;
case 10:if (ClassIndex2>2) ClassIndex2=0;break;
default: ClassIndex2=0;break;
}
break;
}
}
}
dwPressTime = 0;
}
}
else
{
if ( 0 <= id && id < DEF_BUTTON_TOTAL )
{
btnState[id] = 1;
dwPressTime = TimeGetTime();
}
}
}else{
if (pActSureWnd == NULL){
pActSureWnd = MakeWindowDisp( 200+100+20 , 100-63 , 4-1 , 6-4 , NULL , -1);
}
else if(pActSureWnd->hp > 0)
{
StockDispBuffer(416+15+15,100,DISP_PRIO_MENU,ONLINEGM_YES_OR_NO,1);
MakeHitBox( 338+15+15,100,405+15+15,124, DISP_PRIO_BOX2 );
MakeHitBox( 426+15+15,100,494+15+15,124, DISP_PRIO_BOX2 );
selGraId( SureId, sizeof( SureId )/sizeof( int ) );
SureId[0] = StockDispBuffer( 372+15+15 , 112 , DISP_PRIO_IME3, ONLINEGM_SURE_U , 1);
SureId[1] = StockDispBuffer( 460+15+15 , 112 , DISP_PRIO_IME3, ONLINEGM_CHANCEL , 1);
if(Prodata[ProNoSelect].delflag == TRUE){
2020-06-23 15:53:23 +08:00
sprintf_s(buf,"此笔单号已删除");
2020-06-23 15:27:59 +08:00
StockFontBuffer( 365+15+15 , 81 , FONT_PRIO_FRONT, 2 , buf , 0 );
}else{
2020-06-23 15:53:23 +08:00
sprintf_s(buf,"删除单号 %s 吗?",Prodata[ProNoSelect].no);
2020-06-23 15:27:59 +08:00
StockFontBuffer( 355+15+15 , 81 , FONT_PRIO_FRONT, 5 , buf , 0 );
}
2020-06-23 15:53:23 +08:00
if((mouse.onceState & MOUSE_LEFT_CRICK) && HitDispNo == SureId[0]){ //确定
2020-06-23 15:27:59 +08:00
if(Prodata[ProNoSelect].delflag == FALSE){
DWORD dwThreadID,dwThrdParam = 1;
GMHandle = CreateThread(NULL, 0, DeleteThread,&dwThrdParam,0,&dwThreadID);
if(GMHandle == NULL)
{
2020-06-23 15:53:23 +08:00
StockChatBufferLine("您的作业系统资源已不足!!",FONT_PAL_RED);
StockChatBufferLine("本则单号删除失败!",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
ResetFlag = TRUE;
DeathAction( pActOnlineGmWnd);
pActOnlineGmWnd = NULL;
return 1;
}
}
DeathAction( pActSureWnd);
pActSureWnd = NULL;
DeleteBtnFlag = FALSE ;
}
2020-06-23 15:53:23 +08:00
if((mouse.onceState & MOUSE_LEFT_CRICK) && HitDispNo == SureId[1]){ //取消
2020-06-23 15:27:59 +08:00
DeathAction( pActSureWnd);
pActSureWnd = NULL;
DeleteBtnFlag = FALSE ;
}
}
}
if (pActOnlineGmWnd->hp > 0)
{
x = pActOnlineGmWnd->x;
y = pActOnlineGmWnd->y;
if(PushKey != 3){
ShowProblemNo(x, y, PushKey);
2020-06-23 15:53:23 +08:00
}else{ //处理查询功能
2020-06-23 15:27:59 +08:00
for( i=0;i<DEF_MAX_ADD_VALUE;i++){
Prodata[i].no[0] = '\0';
Prodata[i].state[0] = '\0';
Prodata[i].okdate[0] = '\0';
Prodata[i].okH = 0;
Prodata[i].wrongdate[0] = '\0';
Prodata[i].wrongH = 0;
Prodata[i].class0 = 0;
Prodata[i].class1[0] = '\0';
Prodata[i].cont[0] = '\0';
Prodata[i].answer[0] = '\0';
Prodata[i].error[0] = '\0';
Prodata[i].delflag = FALSE;
}
DWORD dwThreadID,dwThrdParam = 1;
GMHandle = CreateThread(NULL, 0, DirThread,&dwThrdParam,0,&dwThreadID);
if(GMHandle == NULL)
{
2020-06-23 15:53:23 +08:00
StockChatBufferLine("您的作业系统资源已不足!!",FONT_PAL_RED);
StockChatBufferLine("问题单号查询失败!",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
ResetFlag = TRUE;
DeathAction( pActOnlineGmWnd);
pActOnlineGmWnd = NULL;
return 1;
}
}
PushKey = 0;
InputOnlineGmData(x, y, PutKey);
PutKey = 0;
/* for test
sprintf_s(buf,"new%d",InputHistory.newNo);
StockFontBuffer( 212 , 250 , FONT_PRIO_FRONT, 1 , buf , 0 );
sprintf_s(buf,"now%d",InputHistory.nowNo);
StockFontBuffer( 350 , 250 , FONT_PRIO_FRONT, 1 , buf , 0 );
sprintf_s(buf,"add%d",InputHistory.addNo);
StockFontBuffer( 480 , 250 , FONT_PRIO_FRONT, 1 , buf , 0 );
*/
//sprintf_s(buf,"Total %d",TotalAddValue);
//StockFontBuffer( 480 , 250 , FONT_PRIO_FRONT, 1 , buf , 0 );
/*
sprintf_s(buf,"ProNoValue %d",ProNoValue);
StockFontBuffer( 490 , 250 , FONT_PRIO_FRONT, 1 , buf , 0 );
sprintf_s(buf,"ProNoSelect %d",ProNoSelect);
StockFontBuffer( 350 , 250 , FONT_PRIO_FRONT, 1 , buf , 0 );
*/
2020-06-23 15:53:23 +08:00
StockDispBuffer( x + 320 , y + 228 , DISP_PRIO_MENU , ONLINEGM_BACKGROUND , 1);//背景图
StockFontBuffer( x + 80, y + 180, FONT_PRIO_FRONT, 0," 年 月 日 时",0);
StockFontBuffer( x + 387+21, y + 180, FONT_PRIO_FRONT, 0," 年 月 日 时",0);
StockFontBuffer( x + 12 , y + 180, FONT_PRIO_FRONT, 5, "正常日期", 0 );
StockFontBuffer( x + 315+21 ,y + 180, FONT_PRIO_FRONT, 5, "错误日期", 0 );
StockFontBuffer( x + 12 , y + 215, FONT_PRIO_FRONT, 5, "问题类别", 0 );
//显示时间
2020-06-23 15:27:59 +08:00
sprintf_s( buf ,"%d %02d %02d %02d",okY,okM,okD,okH );
StockFontBuffer( x + 100-20 , y + 180, FONT_PRIO_FRONT, 1 , buf , 0 );
sprintf_s( buf ,"%d %02d %02d %02d",wrongY,wrongM,wrongD,wrongH );
StockFontBuffer( x + 387+21 , y + 180, FONT_PRIO_FRONT, 1 , buf , 0 );
2020-06-23 15:53:23 +08:00
//显示问题类别
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 90 , y + 215, FONT_PRIO_FRONT, 1, ProblemClass[ClassIndex], 0 );
2020-06-23 15:53:23 +08:00
if (ClassIndex==1) //一般问题
2020-06-23 15:27:59 +08:00
{
StockFontBuffer( x + 230-30, y + 215, FONT_PRIO_FRONT, 1, ProblemC1[ClassIndex1], 0 );
StockFontBuffer( x + 20, y + 250, FONT_PRIO_FRONT, 1, ProblemC1Help[ClassIndex1], 0 );
2020-06-23 15:53:23 +08:00
}else{ //异常问题
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 230, y + 215, FONT_PRIO_FRONT, 1, ProblemC2[ClassIndex1], 0 );
switch (ClassIndex1)
{
case 0:StockFontBuffer( x + 460, y + 215, FONT_PRIO_FRONT, 1, ProblemC2_1[ClassIndex2], 0 );break;
case 1:StockFontBuffer( x + 460, y + 215, FONT_PRIO_FRONT, 1, ProblemC2_2[ClassIndex2], 0 );break;
case 2:StockFontBuffer( x + 460, y + 215, FONT_PRIO_FRONT, 1, ProblemC2_3[ClassIndex2], 0 );break;
case 3:StockFontBuffer( x + 460, y + 215, FONT_PRIO_FRONT, 1, ProblemC2_4[ClassIndex2], 0 );break;
case 4:StockFontBuffer( x + 460, y + 215, FONT_PRIO_FRONT, 1, ProblemC2_5[ClassIndex2], 0 );break;
case 5:StockFontBuffer( x + 460, y + 215, FONT_PRIO_FRONT, 1, ProblemC2_6[ClassIndex2], 0 );break;
case 10:StockFontBuffer( x + 460, y + 215, FONT_PRIO_FRONT, 1, ProblemC2_7[ClassIndex2], 0 );break;
default: break;
}
if ((ClassIndex1==2&&ClassIndex2==0)||ClassIndex1==6)
2020-06-23 15:53:23 +08:00
StockFontBuffer( x + 20,y + 250, FONT_PRIO_FRONT,1,"选择此项目需注明【宠物等级】",0);
2020-06-23 15:27:59 +08:00
}
2020-06-23 15:53:23 +08:00
//如果user有按下按钮 按钮显示按下
2020-06-23 15:27:59 +08:00
for ( i = 0 ; i < DEF_BUTTON_TOTAL ; i ++ )
{
if (btnState[i])
btnId[i] = StockDispBuffer( x + BUTTON_XY[i][0], y + BUTTON_XY[i][1] , DISP_PRIO_IME3, DOWN_ANIM_ID[i] , 2);
else
btnId[i] = StockDispBuffer( x + BUTTON_XY[i][0], y + BUTTON_XY[i][1] , DISP_PRIO_IME3, UP_ANIM_ID[i] , 2);
}
}
}
}
2020-06-23 15:53:23 +08:00
else if (onlinegmProcNo == 1) // 注意事项
2020-06-23 15:27:59 +08:00
{
if (pActOnlineGmWnd==NULL){
x = (lpDraw->xSize - 7*64)/2;
y = (lpDraw->ySize - 8*48)/2;
pActOnlineGmWnd = MakeWindowDisp( x , y , 4+3 , 6+2 ,NULL,0, FALSE);//( 210 , 120, 10 , 10 , NULL , 0 );
pNowStrBuffer = NULL ;
}
else if (pActOnlineGmWnd->hp > 0)
{
x = pActOnlineGmWnd->x;
y = pActOnlineGmWnd->y;
page = &ProHelp_page[page_index];
desc = Prohelp_Index[page_index]+page->desc_index;
desc_index = page->desc_index;
id = selGraId( HelpId, sizeof( HelpId )/sizeof( int ) );
if (HelpidState[0]>=0)
HelpId[0] = StockDispBuffer( x+207+32-160, y+352, DISP_PRIO_IME3, CG_FIELD_HELP_PREPAGE+btnState[1], 2);
else
StockDispBuffer( x+207+32-160, y+352, DISP_PRIO_IME3, CG_FIELD_HELP_PREPAGE+btnState[1], 1);
if (HelpidState[1]>=0)
HelpId[1] = StockDispBuffer( x+277+32-100, y+352, DISP_PRIO_IME3, CG_FIELD_HELP_NEXTPAGE+btnState[2], 2);
else
StockDispBuffer( x+277+32-100, y+352, DISP_PRIO_IME3, CG_FIELD_HELP_NEXTPAGE+btnState[2], 1);
HelpId[2] = StockDispBuffer( x+347+32-40, y+352, DISP_PRIO_IME3, CG_FIELD_HELP_EXIT+btnState[3], 2);
2020-06-23 15:53:23 +08:00
if((mouse.onceState & MOUSE_LEFT_CRICK) && HitDispNo == HelpId[0]){ //上一页
2020-06-23 15:27:59 +08:00
if (page_index){
page_index--;
2020-06-23 15:53:23 +08:00
page = &ProHelp_page[page_index]; //指向上一页
2020-06-23 15:27:59 +08:00
desc_index = page->desc_index;
2020-06-23 15:53:23 +08:00
desc = Prohelp_Index[page_index]+desc_index;//指向新一页的desc开头
2020-06-23 15:27:59 +08:00
}
}
2020-06-23 15:53:23 +08:00
if((mouse.onceState & MOUSE_LEFT_CRICK) && HitDispNo == HelpId[1]){ //下一页
2020-06-23 15:27:59 +08:00
if (page_index < 4-1)
{
page_index++;
2020-06-23 15:53:23 +08:00
page = &ProHelp_page[page_index]; //指向下一页
2020-06-23 15:27:59 +08:00
desc_index = page->desc_index;
2020-06-23 15:53:23 +08:00
desc = Prohelp_Index[page_index]+desc_index;//指向新一页的desc开头
2020-06-23 15:27:59 +08:00
}
}
HelpidState[0] = page_index==0 ? -2 : 0 ;
HelpidState[1] = page_index==4-1 ? -2 : 0 ;
if((mouse.onceState & MOUSE_LEFT_CRICK) && HitDispNo == HelpId[2])
{
DeathAction( pActOnlineGmWnd);
pActOnlineGmWnd = NULL;
onlinegmProcNo = 0 ;
ResetFlag = FALSE;
return 0 ;
}
for( i = 0; i < page->desc_num; i++){
StockFontBuffer( x+30+5 , y+i*25+10, FONT_PRIO_FRONT, desc->color, desc->description, 0);
desc++;
}
}
}
2020-06-23 15:53:23 +08:00
else if (onlinegmProcNo == 2) //cyg 准备传送的确定视窗
2020-06-23 15:27:59 +08:00
{
if (pActOnlineGmWnd==NULL){
x = (lpDraw->xSize - 5*64)/2;
y = (lpDraw->ySize - 5*48)/2;
pActOnlineGmWnd = MakeWindowDisp( x , y , 5 , 5 ,NULL,0, FALSE);
pNowStrBuffer = NULL ;
}
else if (pActOnlineGmWnd->hp > 0)
{
x = pActOnlineGmWnd->x;
y = pActOnlineGmWnd->y;
MakeHitBox( x + 36,y + 238-85-35,x + 40,y + 238-85+35, DISP_PRIO_BOX );
MakeHitBox( x + 156+18,y + 238-85-35,x + 156+18,y + 238-85+35, DISP_PRIO_BOX );
id = selGraId( btnId, sizeof( btnId )/sizeof( int ) );
int SureBtn[2];
SureBtn[0] = StockDispBuffer( x + 70 , y + 250-85+35 , DISP_PRIO_IME3, ONLINEGM_SURE_U , 1);
SureBtn[1] = StockDispBuffer( x + 190+18 , y + 250-85+35 , DISP_PRIO_IME3, ONLINEGM_CHANCEL , 1);
2020-06-23 15:53:23 +08:00
sprintf_s( buf ,"错误讯息->");
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 20 , y+ 20+60 , FONT_PRIO_FRONT, 4 , buf , 0 );
2020-06-23 15:53:23 +08:00
if( TotalAddValue >= DEF_MAX_ADD_VALUE ){ // 有没有达最大建单数
sprintf_s( buf ,"您的问题单已达上限20笔!!");
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 235 , y + 150 , FONT_PRIO_FRONT, 4 , buf , 0 );
2020-06-23 15:53:23 +08:00
sprintf_s( buf ,"请删除问题单后再留单谢谢",TotalAddValue );
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 235 , y + 185 , FONT_PRIO_FRONT, 4 , buf , 0 );
if((mouse.onceState & MOUSE_LEFT_CRICK) && HitDispNo == SureBtn[0])
{
DeathAction( pActOnlineGmWnd);
pActOnlineGmWnd = NULL;
onlinegmProcNo = 0 ;
ResetFlag = FALSE;
return 0 ;
}
}else{
if (ClassIndex==1){
2020-06-23 15:53:23 +08:00
sprintf_s( buf ,"问题类别-> %s",ProblemClass[ClassIndex]);
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 20 , y + 20+10, FONT_PRIO_FRONT, 1 , buf , 0 );
2020-06-23 15:53:23 +08:00
sprintf_s( buf ,"问题种类-> %s",ProblemC1[ClassIndex1]);
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 20 , y + 20+35, FONT_PRIO_FRONT, 1 , buf , 0 );
}else{
2020-06-23 15:53:23 +08:00
sprintf_s( buf ,"问题类别-> %s",ProblemClass[ClassIndex]);
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 20 , y + 20+10, FONT_PRIO_FRONT, 1 , buf , 0 );
2020-06-23 15:53:23 +08:00
sprintf_s( buf ,"问题种类-> %s",ProblemC2[ClassIndex1]);
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 20 , y + 20+35, FONT_PRIO_FRONT, 1 , buf , 0 );
switch (ClassIndex1)
{
2020-06-23 15:53:23 +08:00
case 0: sprintf_s( buf,"种类细项-> %s",ProblemC2_1[ClassIndex2] );break;
case 1: sprintf_s( buf,"种类细项-> %s",ProblemC2_2[ClassIndex2] );break;
case 2: sprintf_s( buf,"种类细项-> %s",ProblemC2_3[ClassIndex2] );break;
case 3: sprintf_s( buf,"种类细项-> %s",ProblemC2_4[ClassIndex2] );break;
case 4: sprintf_s( buf,"种类细项-> %s",ProblemC2_5[ClassIndex2] );break;
case 5: sprintf_s( buf,"种类细项-> %s",ProblemC2_6[ClassIndex2] );break;
case 10: sprintf_s( buf,"种类细项-> %s",ProblemC2_7[ClassIndex2] );break;
2020-06-23 15:27:59 +08:00
default: buf[0] = '\0';
}
StockFontBuffer( x + 220-25 , y + 120+60, FONT_PRIO_FRONT, 1 , buf , 0 );
2020-06-23 15:53:23 +08:00
sprintf_s( buf ,"正常日期-> %4d年%02d月%02d日%02d时",okY,okM,okD,okH);
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 220-25 , y + 120+85, FONT_PRIO_FRONT, 1 , buf , 0 );
2020-06-23 15:53:23 +08:00
sprintf_s( buf ,"错误日期-> %4d年%02d月%02d日%02d时",wrongY,wrongM,wrongD,wrongH );
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 220-25 , y + 120+110, FONT_PRIO_FRONT, 1 , buf , 0 );
}
if( lstrlen(InputHistory.str[InputHistory.lockNo+1]) == 0 && lstrlen(SubBuffer.buffer) == 0 ){
2020-06-23 15:53:23 +08:00
sprintf_s( buf ,"请输入问题内容");
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 20 , y + 120, FONT_PRIO_FRONT, 4 , buf , 0 );
if((mouse.onceState & MOUSE_LEFT_CRICK) && HitDispNo == SureBtn[0])
{
DeathAction( pActOnlineGmWnd);
pActOnlineGmWnd = NULL;
onlinegmProcNo = 0 ;
ResetFlag = FALSE;
return 0 ;
}
}else if(ClassIndex==0&&(!okY||!okM||!okD||!wrongY||!wrongM||!wrongD)){ //fix
2020-06-23 15:53:23 +08:00
sprintf_s( buf ,"请填写[正常日期]与[错误日期]");
2020-06-23 15:27:59 +08:00
StockFontBuffer( x + 280-10+2 , y + 260 , FONT_PRIO_FRONT, 4 , buf , 0 );
if((mouse.onceState & MOUSE_LEFT_CRICK) && HitDispNo == SureBtn[0])
{
DeathAction( pActOnlineGmWnd);
pActOnlineGmWnd = NULL;
onlinegmProcNo = 0 ;
ResetFlag = FALSE;
return 0 ;
}
}else{
if((mouse.onceState & MOUSE_LEFT_CRICK) && HitDispNo == SureBtn[0])
{
ResetFlag = FALSE;
ContentBuf[0] = '\0';
for ( i=0;i<InputHistory.addNo-1;i++)
2020-06-23 15:53:23 +08:00
strcat_s(ContentBuf,InputHistory.str[InputHistory.newNo-(InputHistory.addNo-1)+i]); //组合每一行
2020-06-23 15:27:59 +08:00
strcat_s(ContentBuf,SubBuffer.buffer);
sprintf_s( InputBuffer,"%s",ContentBuf);
2020-06-23 15:53:23 +08:00
if (ClassIndex==1){ // 一般问题 没有日期和时间
2020-06-23 15:27:59 +08:00
ProblemType=0;
sprintf_s( DataBuffer,"&star=%s&earth=%s&qtype1=%s&msource=19",gmgroup[nServerGroup].name,gmsv[selectServerIndex].name,ProblemC1[ClassIndex1]);
2020-06-23 15:53:23 +08:00
}else{ // 异常问题
2020-06-23 15:27:59 +08:00
ProblemType=1;
char tempbuf[60];
sprintf_s( tempbuf,"%s",ProblemC2[ClassIndex1]);
switch (ClassIndex1)
{
case 0: sprintf_s( tempbuf,"%s,%s",tempbuf,ProblemC2_1[ClassIndex2] );break;
case 1: sprintf_s( tempbuf,"%s,%s",tempbuf,ProblemC2_2[ClassIndex2] );break;
case 2: sprintf_s( tempbuf,"%s,%s",tempbuf,ProblemC2_3[ClassIndex2] );break;
case 3: sprintf_s( tempbuf,"%s,%s",tempbuf,ProblemC2_4[ClassIndex2] );break;
case 4: sprintf_s( tempbuf,"%s,%s",tempbuf,ProblemC2_5[ClassIndex2] );break;
case 5: sprintf_s( tempbuf,"%s,%s",tempbuf,ProblemC2_6[ClassIndex2] );break;
case 10: sprintf_s( tempbuf,"%s,%s",tempbuf,ProblemC2_7[ClassIndex2] );break;
default: break;
}
#ifdef _CHAR_PROFESSION
if(lstrlen(pc.profession_class_name) == NULL){
2020-06-23 15:53:23 +08:00
strcpy(pc.profession_class_name,"");
2020-06-23 15:27:59 +08:00
}
#endif
char side[10];
if(sCharSide == 1)
2020-06-23 15:53:23 +08:00
strcpy(side,"");
2020-06-23 15:27:59 +08:00
else
2020-06-23 15:53:23 +08:00
strcpy(side,"");
2020-06-23 15:27:59 +08:00
#ifdef _CHAR_PROFESSION
sprintf_s( DataBuffer,"&SY=%d&SM=%d&SD=%d&EY=%d&EM=%d&ED=%d&datarighttime=%d&datawrongtime=%d&msource=18&exceptcont=%s&G1grade1=%d&G1grade2=%d&G1Loc1=%s&G1Job1=%s&star=%s&G1gname1=%s",okY,okM,okD,wrongY,wrongM,wrongD,okH,wrongH,tempbuf,pc.transmigration,pc.level,side,pc.profession_class_name,gmgroup[nServerGroup].name,pc.name);
#else
sprintf_s( DataBuffer,"&SY=%d&SM=%d&SD=%d&EY=%d&EM=%d&ED=%d&datarighttime=%d&datawrongtime=%d&msource=18&exceptcont=%s&G1grade1=%d&G1grade2=%d&G1Loc1=%s&G1Job1=%s&G1gname1=%s",okY,okM,okD,wrongY,wrongM,wrongD,okH,wrongH,tempbuf,pc.transmigration,pc.level,side,gmgroup[nServerGroup].name,pc.name);
#endif
}
DeathAction( pActOnlineGmWnd);
pActOnlineGmWnd = NULL;
DWORD dwThreadID,dwThrdParam = 1;
GMHandle = CreateThread(NULL, 0, OnlineGmThread,&dwThrdParam,0,&dwThreadID);
if(GMHandle == NULL)
{
2020-06-23 15:53:23 +08:00
StockChatBufferLine("您的作业系统资源已不足!!",FONT_PAL_RED);
StockChatBufferLine("本则单号传送失败!",FONT_PAL_RED);
2020-06-23 15:27:59 +08:00
ResetFlag = TRUE;
DeathAction( pActOnlineGmWnd);
pActOnlineGmWnd = NULL;
return 1;
}
onlinegmProcNo = 0 ;
return 0 ;
}
}
}
2020-06-23 15:53:23 +08:00
if((mouse.onceState & MOUSE_LEFT_CRICK) && HitDispNo == SureBtn[1]) //取消钮
2020-06-23 15:27:59 +08:00
{
DeathAction( pActOnlineGmWnd);
pActOnlineGmWnd = NULL;
onlinegmProcNo = 0 ;
ResetFlag = FALSE;
return 0 ;
}
}
}
if(CheckMenuFlag()){
ResetFlag = TRUE;
DeathAction( pActOnlineGmWnd);
pActOnlineGmWnd = NULL;
return 1;
}
return 0 ;
}
//************************************************
2020-06-23 15:53:23 +08:00
//函式 : DNS专用函式
//回传值 : TRUE --- 转换成功
// FALSE --- 转换失败
2020-06-23 15:27:59 +08:00
//************************************************
BOOL QueryOnlineGmIP(char HostName[])
{
PHOSTENT info;
2020-06-23 15:53:23 +08:00
// strcpy(OnlineGmIP,"10.0.1.60"); // 直接给ip,保留转换code
2020-06-23 15:27:59 +08:00
// return TRUE;
if( (info = gethostbyname(HostName)) == NULL)
return FALSE;
else{
OnlineGmIP = inet_ntoa(*(struct in_addr *)*info->h_addr_list);
}
return TRUE;
}
#endif