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

📄 change_0201.ec

📁 证券交易系统
💻 EC
字号:
/* * 证券交易系统 城综网帐户信息校验 打包解包模块(与代理集中点) * 时间: 2001.2.21*/#include "../incl/bank.h"$include sqlca;extern   SEND_NET_0201   send_net_0201;extern   RECV_NET_0201   recv_net_0201;extern  int sndrcv_account();/* 按长度读取字段模块(来自代理集中点) */#define GET_REGION(region,recv_data)                                   \        for ( ; strncmp (tmp,"=",1) != 0; )   *tmp ++;                 \        *tmp++;                                                        \        tmpa = tmp;                                                    \        for ( lena = 0; strncmp (tmpa,"|",1) != 0; lena++)  *tmpa++;   \        memset( recv_data.region, 0x00, sizeof(recv_data.region) );    \        memcpy( recv_data.region, tmp, lena );                         \        for ( i=0; i<(lena+1); i++)  *tmp ++;                          \        recv_data.region[ lena ] = '\0';                               \/* 解包模块(来自代理集中点) */int   unpknet_stock_0201( rcv_data,duig_0201_buffer)char  *rcv_data;char  *duig_0201_buffer;{        int   Ii,i,lena,k;        char  *tmp,*tmpa;        char  tmp1[256];        char  *rbuf;        tmp = rcv_data;         GET_REGION ( trans_type, recv_net_0201 )        GET_REGION ( acco_type, recv_net_0201 )        GET_REGION ( account, recv_net_0201 )        GET_REGION ( amount, recv_net_0201 )        GET_REGION ( req_serial, recv_net_0201 )        GET_REGION ( time, recv_net_0201 )/* add by lyf on 2001.3.27 */        if(recv_net_0201.acco_type[0] >= '1'&&recv_net_0201.acco_type[0] <= '3')        {             rbuf = rcv_data;             k = sndrcv_account(rcv_data,rbuf);	     if (k < 0)		return(k);	     strcpy(duig_0201_buffer,rbuf);	     return -20;        }     /* add by lyf on 2001.3.27 */        if ( !memcmp(recv_net_0201.account,"436742",6) ||             !memcmp(recv_net_0201.account,"651009",6) )        {           WriteLog(LOGFILE,"拆包处理结束(来自代理集中点)!");           return ( 0 );        }        else        {           WriteLog(LOGFILE,"帐号不符合要求!");           return ( -1 );        }}pktonet_stock_0201( snd_data )char    *snd_data;{        int    lenb,len;        int    i,T_blan;        char   tmp_blan1[2],tmp_blan2[13];        char   tmp[1024],lenstr[2];        char   *temp,*snd_temp;                  memset ( tmp,0,1024 );        temp = tmp;        len = 0;        lenb = strlen(send_net_0201.retcode);        memcpy ( temp,"RETCODE=",8 );        for ( i=0; i<8; i++ ) *temp ++;        memcpy ( temp,send_net_0201.retcode,lenb);        for ( i=0; i<lenb; i++ ) *temp ++;        memcpy ( temp,"|",1 );        *temp++;        len=len+lenb+9;           lenb = strlen(send_net_0201.errmsg);           memcpy ( temp,"ERRMSG=",7 );           for ( i=0; i<7; i++ ) *temp ++;           memcpy ( temp,send_net_0201.errmsg,lenb);           for ( i=0; i<lenb; i++ ) *temp ++;           memcpy ( temp,"|",1 );           *temp ++;           len=len+lenb+8;        lenb = strlen(send_net_0201.balance);        if (lenb != 0)         {           memcpy ( temp,"BALANCE=",8 );           for ( i=0; i<8; i++ ) *temp ++;/* add by lyf on 2001.3.28 余额转换*/           sscanf(send_net_0201.balance,"%13s%2s",tmp_blan2,tmp_blan1);           T_blan = atoi(tmp_blan2); 	   sprintf(tmp_blan2,"%d",T_blan);	   strcpy(send_net_0201.balance,tmp_blan2);	   strcat(send_net_0201.balance,".");	   strcat(send_net_0201.balance,tmp_blan1);	   lenb = strlen(send_net_0201.balance);/* add by lyf on 2001.3.28 余额转换*/           memcpy ( temp,send_net_0201.balance,lenb);           for ( i=0; i<lenb; i++ ) *temp ++;           memcpy ( temp,"|",1 );           *temp ++;           len=len+lenb+9;        }           memcpy ( temp,"ANS_SERIAL=",11 );           for ( i=0; i<11; i++ ) *temp ++;/* add by lyf on 2001.3.28 应答流水号转换*/           T_blan = atoi(send_net_0201.ans_serial);           sprintf(send_net_0201.ans_serial,"%d",T_blan);           lenb = strlen(send_net_0201.ans_serial);/* add by lyf on 2001.3.28 应答流水号转换*/           memcpy ( temp,send_net_0201.ans_serial,lenb);           for ( i=0; i<lenb; i++ ) *temp ++;           memcpy ( temp,"|",1 );           *temp ++;           len=len+lenb+12;        temp[len] = '\0';        snd_temp = snd_data;        memcpy  ( snd_temp, "03" , 2 );        for ( i=0; i<2; i++ ) *snd_temp ++;        sprintf(lenstr,"%2d",len);        memcpy  ( snd_temp,lenstr , 2 );        for ( i=0; i<2; i++ ) *snd_temp ++;        memcpy  ( snd_temp,tmp , len );        return ( 0 );}

⌨️ 快捷键说明

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