📄 handle.cpre
字号:
/* * This is a part of the Application Preconsole * - Channel Access - DT. * Copyright (C) 2001-2001 ABC.SDC. * All rights reserved. * * This source code is only intended as a supplement to the * Application Preconsole Reference and related * electronic documentation provided with the library. * See these sources for detailed information regarding the * Application Preconsole product. * * Update record: * 2001-09-17 Chang Yong - create implementation file * for transaction */#include "ap.h"#include "apca.h"#include "dt.h"/* * Function macros defined in this file */#define RETURN_DELETE \ { \ DeleteXml(pxmlstruReq); \ DeleteXml(pxmlstruResp); \ return EXCEPTION; \ }#define ASSURE_NORMAL(r) \ { \ RESULT rTemp; \ if (!VERIFY_NORMAL(rTemp = (r))) \ { \ if (rTemp == INVALID) \ strcpy(ptoastru->szRespCode, AP_RESPCODE_LOGERR); \ else \ strcpy(ptoastru->szRespCode, AP_RESPCODE_SYSERR); \ RETURN_DELETE \ } \ }RESULT CreateReqXml(PXMLSTRU pxmlstruReq, PTIASTRU ptiastru){ TIMESTRU timestru; char szReqDate[AP_LEN_DATE + 1]; char szReqTime[AP_LEN_TIME + 1]; timestru = GetTime(); sprintf(szReqDate, "%04d%02d%02d", timestru.nYear, timestru.nMon, timestru.nDay); sprintf(szReqTime, "%02d%02d%02d", timestru.nHour, timestru.nMin, timestru.nSec); /* * 创建XML请求报文结构 */ ASSERT_NORMAL(CreateXml(pxmlstruReq, FALSE, AP_PATH_ROOT, NULL)); ASSERT_NORMAL(AP_INSERT_EXT(AP_PATH_MSGTYPE, AP_MSGTYPE_SUBMITREQ)); ASSERT_NORMAL(AP_INSERT_EXT(AP_PATH_REQDATE, szReqDate)); ASSERT_NORMAL(AP_INSERT_EXT(AP_PATH_REQTIME, szReqTime)); ASSERT_NORMAL(AP_INSERT_EXT(AP_PATH_REQID, ptiastru->szReqId)); ASSERT_NORMAL(AP_INSERT_EXT(AP_PATH_REQSEQNO, ptiastru->szReqSeqNo)); return NORMAL;}/* * Handle Save-Service Query Balance */RESULT HandleSsQueryBal(PTIASTRU ptiastru, PTOASTRU ptoastru){ char szBal[AP_LEN_BAL + 1]; XMLSTRU xmlstruReq; XMLSTRU xmlstruResp; PXMLSTRU pxmlstruReq, pxmlstruResp; pxmlstruReq = &xmlstruReq; pxmlstruResp = &xmlstruResp; memset(&xmlstruReq, 0, sizeof(xmlstruReq)); memset(&xmlstruResp, 0, sizeof(xmlstruResp)); ASSURE_NORMAL(CreateReqXml(pxmlstruReq, ptiastru)) ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_TRANSCODE, AP_TRANSCODE_SS_QUERYBAL)) ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_ACCNO, ptiastru->szAccNo)) ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_ACCPWD, ptiastru->szAccPwd)) ASSURE_NORMAL(ApCaSubmit(pxmlstruReq, pxmlstruResp)) AP_DEMAND_EXT(AP_PATH_RESPCODE, ptoastru->szRespCode); if (strcmp(ptoastru->szRespCode, AP_RESPCODE_ACCEPT) == 0) { if (VERIFY_NORMAL(AP_DEMAND_EXT(AP_PATH_BAL, szBal))) ptoastru->dBal = atof(szBal); } DeleteXml(pxmlstruReq); DeleteXml(pxmlstruResp); return NORMAL;}/* * Handle Mediate-Service Query Phone Cost */RESULT HandleMsQueryPhoneCost(PTIASTRU ptiastru, PTOASTRU ptoastru){ char szPhoneCost[AP_LEN_PHONECOST + 1]; XMLSTRU xmlstruReq; XMLSTRU xmlstruResp; PXMLSTRU pxmlstruReq, pxmlstruResp; pxmlstruReq = &xmlstruReq; pxmlstruResp = &xmlstruResp; memset(&xmlstruReq, 0, sizeof(xmlstruReq)); memset(&xmlstruResp, 0, sizeof(xmlstruResp)); ASSURE_NORMAL(CreateReqXml(pxmlstruReq, ptiastru)) ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_TRANSCODE, AP_TRANSCODE_MS_QUERYPHONECOST)) ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_PHONENO, ptiastru->szPhoneNo)) ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_COLLECTMON, ptiastru->szCollectMon)) ASSURE_NORMAL(ApCaSubmit(pxmlstruReq, pxmlstruResp)) AP_DEMAND_EXT(AP_PATH_RESPCODE, ptoastru->szRespCode); if (strcmp(ptoastru->szRespCode, AP_RESPCODE_ACCEPT) == 0) { if (VERIFY_NORMAL(AP_DEMAND_EXT(AP_PATH_PHONECOST, szPhoneCost))) ptoastru->dPhoneCost = atof(szPhoneCost); } DeleteXml(pxmlstruReq); DeleteXml(pxmlstruResp); return NORMAL; }/* * Handle Mediate-Service Collect Phone Cost */RESULT HandleMsCollectPhoneCost(PTIASTRU ptiastru, PTOASTRU ptoastru){ char szAmt[AP_LEN_AMT + 1]; XMLSTRU xmlstruReq; XMLSTRU xmlstruResp; PXMLSTRU pxmlstruReq, pxmlstruResp; pxmlstruReq = &xmlstruReq; pxmlstruResp = &xmlstruResp; memset(&xmlstruReq, 0, sizeof(xmlstruReq)); memset(&xmlstruResp, 0, sizeof(xmlstruResp)); ASSURE_NORMAL(CreateReqXml(pxmlstruReq, ptiastru)) ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_TRANSCODE, AP_TRANSCODE_MS_COLLECTPHONECOST)) ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_ACCNO, ptiastru->szAccNo)) ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_ACCPWD, ptiastru->szAccPwd)) sprintf(szAmt, "%19.2lf", ptiastru->dAmt); ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_AMT, szAmt)) ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_PHONENO, ptiastru->szPhoneNo)) ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_COLLECTMON, ptiastru->szCollectMon)) ASSURE_NORMAL(ApCaSubmit(pxmlstruReq, pxmlstruResp)) AP_DEMAND_EXT(AP_PATH_RESPCODE, ptoastru->szRespCode); DeleteXml(pxmlstruReq); DeleteXml(pxmlstruResp); return NORMAL; }/* End of this file */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -