⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tuxedo.cpp

📁 本源码为移动公司话费查询中间件TUXEDO使用的实例
💻 CPP
📖 第 1 页 / 共 5 页
字号:
			strcpy(input1.num[3],"8");strcpy(input1.num[4],"8");strcpy(input1.num[5],"8");
			strcpy(input1.num[6],"6");strcpy(input1.num[7],"8");
			
			input2.count = 5;//1参数 那个是时间  3参数
			strcpy(input2.num[0],"1");strcpy(input2.num[1],"2");strcpy(input2.num[2],"3");
			strcpy(input2.num[3],"5");strcpy(input2.num[4],"9");strcpy(input2.num[5],"3");			
			//strcpy(input2.num[6],"10");strcpy(input2.num[7],"3");
			
	}
	
	if((str=strstr(rebuf,"合计"))!=NULL)
	{
		endindex=1;
		//		number=number-(str-rebuf);	
	}
	else
	{	
		//rebuf=rebuf+114;//将前面的横线去掉
		int countindex=0;
		number = strlen(rebuf);
		while(number>4)
		{
			//	str=rebuf;
			countindex=0;
			if((countindex=daishouaddline(rebuf,9,3))>0)
			{//加记录到内存
				tempfee=0.0;
				tempfee=atof(Param[4]);//费用
				m_fFeeCount=m_fFeeCount+tempfee;

				char tempbuf1[6];
				memset(tempbuf1,'\0',6);
				sprintf(tempbuf1,"%.2f",tempfee);
				try
				{
					if(strncmp(Param[0],phone,strlen(phone))==0)
					{
						m_pShppRequest->AddFieldVal(Param[1],strlen(rtrim(Param[1])));
						m_pShppRequest->AddFieldVal("发送",4);
					}
					else
					{
						m_pShppRequest->AddFieldVal(Param[0],strlen(rtrim(Param[0])));
						m_pShppRequest->AddFieldVal("接受",4);					
					}
					//for(int j=2;j<input2.count;j++)
					//	m_pShppRequest->AddFieldVal(Param[atoi(input2.num[j])-1],strlen(rtrim(Param[atoi(input2.num[j])-1])));
						m_pShppRequest->AddFieldVal(Param[2],strlen(Param[2]));
						m_pShppRequest->AddFieldVal(Param[4],strlen(Param[4]));
						m_pShppRequest->AddFieldVal(Param[8],strlen(Param[8]));
				}
				catch(...)
				{
					printf("普通短信解析出错 %s %d,err=\n",phone,__LINE__,::GetLastError());
					return -1;
				}
				m_nCountLine=m_nCountLine+1;
				number=number-countindex;
				rebuf=rebuf+countindex;
				while(rebuf[0]==' ')
				{
					rebuf=rebuf+1;
					number=number-1;
				}
			}//添加记录结束		
			else
			{
				m_pShppRequest->Reset();
				return -1;
			}
		}
	}
	
	if((endindex==1)&&(m_nCountLine!=0))
	{
		//处理结尾
		char pList[256];
		m_pShppRequest->PutParameter(s_chSeparator);		
		sprintf(pList,"普通短信话单 总费用:%0.2f元;",m_fFeeCount);
		m_tempfee=m_tempfee+m_fFeeCount;
		m_pShppRequest->PutParameter(pList);
		sprintf(pList,"普通短信话单 总次数:%d次;", m_nCountLine);
		m_tempcount=m_tempcount+m_nCountLine;
		m_pShppRequest->PutParameter(pList);
		m_pShppRequest->PutParameter(s_chSeparator);

	//	*m_pfOutFeeCount += m_fFeeCount;
	//	*m_pnLineCount += m_nCountLine;
		//m_pShppRequest->Flush();
		
		m_fFeeCount  = 0.0;
		m_nCountLine = 0;
		startindex   = 0;
		endindex     = 0;
	}
	return 0;
}
//==========================================
int CTuxedo::hutongduanxin(char *rebuf,char *phone)
{
	char *str=NULL;
	int number = 100;
//	char linebuf[256];
	float tempfee = 0.0;
	if((strstr(rebuf,"--------")!=NULL)&&(strlen(rebuf)<150))
		return 0;	
	if((strstr(rebuf,"合计")!=NULL)&&(startindex==0))
		return 0;
	if(strlen(rebuf)<10)
		return 0;
	if(strstr(rebuf,"合计")!=NULL)
	{
		endindex=1;
		if((endindex==1)&&(m_nCountLine!=0))
		{
			//处理结尾
			char pList[256];
			m_pShppRequest->PutParameter(s_chSeparator);		
			sprintf(pList,"你的互通短信话单总费用:%0.2f元;",m_fFeeCount);
			m_tempfee=m_tempfee+m_fFeeCount;
			m_pShppRequest->PutParameter(pList);
			sprintf(pList,"你的互通短信话单总次数:%d次;", m_nCountLine);
			m_tempcount=m_tempcount+m_nCountLine;
			m_pShppRequest->PutParameter(pList);
			m_pShppRequest->PutParameter(s_chSeparator);
			
			//	*m_pfOutFeeCount += m_fFeeCount;
			//	*m_pnLineCount += m_nCountLine;
			//m_pShppRequest->Flush();
			
			m_fFeeCount  = 0.0;
			m_nCountLine = 0;
			startindex   = 0;
			endindex     = 0;
		}
		return 0;
	}
	
	if(startindex==0)
	{
		m_pShppRequest->ResetField();
		m_pShppRequest->ResetField();
		m_pShppRequest->AddPrintField(15);    //主叫号
		m_pShppRequest->AddPrintField(5);    //叫呼转号码
		m_pShppRequest->AddPrintField(15);//4日期  时间20020321  03-21
		m_pShppRequest->AddPrintField(7);   //5时长(秒)
		m_pShppRequest->AddPrintField(8);   //6话费
		m_pShppRequest->PrintLine("短信话单-互通短信话单",LPLCENTER);
//		m_pShppRequest->PutParameter("对方号码    方式  日期 时间     时长 话费 通话地");
		m_pShppRequest->PutParameter("对方号码       方式      日期       费用   状态");
		m_pShppRequest->PutParameter(s_chSeparator);
		
		startindex  = 1;
		m_fFeeCount =0.0;//费用
		m_nCountLine=0;;//行数
		
		input1.count = 8;
		for(int i=0;i<15;i++)
			for(int j=0;j<3;j++)
			{
				input1.num[i][j]='\0';
				input2.num[i][j]='\0';
			}
			strcpy(input1.num[0],"24");strcpy(input1.num[1],"24");strcpy(input1.num[2],"22");
			strcpy(input1.num[3],"8");strcpy(input1.num[4],"8");strcpy(input1.num[5],"8");
			strcpy(input1.num[6],"6");strcpy(input1.num[7],"8");
			
			input2.count = 5;//1参数 那个是时间  3参数
			strcpy(input2.num[0],"1");strcpy(input2.num[1],"2");strcpy(input2.num[2],"3");
			strcpy(input2.num[3],"5");strcpy(input2.num[4],"9");strcpy(input2.num[5],"3");			
			//strcpy(input2.num[6],"10");strcpy(input2.num[7],"3");
			
	}
	
	if((str=strstr(rebuf,"合计"))!=NULL)
	{
		endindex=1;
		//		number=number-(str-rebuf);	
	}
	else
	{	
	//	rebuf=rebuf+114;//将前面的横线去掉
		int countindex=0;
		number = strlen(rebuf);
		while(number>4)
		{
			//	str=rebuf;
			countindex=0;
			if((countindex=daishouaddline(rebuf,9,3))>0)
			{//加记录到内存
				tempfee=0.0;
				tempfee=atof(Param[4]);//费用
				m_fFeeCount=m_fFeeCount+tempfee;
				
				char tempbuf1[6];
				memset(tempbuf1,'\0',6);
				sprintf(tempbuf1,"%.2f",tempfee);
				try
				{				
					if(strncmp(Param[0],phone,strlen(phone))==0)
					{
						m_pShppRequest->AddFieldVal(Param[1],strlen(Param[1]));
						m_pShppRequest->AddFieldVal("发送",4);
					}
					else
					{
						m_pShppRequest->AddFieldVal(Param[0],strlen(Param[0]));
						m_pShppRequest->AddFieldVal("接受",4);					
					}
				//	for(int j=2;j<input2.count;j++)
				//		m_pShppRequest->AddFieldVal(Param[atoi(input2.num[j])-1],strlen(rtrim(Param[atoi(input2.num[j])-1])));
					m_pShppRequest->AddFieldVal(Param[2],strlen(Param[2]));
					m_pShppRequest->AddFieldVal(Param[4],strlen(Param[4]));
					m_pShppRequest->AddFieldVal(Param[8],strlen(Param[8]));
				}
				catch(...)
				{
					printf("互通短信解析出错 %s %d,err=%d\n",phone,__LINE__,::GetLastError());
					return -1;
				}
				m_nCountLine=m_nCountLine+1;
				number=number-countindex;
				rebuf=rebuf+countindex;
				while(rebuf[0]==' ')
				{
					rebuf=rebuf+1;
					number=number-1;
				}
			}//添加记录结束		
			else
			{
				m_pShppRequest->Reset();
				return -1;
			}
		}
	}
	
	if((endindex==1)&&(m_nCountLine!=0))
	{
		//处理结尾
		char pList[256];
		m_pShppRequest->PutParameter(s_chSeparator);		
		sprintf(pList,"你的互通短信话单总费用:%0.2f元;",m_fFeeCount);
		m_tempfee=m_tempfee+m_fFeeCount;
		m_pShppRequest->PutParameter(pList);
		sprintf(pList,"你的互通短信话单总次数:%d次;", m_nCountLine);
		m_tempcount=m_tempcount+m_nCountLine;
		m_pShppRequest->PutParameter(pList);
		m_pShppRequest->PutParameter(s_chSeparator);

	//	*m_pfOutFeeCount += m_fFeeCount;
	//	*m_pnLineCount += m_nCountLine;
		//m_pShppRequest->Flush();
		
		m_fFeeCount  = 0.0;
		m_nCountLine = 0;
		startindex   = 0;
		endindex     = 0;
	}
	return 0;
}
//==========================================
int CTuxedo::yidongmengwang(char *rebuf,char *phone)
{
	char *str=NULL;
	int number = 100;
//	char linebuf[256];
	float tempfee = 0.0;
	if((strstr(rebuf,"--------")!=NULL)&&(strlen(rebuf)<150))
		return 0;	
	if((strstr(rebuf,"合计")!=NULL)&&(startindex==0))
		return 0;
	if(strlen(rebuf)<10)
		return 0;
	
	if(startindex==0)
	{
		m_pShppRequest->ResetField();
		m_pShppRequest->ResetField();
		m_pShppRequest->AddPrintField(15);    //主叫号
		m_pShppRequest->AddPrintField(5);    //叫呼转号码
		m_pShppRequest->AddPrintField(15);//4日期  时间20020321  03-21
		m_pShppRequest->AddPrintField(7);   //5时长(秒)
		m_pShppRequest->AddPrintField(8);   //6话费
		m_pShppRequest->PrintLine("短信话单-移动梦网短信话单",LPLCENTER);
//		m_pShppRequest->PutParameter("对方号码    方式  日期 时间     时长 话费 通话地");
		m_pShppRequest->PutParameter("对方号码       方式      日期       费用   状态");
		m_pShppRequest->PutParameter(s_chSeparator);
		
		startindex  = 1;
		m_fFeeCount =0.0;//费用
		m_nCountLine=0;;//行数
		
		input1.count = 8;
		for(int i=0;i<15;i++)
			for(int j=0;j<3;j++)
			{
				input1.num[i][j]='\0';
				input2.num[i][j]='\0';
			}
			strcpy(input1.num[0],"24");strcpy(input1.num[1],"24");strcpy(input1.num[2],"22");
			strcpy(input1.num[3],"8");strcpy(input1.num[4],"8");strcpy(input1.num[5],"8");
			strcpy(input1.num[6],"6");strcpy(input1.num[7],"8");
			
			input2.count = 5;//1参数 那个是时间  3参数
			strcpy(input2.num[0],"1");strcpy(input2.num[1],"2");strcpy(input2.num[2],"3");
			strcpy(input2.num[3],"5");strcpy(input2.num[4],"9");strcpy(input2.num[5],"3");			
			//strcpy(input2.num[6],"10");strcpy(input2.num[7],"3");
			
	}
	
	if((str=strstr(rebuf,"合计"))!=NULL)
	{
		endindex=1;
	}
	else
	{	
//		rebuf=rebuf+113;//将前面的横线去掉
		int countindex=0;
		number = strlen(rebuf);
		while(number>2)
		{
			//	str=rebuf;
			countindex=0;
			countindex=mengwangaddline(rebuf,9,3);
			if(countindex>0)
			{//加记录到内存
				tempfee=0.0;
				tempfee=atof(Param[4]);//费用
				m_fFeeCount=m_fFeeCount+tempfee;

				char tempbuf1[6];
				memset(tempbuf1,'\0',6);
				sprintf(tempbuf1,"%.2f",tempfee);
				try
				{
					if(strncmp(Param[0],phone,strlen(phone))==0)
					{
						m_pShppRequest->AddFieldVal(Param[1],strlen(rtrim(Param[1])));
						m_pShppRequest->AddFieldVal("发送",4);
					}
					else
					{
						m_pShppRequest->AddFieldVal(Param[0],strlen(rtrim(Param[0])));
						m_pShppRequest->AddFieldVal("接受",4);					
					}
				//	for(int j=2;j<input2.count;j++)
				//		m_pShppRequest->AddFieldVal(Param[atoi(input2.num[j])-1],strlen(rtrim(Param[atoi(input2.num[j])-1])));
					m_pShppRequest->AddFieldVal(Param[2],strlen(Param[2]));
					m_pShppRequest->AddFieldVal(Param[4],strlen(Param[4]));
					m_pShppRequest->AddFieldVal(Param[8],strlen(Param[8]));
				}
				catch(...)
				{
					printf("移动梦网解析出错 %s %d\n",phone,__LINE__);
					return -1;
				}
				m_nCountLine=m_nCountLine+1;
				number=number-countindex;
				rebuf=rebuf+countindex;
				while(rebuf[0]==' ')
				{
					rebuf=rebuf+1;
					number=number-1;
				}
			}//添加记录结束		
			else
			{
				m_pShppRequest->Reset();
				return -1;
			}
		}
	}
	
	if((endindex==1)&&(m_nCountLine!=0))
	{
		//处理结尾
		char pList[256];
		m_pShppRequest->PutParameter(s_chSeparator);		
		sprintf(pList,"移动梦网短信 总费用:%0.2f元;",m_fFeeCount);
		m_tempfee=m_tempfee+m_fFeeCount;
		m_pShppRequest->PutParameter(pList);
		sprintf(pList,"移动梦网短信 总次数:%d次;", m_nCountLine);
		m_tempcount=m_tempcount+m_nCountLine;
		m_pShppRequest->PutParameter(pList);
		m_pShppRequest->PutParameter(s_chSeparator);

	//	*m_pfOutFeeCount += m_fFeeCount;
	//	*m_pnLineCount += m_nCountLine;
		//m_pShppRequest->Flush();
		
		m_fFeeCount  = 0.0;
		m_nCountLine = 0;
		startindex   = 0;
		endindex     = 0;
	}
	return 0;
}
//==========================================
int CTuxedo::daishouhuadan(char *rebuf,char *phone)
{
	char *str=NULL;
	int number = 100;
//	char linebuf[256];
	if((strstr(rebuf,"合计")!=NULL)&&(startindex==0)&&(strstr(rebuf,"-------")==NULL))
		return 0;
	if((strstr(rebuf,"--------")!=NULL)&&(strlen(rebuf)<150))
		return 0;	
	if((strstr(rebuf,"合计")!=NULL)&&(startindex==0))
		return 0;
	if(strlen(rebuf)<10)
		return 0;
	if((strstr(rebuf,"合计")!=NULL))
	{
		endindex=1;
		if((endindex==1)&&(m_nCountLine!=0))
		{
			//处理结尾
			char pList[256];
			m_pShppRequest->PutParameter(s_chSeparator);		
			sprintf(pList,"代收话单 总费用:%0.2f元;",m_fFeeCount);
			m_tempfee=m_tempfee+m_fFeeCount;
			m_pShppRequest->PutParameter(pList);
			sprintf(pList,"代收话单 总次数:%d次;", m_nCountLine);
			m_tempcount=m_tempcount+m_nCountLine;
			m_pShppRequest->PutParameter(pList);
			m_pShppRequest->PutParameter(s_chSeparator);
			
			//		*m_pfOutFeeCount += m_fFeeCount;
			//		*m_pnLineCount += m_nCountLine;
			//m_pShppRequest->Flush();
			
			m_fFeeCount  = 0.0;
			m_nCountLine = 0;
			startindex   = 0;
			endindex     = 0;
		}
		return 0;
	}

	if(startindex==0)
	{
		m_pShppRequest->ResetField();
		m_pShppRequest->AddPrintField(16);    //1对方号码
		m_pShppRequest->AddPrintField(6);     //2方式
		m_pShppRequest->AddPrintField(14);    //3日期  时间20020321  03-21
		m_pShppRequest->AddPrintField(6,2);   //4时长(秒)
		m_pShppRequest->AddPrintField(7,2);   //5话费
		m_pShppRequest->PrintLine("代收话单",LPLCENTER);
	  //m_pShppRequest->PutParameter("对方号码    方式  日期 时间     时长 话费 通话地");
		m_pShppRequest->PutParameter("业务名称    服务码       时间     类型   费用");
		m_pShppRequest->PutParameter(s_chSeparator);
		
		startindex  = 1;
		m_fFeeCount =0.0;//费用
		m_nCountLine=0;;//行数
		
		input1.count = 10;
		for(int i=0;i<15;i++)
			for(int j=0;j<3;j++)
			{
				input1.num[i][j]='\0';
			    input2.num[i][j]='\0';
			}

		input2.count = 5;//count 里面存放的几个是时间

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -