📄 cmscheck.sqc
字号:
} else if ( !strcmp( pcTranType, LOGQUERY ) ) /* 查询 */ { acCardStat[ BIT2_LEN ] [ BIT2_LEN ] = CHECK_YES; acCardStat[ BIT2_LEN ] [ BIT3_LEN ] = CHECK_YES; } if ( strcmp( pcTranType, LOGCANCEL ) ) /* 撤销 */ { /* 检查卡状态是否正常 */ iRtn = cmsApiChkCardStatIsNormal( &stCmsCardInfo, acCardStat ); if ( iRtn ) { ERRLOG return FAILED; } } strcpy( g_acTrcMsg, "检查卡状态是否正finish" ); TRCLOG1 /* 检查卡密码 */ if ( pcChkPwdFlg[ BIT1_LEN ] == CHECK_YES ) { iRtn = cmsApiChkCardPwd( &stCmsCardInfo, pcPasswd, pstPubcom->acChannelId ); if ( iRtn ) { ERRLOG return FAILED; } strcpy( g_acTrcMsg, "cmsApiChkCardPwd finish " ); TRCLOG1 } /* 检查卡磁道 */ if ( pcChkTrkFlg[ BIT1_LEN ] == CHECK_YES ) { sprintf( g_acTrcMsg, "进入磁道检查函数 Track2[%s] Track3[%s] ",pcTrack2, pcTrack3 ); TRCLOG1 /* modify in 2006-01-009 By Feng begin iRtn = cmsCardVerify( pcTrack2, pcTrack3 ); if ( iRtn == -1) { strcpy( g_acRspCode, "CMS1D1" ); pubCrtRspInfo( ); ERRLOG return FAILED; } else if (iRtn == 1) { strcpy( g_acRspCode, "CMS1F1" ); pubCrtRspInfo( ); ERRLOG return FAILED; } */ strpack( stCmsCardInit.cvnvryfunc ); if ( strlen( stCmsCardInit.cvnvryfunc ) ) { i = 0 ; while ( strcmp( nfunc_cvn_call[i].name, "NULL" ) ) { if ( !strcmp ( nfunc_cvn_call[i].name, stCmsCardInit.cvnvryfunc ) ) { nppfunc = nfunc_cvn_call[i].pfunc; ifound = 1; break; } i++ ; } if ( ifound == 0 ) { strcpy( g_acRspCode , "999999" ); strcpy( g_acRspMsg , "检查CVN函数没有配置!" ); return FAILED; } iRtn = ( *nppfunc) ( pcCardNo, pcTrack2, pcTrack3 ); if ( iRtn == -1) { ERRLOG return FAILED; } else if (iRtn == 1) { strcpy( g_acRspCode, "CMS1F1" ); pubCrtRspInfo( ); ERRLOG return FAILED; } } /* modify in 2006-01-009 By Feng begin */ strcpy( g_acTrcMsg, "PubKjy finish " ); TRCLOG1 } /* 检查交易限额 if ( !strcmp( pcTranType, LOGDEPOSIT ) || !strcmp( pcTranType, LOGOPENACC ) || !strcmp( pcTranType, LOGSAVECONFIRM ) || !strcmp( pcTranType, LOGOPENOTHACCT ) ) acMode[BIT1_LEN] = MODE_DEPOSIT; else if ( !strcmp( pcTranType, LOGWITHDRAW ) ) acMode[BIT1_LEN] = MODE_WITHDRAW; else if ( !strcmp( pcTranType, LOGCONSUME ) || !strcmp( pcTranType, LOGCONPREAUTH ) ) acMode[BIT1_LEN] = MODE_CONSUME; else if ( !strcmp( pcTranType, LOGTRANSFEROUT ) ) acMode[BIT1_LEN] = MODE_TRANSFEROUT; else if ( !strcmp( pcTranType, LOGTRANSFERIN ) ) acMode[BIT1_LEN] = MODE_TRANSFERIN; */ /* 检查附卡交易总限额 */ if ( ( stCmsCardInfo.cardflg[ BIT1_LEN ] == SUBMAIN_CARD ) && ( acMode[BIT1_LEN] ==MODE_WITHDRAW || acMode[BIT1_LEN] == MODE_CONSUME || acMode[BIT1_LEN] == MODE_TRANSFEROUT || ( acMode[BIT1_LEN] == MODE_TRANSFERIN && !strcmp( pcTranType, LOGCANCEL ) ) ) ) { if ( pcTranFlag[ BIT1_LEN ] == FLAG_NORMAL ) { if ( acMode[BIT1_LEN] == MODE_TRANSFERIN && !strcmp( pcTranType, LOGCANCEL ) ) stCmsCardInfo.acduseamt -= dAmount; else stCmsCardInfo.acduseamt += dAmount; if ( stCmsCardInfo.acduseamt <0.005 ) stCmsCardInfo.acduseamt = 0.0; if ( ( fabs( stCmsCardInfo.acdlmt ) > 0.005 ) && (stCmsCardInfo.acduseamt-stCmsCardInfo.acdlmt >0.005 )) { strcpy( g_acRspCode, "CMS1B8" ); pubCrtRspInfo( ); ERRLOG return FAILED; } } else { if ( acMode[BIT1_LEN] == MODE_TRANSFERIN && !strcmp( pcTranType, LOGCANCEL ) ) stCmsCardInfo.acduseamt += dAmount; else stCmsCardInfo.acduseamt -= dAmount; if ( stCmsCardInfo.acduseamt <0.005 ) stCmsCardInfo.acduseamt = 0.0; } /* 修改卡片信息表 */ pubStoVCmscardinfo( &stCmsCardInfo ); EXEC SQL UPDATE CMSCARDINFO SET acduseamt = :cmscardinfo_acduseamt WHERE cardno = :cmscardinfo_cardno; /* 修改出错 */ if ( SQLCODE ) { strcpy( g_acRspCode, "CMS114" ); pubCrtRspInfo( "cmscardinfo", SQLCODE ); ERRLOG return FAILED; } } if ( acMode[BIT1_LEN] == MODE_TRANSFERIN && !strcmp( pcTranType, LOGCANCEL ) ) { /* Feng modify in 20060225 begin */ if ( acTranFlag[ BIT1_LEN ] == FLAG_REVERSE ) acTranFlag[ BIT1_LEN ] = FLAG_NORMAL; else acTranFlag[ BIT1_LEN ] = FLAG_REVERSE; /* Feng modify in 20060225 end */ acMode[BIT1_LEN] = MODE_CONSUME; } strcpy( g_acTrcMsg, "cmsApiChkCardKindTranLimitAmt begin " ); TRCLOG1 if ( strlen( acMode ) > 0 && acMode[BIT1_LEN] != MODE_OTHERS && fabs( dAmount ) > 0.005 ) { /* 检查卡片种类和卡片的交易限额并统计卡交易 */ /* feng modify in 2006-02-25 begin */ iRtn = cmsApiChkCardKindTranLimitAmt( stCmsCardInfo.cardno, \ stCmsCardInfo.cardkind, pstPubcom->acChannelId, pcTranType,\ dAmount, pcCcy, acMode[BIT1_LEN], pstPubcom->acTranDate, \ pcMid, pcMctmcc, pstPubcom->lSerSeqNo, acTranFlag[ BIT1_LEN ] ); /* feng modify in 2006-02-25 end */ if ( iRtn ) { ERRLOG return FAILED; } } /* 累计积分 */ if ( strlen( acMode ) > 0 && acMode[BIT1_LEN] != MODE_OTHERS && fabs( dAmount ) > 0.005 ) { iRtn = cmsApiAccumTotal( pstPubcom, stCmsCardInfo.cardno, \ dAmount, pcCcy, pcTranType, pcMid, pcMctmcc, \ stCmsCardInfo.issuebrc, stCmsCardInfo.custno, \ acTranFlag[ BIT1_LEN ] ); /* feng modify in 2006-02-25 end */ if ( iRtn ) { ERRLOG return FAILED; } } strcpy( g_acTrcMsg, "cmsApiChkCardKindTranLimitAmt finish " ); TRCLOG1 strcpy( g_acTrcMsg, "Api卡正常检查结束.." ); TRCLOG2 return SUCCESS;}/******************************************************* ** 函数名称:cmsApiChkCardValid ** 中文名称:检查卡有效 ** 功能描述:检查卡有效 ** 输入参数: ** pstCmsCardInfo ---- 卡片信息表 ** 输出参数:无 ** 返回结果:int ** 0 ---- 成功(是) ** -1 ---- 失败*******************************************************/int cmsApiChkCardValid( pstCmsCardInfo )struct cmscardinfo * pstCmsCardInfo;{ /*定义局部变量*/ char acCardStat[ BIT21_LEN ][BIT11_LEN]; /* 卡状态检查标志 */ int iRtn; /* 函数返回值 */ int iNumx; /* 数组计数器 */ int iNumy; /* 数组计数器 */ strcpy( g_acTrcMsg, "api卡valid检查处理开始.." ); TRCLOG2 /* 检查卡片状态 */ switch ( pstCmsCardInfo->crdsts[ BIT1_LEN ] ) { /* 正常 */ case CARDOKSTS: break; /* 已销卡 */ case CARDCCSTS: /* 卡已经销卡 */ strcpy( g_acRspCode, "CMS192" ); pubCrtRspInfo( pstCmsCardInfo->cardno ); ERRLOG return FAILED; break; /* 未制卡 */ case CARDKCSTS: if ( pstCmsCardInfo->cardstat[ BIT14_LEN ] != BIT14_CARDBHAPLY ) { /* 卡未制卡 */ strcpy( g_acRspCode, "CMS193" ); pubCrtRspInfo( pstCmsCardInfo->cardno ); ERRLOG return FAILED; } break; /* 未发卡 */ case CARDNGSTS: if ( pstCmsCardInfo->cardstat[ BIT14_LEN ] != BIT14_CARDBHAPLY ) { /* 卡未发卡 */ strcpy( g_acRspCode, "CMS1D4" ); pubCrtRspInfo( pstCmsCardInfo->cardno ); ERRLOG return FAILED; } break; } /* 卡检查状态数组除首位外全置为不检查 */ for ( iNumx = 0; iNumx < BIT21_LEN; iNumx ++ ) for ( iNumy = 0; iNumy < BIT11_LEN; iNumy ++ ) { if ( iNumy == 0 ) acCardStat[iNumx][iNumy] = CHECK_YES; else acCardStat[iNumx][iNumy] = CHECK_NO; } acCardStat[ BIT2_LEN ] [ BIT2_LEN ] = CHECK_YES; acCardStat[ BIT2_LEN ] [ BIT3_LEN ] = CHECK_YES; acCardStat[ BIT3_LEN ] [ BIT2_LEN ] = CHECK_YES; acCardStat[ BIT3_LEN ] [ BIT3_LEN ] = CHECK_YES; acCardStat[ BIT5_LEN ] [ BIT2_LEN ] = CHECK_YES; acCardStat[ BIT6_LEN ] [ BIT2_LEN ] = CHECK_YES; acCardStat[ BIT7_LEN ] [ BIT2_LEN ] = CHECK_YES; acCardStat[ BIT9_LEN ] [ BIT2_LEN ] = CHECK_YES; acCardStat[ BIT12_LEN ] [ BIT2_LEN ] = CHECK_YES; acCardStat[ BIT13_LEN ] [ BIT2_LEN ] = CHECK_YES; acCardStat[ BIT14_LEN ] [ BIT2_LEN ] = CHECK_YES; acCardStat[ BIT14_LEN ] [ BIT3_LEN ] = CHECK_YES; acCardStat[ BIT14_LEN ] [ BIT4_LEN ] = CHECK_YES; acCardStat[ BIT15_LEN ] [ BIT2_LEN ] = CHECK_YES; /* 检查卡状态是否正常 */ iRtn = cmsApiChkCardStatIsNormal( pstCmsCardInfo, acCardStat ); if ( iRtn ) { ERRLOG return FAILED; } strcpy( g_acTrcMsg, "检查卡状态是否正finish" ); TRCLOG1 strcpy( g_acTrcMsg, "Api卡valid检查结束.." ); TRCLOG2 return SUCCESS;}/******************************************************* ** 函数名称:cmsApiChkCardStat ** 中文名称:检查卡有效 ** 功能描述:检查卡有效 ** 输入参数: ** 输出参数:无 ** 返回结果:int ** 0 ---- 成功(是) ** -1 ---- 失败*******************************************************/int cmsApiChkCardStat( pcCardNo, piRetCode )char *pcCardNo;int *piRetCode;{ /*定义局部变量*/ char acCardStat[ BIT21_LEN ][BIT11_LEN]; /* 卡状态检查标志 */ int iRtn; /* 函数返回值 */ int iNumx; /* 数组计数器 */ int iNumy; /* 数组计数器 */ struct cmscardinfo stCmsCardInfo; memset( &stCmsCardInfo, 0x00, sizeof( struct cmscardinfo ) ); strcpy( stCmsCardInfo.cardno, pcCardNo ); strpack( stCmsCardInfo.cardno ); if ( pubReadCmscardinfo( &stCmsCardInfo ) ) { ERRLOG goto Exit; } strcpy( g_acTrcMsg, "api卡valid检查处理开始.." ); TRCLOG2 /* 检查卡片状态 */ switch ( stCmsCardInfo.crdsts[ BIT1_LEN ] ) { /* 正常 */ case CARDOKSTS: break; /* 已销卡 */ case CARDCCSTS: /* 卡已经销卡 */ strcpy( g_acRspCode, "CMS192" ); pubCrtRspInfo( stCmsCardInfo.cardno ); ERRLOG goto Exit; break; /* 未制卡 */ case CARDKCSTS: if ( stCmsCardInfo.cardstat[ BIT14_LEN ] != BIT14_CARDBHAPLY ) { /* 卡未制卡 */ strcpy( g_acRspCode, "CMS193" ); pubCrtRspInfo( stCmsCardInfo.cardno ); ERRLOG goto Exit; } break; /* 未发卡 */ case CARDNGSTS: if ( stCmsCardInfo.cardstat[ BIT14_LEN ] != BIT14_CARDBHAPLY ) { /* 卡未发卡 */ strcpy( g_acRspCode, "CMS1D4" ); pubCrtRspInfo( stCmsCardInfo.cardno ); ERRLOG goto Exit; } break; } /* 卡检查状态数组除首位外全置为不检查 */ for ( iNumx = 0; iNumx < BIT21_LEN; iNumx ++ ) for ( iNumy = 0; iNumy < BIT11_LEN; iNumy ++ ) { if ( iNumy == 0 ) acCardStat[iNumx][iNumy] = CHECK_YES; else acCardStat[iNumx][iNumy] = CHECK_NO; } acCardStat[ BIT7_LEN ] [ BIT2_LEN ] = CHECK_YES; acCardStat[ BIT15_LEN ] [ BIT2_LEN ] = CHECK_YES; /* 检查卡状态是否正常 */ iRtn = cmsApiChkCardStatIsNormal( &stCmsCardInfo, acCardStat ); if ( iRtn ) { ERRLOG goto Exit; } strcpy( g_acTrcMsg, "检查卡状态是否正finish" ); TRCLOG1 strcpy( g_acTrcMsg, "Api卡valid检查结束.." ); TRCLOG2Exit: if( !strcmp( g_acRspCode, RSP_OK ) ) { *piRetCode = 0; return SUCCESS; } else { *piRetCode = -1; return FAILED ; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -