int do_update_device_state(INNER_TRANS_REQUEST * pNode) { int ret=0; ST_PACK ArrayPack; // 设置返回包 ST_CPACK aPack; // 设置应答包 // ST_PACK *out_pack = &(aPack.pack); ST_CPACK sPack; // 设置发送包 ResetNormalCPack(&aPack, 0, 1); memset(&ArrayPack, 0, sizeof(ArrayPack)); ResetNormalCPack(&sPack, 0, 1); sPack.head.RequestType = 930057; SetHeadCol(&sPack, F_SORDER2,0); // 设置发送windows BU的头部视图信息 des2src(sPack.pack.sorder2,pNode->TerminalId); ret = ExtCall(0, g_Bank.DRTP_BRANCH, g_Bank.BCC_BASEFUNCNO, 0, g_Bank.TIMEOUT, &sPack, &aPack, &ArrayPack); if (ret < 0||aPack.head.retCode!=0) { if(ret<0) { writelog(LOG_ERR,"Call 930057 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return E_TRANS_UNKNOW_ERROR; } else { writelog(LOG_ERR,"Call 930057 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return aPack.head.retCode; } } return 0; }
static int elect_room_check_get_name(ST_PACK *in_pack,ST_PACK *out_pack,transfer_control_t *trans_ctl) { int ret = 0; char c_drtbranch[10]=""; char c_bccbasefuncno[10]=""; int DRTP_BRANCH =0; int BCC_BASEFUNCNO =0; trans_ctl->check_user_pwd = 0; CTcpSocket tcpsocket ; ST_PACK ArrayPack; // 设置返回包 ST_CPACK aPack; // 设置应答包 ST_CPACK sPack; // 设置发送包 ret=GetParameter(2501, c_drtbranch); if(ret){ writelog(LOG_ERR,"get_parameter error,error code=[%d]",ret); return ret; } ret=GetParameter(2502, c_bccbasefuncno); if(ret){ writelog(LOG_ERR,"get_parameter error,error code=[%d]",ret); return ret; } DRTP_BRANCH = atoi(c_drtbranch); BCC_BASEFUNCNO = atoi(c_bccbasefuncno); ResetNormalCPack(&aPack, 0, 1); memset(&ArrayPack, 0, sizeof(ArrayPack)); ResetNormalCPack(&sPack, 0, 1); SetHeadCol(&sPack, F_SSECTYPES,F_LVOL0,F_SCUST_AUTH,0); // 设置发送windows BU的头部视图信息 sPack.head.RequestType = 847356; sPack.pack.lvol0=in_pack->lvol10;//房间号 ret = ExtCall(0, DRTP_BRANCH, BCC_BASEFUNCNO, 0, TIMEOUT, &sPack, &aPack, &ArrayPack); if (ret < 0||aPack.head.retCode!=0) { if(ret<0) { writelog(LOG_ERR,"Call 847356 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return ret; } else { writelog(LOG_ERR,"Call 847356 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return aPack.head.retCode; } } memcpy(out_pack->sbankname,aPack.pack.sbankname,81);//房间名称 out_pack->damt2=aPack.pack.damt0;//电价 writelog(LOG_ERR,"sbankname=[%s]",out_pack->sbankname); return 0; }
//char buffer[20]=""; char temp[128]=""; int ho_OpCount=0; int delay_time=0; double ho_Fee_Change=0; int ret=0; FILE *fp; TIniFile tf; int nrows=0; char path_name[128]=""; char file_name[128]=""; BANK_TRANSFER_HEAD trans_head; BANK_TRANSFER_RECORD trans_record; T_v_tif_shopdeptfee v_shopdeptfee; T_t_cif_shop t_shop; //系统正在结算,可以生成划拨文件 //sleep(1); //ret=DB_v_tif_shopdeptfee_read_sum_fee(&ho_OpCount,&ho_Fee_Change); if(ret) { writelog(LOG_ERR,"DB_v_tif_shopdeptfee_read_sum_fee err [%d]",ret); return ret; } ho_OpCount=4; ho_Fee_Change=12345.98; strcpy(path_name,"/ykt/ykt/src/bank/ftp"); sprintf(file_name,"%s/fd_%8.8s",path_name,getsysdate(NULL)); #ifdef DEBUG // strcpy(path_name,"./ftp/fd_20041009"); writelog(LOG_ALERT,"file_name2=[%s]",file_name); #endif fp = fopen(file_name,"wb"); if (fp==NULL) { writelog(LOG_ALERT,"Open indicate file fail"); return -1; } memcpy(trans_head.rmb_batch_no,BATCH_NO,sizeof(trans_head.rmb_batch_no)); fprintf(fp,"%-14.14s",trans_head.rmb_batch_no); //批量编号 memcpy(trans_head.rmb_start_seq,"000000",6); fprintf(fp,"%-6.6s",trans_head.rmb_start_seq); //填000000 trans_head.rmb_acc_status='0'; fprintf(fp,"%c",trans_head.rmb_acc_status); //记帐状态(填0) trans_head.rmb_chk_status='2'; fprintf(fp,"%c",trans_head.rmb_chk_status); //检查状态(填2) sprintf(trans_head.rmb_total_amount,"%-13d",int(ho_Fee_Change*100)); fprintf(fp,"%-13.13s",trans_head.rmb_total_amount); //总金额(11位整数2位小数,无小数点) sprintf(trans_head.rmb_total_num,"%-6d",ho_OpCount); fprintf(fp,"%-6.6s",trans_head.rmb_total_num); //总笔数 fprintf(fp,"%-13.13s",trans_head.rmb_enter_amount); //入帐金额 fprintf(fp,"%-6.6s",trans_head.rmb_enter_num); //入帐笔数 sprintf(trans_head.rmb_unit_name,"%-40s",UNIT_NAME); fprintf(fp,"%-40.40s",trans_head.rmb_unit_name); //单位名称 #ifdef DEBUG writelog(LOG_ALERT,"trans_head.rmb_unit_name=[%s]",trans_head.rmb_unit_name); #endif strcpy(trans_head.rmb_unit_account,UNIT_ACCOUNT); //sprintf(trans_head.rmb_unit_account,"%-20s"UNIT_ACCOUNT); fprintf(fp,"%-20.20s",trans_head.rmb_unit_account); //单位帐号 #ifdef DEBUG writelog(LOG_ALERT,"trans_head.rmb_unit_account=[%s]",trans_head.rmb_unit_account); #endif memcpy(trans_head.rmb_apply_date,getsysdate(NULL),sizeof(trans_head.rmb_apply_date)); fprintf(fp,"%-8.8s",trans_head.rmb_apply_date); //申请入帐日期(当天日期) //memcpy(trans_head.rmb_send_date,trans_head.rmb_apply_date,sizeof(trans_head.rmb_apply_date)); memcpy(trans_head.rmb_send_date,getsystime(NULL),sizeof(trans_head.rmb_send_date)); fprintf(fp,"%-8.8s",trans_head.rmb_send_date); //上传日期(当天日期) #ifdef DEBUG printf("[%14.14s]\n",trans_head.rmb_batch_no ); //批量编号 printf("[%6.6s]\n",trans_head.rmb_start_seq ); //填000000 printf("[%c]\n",trans_head.rmb_acc_status ); //记帐状态(填0) printf("[%c]\n",trans_head.rmb_chk_status ); //检查状态(填2) printf("[%13.13s]\n",trans_head.rmb_total_amount ); //总金额(11位整数2位小数,无小数点) printf("[%6.6s]\n",trans_head.rmb_total_num ); //总笔数 printf("[%13.13s]\n",trans_head.rmb_enter_amount ); //入帐金额(11位整数2位小数,无小数点) printf("[%6.6s]\n",trans_head.rmb_enter_num ); //入帐笔数 printf("[%40.40s]\n",trans_head.rmb_unit_name ); //单位名称 printf("[%20.20s]\n",trans_head.rmb_unit_account ); //单位帐号 printf("[%8.8s]\n",trans_head.rmb_apply_date ); //申请入帐日期(当天日期) printf("[%8.8s]\n",trans_head.rmb_send_date ); //上传日期(当天日期) #endif //写入划拨文件 // fprintf(fp,(char*)(&trans_head)); strcpy(temp,"1"); ret=DB_v_tif_shopdeptfee_open_select_by_c6_and_is_indep(temp); if(ret) { //db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_ALERT,"DB_v_tif_shopdeptfee_open_select_by_c6_and_is_indep[%d]",ret); return ret; } while(1) { //初始化宿主变量 ho_Fee_Change=0; memset(&v_shopdeptfee,0,sizeof(v_shopdeptfee)); memset(&t_shop,0,sizeof(t_shop)); ret=DB_v_tif_shopdeptfee_fetch_select_by_c6(&v_shopdeptfee); if(ret) { if(DB_NOTFOUND==ret) { if(0==nrows) { writelog(LOG_ERR,"DB_v_tif_shopdeptfee_fetch_select_by_c6[%d]",ret); break; } else break; //循环记录结束 } else { //db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_ERR,"DB_v_tif_shopdeptfee_fetch_select_by_c6[%d]",ret); return ret; } } ret=DB_t_cif_shop_read_by_shop_id(v_shopdeptfee.shop_id,&t_shop); if(ret) { //db_chk_err(__FILE__,__LINE__,&sqlca); writelog(LOG_ALERT,"DB_t_cif_shop_read_by_shop_id[%d]",ret); return ret; } strcpy(trans_record.rmb_batch_no1,BATCH_NO); sprintf(trans_record.rmb_seq_no,"%d",nrows); trans_record.rmb_acc_status1='0'; trans_record.rmb_tran_kind='2'; strncpy(trans_record.rmb_cust_name,t_shop.b_act_name,sizeof(trans_record.rmb_cust_name)); strncpy(trans_record.rmb_acc_no,t_shop.b_act_id,sizeof(trans_record.rmb_acc_no)); trans_record.rmb_cb_cr='0'; sprintf(trans_record.rmb_tran_amt,"%f",ho_Fee_Change); strcpy(trans_record.rmb_cur_code,"001"); strcpy(trans_record.rmb_host_no,"00000000"); memcpy(trans_record.rmb_ret_code," ",sizeof(trans_record.rmb_ret_code)); strcpy(trans_record.rmb_acc_date,"00000000"); strcpy(trans_record.rmb_host_no1,"000000000"); strcpy(trans_record.rmb_open_branch,"0000000"); memcpy(trans_record.rmb_vcho_kind," ",sizeof(trans_record.rmb_vcho_kind)); strcpy(trans_record.rmb_vcho_bat_no,"00"); strcpy(trans_record.rmb_vcho_no,"000000000"); strcpy(trans_record.rmb_memo," "); strcpy(trans_record.rmb_tran_info," "); fprintf(fp,(char*)(&trans_record)); nrows++; } fclose(fp); memset(pBankTrans,0,BANK_TRANS_PACKLEN); //开始银行发送清算报文 memcpy( pBankTrans->TradeCode,TRADE_BANK_BALANCE, sizeof(pBankTrans->TradeCode)); //写交易代码 //写交易日期和交易时间 getsysdate(pBankTrans->TradeDate); getsystime(pBankTrans->TradeTime); //写院校代码 sprintf(pBankTrans->CustNo,"%-16s",SCHOOL_CODE); //写银行卡号-此处约定为划拨文件名 sprintf(pBankTrans->BankCardNo,"%8.8s",getsysdate(NULL)); //写校验mac码 //写校验mac码----林钦此处应该用银行回传回来的动态密钥做mac密钥,此处改过来了 generate_mac((char*)pBankTrans,sizeof(pBankTrans),pBankTrans->MAC); //ANSIX99(mac_key,(char*)(&BankTransPak), BANK_TRANS_PACKLEN-LEN_MAC,BankTransPak.MAC); TRACE_BANK_TRANS(pBankTrans,"send transfer package"); //发送数据到银行并同时接收银行数据,此处不判断返回的mac校验 ret=send_to_and_recv_from_bank((char*)pBankTrans,BANK_TRANS_PACKLEN, (char*)pBankTrans,BANK_TRANS_PACKLEN,delay_time); if(ret) { writelog(LOG_ERR,"send_to_and_recv_from_bank error,errcode=[%d]",ret); return E_TRANS_BANK_NOANSWER; } TRACE_BANK_TRANS(pBankTrans,"recv transfer package"); //农行暂时未校验该mac,所以暂时屏蔽掉 ret=check_mac((char*)pBankTrans,BANK_TRANS_PACKLEN); if(ret) { writelog(LOG_ERR,"Receive data mac verify error,error code is [%d] ",ret); //sprintf(pNode->RetCode,"%d",E_TRANS_BANK_RECVERR); return E_TRANS_BANK_RECVERR; } writelog(LOG_INFO,"Congratulation, transer succeed!"); return 0; } */ //判断该设备是否签到过 int device_login_yes_or_no(int device_id) { int ret=0; ST_PACK ArrayPack; // 设置返回包 ST_CPACK aPack; // 设置应答包 // ST_PACK *out_pack = &(aPack.pack); ST_CPACK sPack; // 设置发送包 ResetNormalCPack(&aPack, 0, 1); memset(&ArrayPack, 0, sizeof(ArrayPack)); ResetNormalCPack(&sPack, 0, 1); sPack.head.RequestType = 240009; SetHeadCol(&sPack, F_SORDER2, 0); // 设置发送windows BU的头部视图信息 //memcpy(&(sPack.pack), in_pack, sizeof(sPack.pack)); sprintf(sPack.pack.sorder2,"%d",device_id); ret = ExtCall(0, g_Bank.DRTP_BRANCH, g_Bank.BCC_BASEFUNCNO, 0, g_Bank.TIMEOUT, &sPack, &aPack, &ArrayPack); if (ret < 0||aPack.head.retCode!=0) { if(ret<0) { writelog(LOG_ERR,"Call 240009 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return E_TRANS_UNKNOW_ERROR; } else { writelog(LOG_ERR,"Call 240009 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return aPack.head.retCode; } } return 0; }
int Pos_WriteErrCard(INNER_TRANS_REQUEST * pNode) { int ret=0; char card_id[12+1]=""; ST_PACK ArrayPack; // 设置返回包 ST_CPACK aPack; // 设置应答包 // ST_PACK *out_pack = &(aPack.pack); ST_CPACK sPack; // 设置发送包 ResetNormalCPack(&aPack, 0, 1); memset(&ArrayPack, 0, sizeof(ArrayPack)); des2src(card_id, pNode->CardNo); //向后台发起解挂申请 ResetNormalCPack(&sPack, 0, 1); sPack.head.RequestType = 847108; SetHeadCol(&sPack, F_LVOL0,F_LSERIAL1,F_LVOL2,0); // 设置发送windows BU的头部视图信息 //memcpy(&(sPack.pack), in_pack, sizeof(sPack.pack)); //判断登陆模式,使用客户号登陆还是学工号登陆 sPack.pack.lvol0=atoi(card_id); sPack.pack.lserial1=pNode->RecvNo; sPack.pack.lvol2=TXCODE_BANK_SCHOOL; ret = ExtCall(0, g_Bank.DRTP_BRANCH, g_Bank.BCC_BASEFUNCNO, 0, g_Bank.TIMEOUT, &sPack, &aPack, &ArrayPack); if (ret < 0||aPack.head.retCode!=0) { writelog(LOG_ERR,"Call 847108 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return E_TRANS_UNKNOW_ERROR; } return 0; }
static int do_query_240204(ST_PACK *in_pack,ST_PACK *out_pack,int *pRetCode,char *szMsg) { int ret = 0; char c_drtbranch[10]=""; char c_bccbasefuncno[10]=""; int DRTP_BRANCH =0; int BCC_BASEFUNCNO =0; ST_PACK ArrayPack; // 设置返回包 ST_CPACK aPack; // 设置应答包 ST_CPACK sPack; // 设置发送包 ret=GetParameter(2501, c_drtbranch); if(ret){ writelog(LOG_ERR,"get_parameter error,error code=[%d]",ret); return ret; } ret=GetParameter(2502, c_bccbasefuncno); if(ret){ writelog(LOG_ERR,"get_parameter error,error code=[%d]",ret); return ret; } DRTP_BRANCH = atoi(c_drtbranch); BCC_BASEFUNCNO = atoi(c_bccbasefuncno); ResetNormalCPack(&aPack, 0, 1); memset(&ArrayPack, 0, sizeof(ArrayPack)); ResetNormalCPack(&sPack, 0, 1); SetHeadCol(&sPack, F_SSECTYPES,F_LVOL0,F_SCUST_AUTH,0); // 设置发送windows BU的头部视图信息 sPack.head.RequestType = 847358; sPack.pack.lvol0=in_pack->lvol10;//房间号 ret = ExtCall(0, DRTP_BRANCH, BCC_BASEFUNCNO, 0, 10, &sPack, &aPack, &ArrayPack); if (ret < 0||aPack.head.retCode!=0) { if(ret<0) { writelog(LOG_ERR,"Call 847358 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); *pRetCode = aPack.head.retCode; return ret; } else { writelog(LOG_ERR,"Call 847358 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); strcpy(szMsg,aPack.pack.vsmess); // 错误信息 *pRetCode = aPack.head.retCode; return -1; } } memcpy(out_pack->sbankname,aPack.pack.sbankname,81);//房间名称 out_pack->damt2=aPack.pack.damt0;//电价 out_pack->damt1=aPack.pack.damt1;//房间余额 writelog(LOG_ERR,"sbankname=[%s]",out_pack->sbankname); return 0; }
int F950006(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret=0; ST_CPACK aPack; ST_PACK* out_pack = &(aPack.pack); char buf[256] = ""; int sysid = rPack->lcert_code; ret = CheckGatewayDynKey(sysid,rPack->scust_limit); if(ret) { *pRetCode = ret; goto L_RETU; } ret = GetParameter(rPack->lvol0,buf); if(ret) { *pRetCode = ret; goto L_RETU; } ResetNormalCPack(&aPack,0,1); SetCol(handle,0); SetCol(handle,F_SCARD0,0); des2src(out_pack->scard0,buf); return 0; L_RETU: return -1; }
static int DoResponse(const T_t_cardtrans& cardtrans, TRUSERID *handle, int *pRetCode, char *szMsg) { CAccTrans& ats = CAccTrans::GetInst(); TRANS& trans = ats.trans; ST_CPACK aPack; ST_PACK *outPack = &(aPack.pack); ResetNormalCPack(&aPack, 0, 1); SetCol(handle, F_LVOL0, F_LVOL1, F_LVOL7, F_LVOL8, F_DAMT0, F_LCERT_CODE, F_SDATE0, F_STIME0, F_LWITHDRAW_FLAG, F_LSERIAL0, F_LSERIAL1, F_SNOTE, F_VSMESS, 0); outPack->lwithdraw_flag = trans.termid; outPack->lvol0 = trans.cardno; outPack->lvol7 = D4U5(trans.cardbefbal * 100, 0); outPack->lvol8 = D4U5(trans.cardaftbal * 100, 0); if(trans.errcode) { outPack->lvol1 = 1; outPack->damt0 = trans.addamt; outPack->lcert_code = trans.transcode; outPack->lserial0 = cardtrans.termid; outPack->lserial1 = cardtrans.termseqno; strcpy(outPack->sdate0, cardtrans.transdate); strcpy(outPack->stime0, cardtrans.transtime); strcpy(outPack->snote, trans.remark); } PutRow(handle, outPack, pRetCode, szMsg); return 0; }
int F240009(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret=0; T_t_device t_device; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); memset(&t_device,0,sizeof(t_device)); ResetNormalCPack(&aPack,0,1); SetCol(handle,0); SetCol(handle,F_SCARD0,0); //writelog(LOG_ERR," deviceid=[%s]",rPack->sorder2); ret=DB_t_device_read_by_deviceid(atoi(rPack->sorder2),&t_device); if(ret) { writelog( LOG_ERR,"DB_t_device_read_by_deviceid error,errcode=[%d],deviceid=[%d]",ret,t_device.deviceid); *pRetCode=E_DB_DEVICE_R; goto L_RETU; } //writelog( LOG_ERR,"Device don't login,deviceid=[%d],login_flag=[%d]",deviceid,t_device.status); if(DEVISTAT_ONLINE!=t_device.status[0]) { writelog( LOG_ERR,"Device don't login,deviceid=[%d],login_flag=[%d]",t_device.deviceid,t_device.status); *pRetCode=E_DB_DEVI_LOGIN; goto L_RETU; } return 0; L_RETU: return -1; }
static int GetSysParam(const char *para,char *value) { int ret; ST_CPACK aPack,sPack; memset(&sPack,0,sizeof sPack); memset(&aPack,0,sizeof aPack); ResetNormalCPack(&sPack,0,1); SetHeadCol(&sPack,F_SNAME,F_SNAME2,0); sPack.head.RequestType = 850007; strcpy(sPack.pack.sname,"GDCT"); strcpy(sPack.pack.sname2,para); ret = ExtCall(0,g_mainsvr_drtpno,g_mainsvr_func,0,3,&sPack,&aPack,NULL); if(ret>=0) { if(aPack.head.retCode!=0) return aPack.head.retCode; strncpy(value,aPack.pack.vsvarstr0,128); return 0; } else { return -1; } }
int F240000(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret=0; CAccTrans *pAccTrans=CAccTrans::getInstance(); TRANS& trans=pAccTrans->trans; trans.termid=atoi(rPack->sorder2); char seed_key[17] = ""; char sInputPwd[33] = ""; //存放加密前的卡密钥 char sCryptPwd[33] = ""; //存放加密后的卡密钥 T_t_card card; memset(&card,0,sizeof(card)); ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); ResetNormalCPack(&aPack,0,1); SetCol(handle,0); SetCol(handle,F_LVOL0,F_DAMT0,F_DAMT1,F_DAMT2,F_LVOL1,F_LVOL2,F_SDATE0,0); trans.cardno=rPack->lvol0; if(trans.cardno<1) trans.cardno=atoi(rPack->sserial0); ret=DB_t_card_read_by_cardno(trans.cardno,&card); if(ret) { writelog(LOG_ERR,"Create serial_no error,error code=[%d]",ret); return ERRINFO(E_CARD_LOGOUT,trans.cardno); } if(card.status[0]!=STATUS_NORMAL) { return ERRINFO(E_CARD_LOGOUT,trans.cardno); } if('1'==card.frozeflag[0]) { return ERRINFO(E_CARD_FREEZE,trans.cardno); } if('1'==card.lossflag[0]) { return ERRINFO(E_CARD_LOST,trans.cardno); } if('1'==card.badflag[0]) { return ERRINFO(E_CARD_BADRECORD,trans.cardno); } if('1'==card.lockflag[0]) { return ERRINFO(E_CARDNO_LOCKED,trans.cardno); } des2src(sInputPwd,rPack->scust_limit); //卡密码 strcpy(seed_key,STATIC_SEED_KEY); //种子密钥 EncodePwd(seed_key,sInputPwd,sCryptPwd,0); //加密 if(strcmp(sCryptPwd,card.cardpwd)!=0) { writelog(LOG_ERR,"card err input[%s]db[%s]",sCryptPwd,card.cardpwd); return E_CARDPWD; } PutRow(handle,out_pack,pRetCode,szMsg); return 0; }
int F847319(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg) { int ret,i; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); memset(&aPack,0,sizeof aPack); ResetNormalCPack(&aPack,0,1); SetCol(handle,0); SetCol(handle,F_LVOL0,F_LVOL1,F_DAMT0,F_DAMT1,F_DAMT2,F_SBANKNAME,F_SADDR,F_VSMESS,0); i = 0; while(g_query_func[i].tx_code != -1) { if(g_query_func[i].tx_code == in_pack->lcert_code) { // ret = g_query_func[i].do_func(in_pack,out_pack,pRetCode,szMsg); if(ret) { writelog(LOG_ERR,"处理请求[%d]失败errcode[%d]",in_pack->lcert_code,*pRetCode); return ret; } PutRow(handle,out_pack,pRetCode,szMsg); return 0; } i++; } *pRetCode = E_INPUT_DATA_INVAILD; return -1; }
int F847306(TRUSERID *handle, int iRequest, ST_PACK *in_pack, int *pRetCode, char *szMsg) { int ret = 0; char szStuEmpNo[21] = ""; char szAccSerOutOfDate[9] = ""; double dRemainBalance = 0.0; double dOweBalanece = 0.0; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); ResetNormalCPack(&aPack, 0, 1); SetCol(handle,0); SetCol(handle,F_LVOL11,0); memcpy(szStuEmpNo, in_pack->scust_auth, sizeof(szStuEmpNo) - 1); // ret = GetAccoutInfo(in_pack->scust_auth, &(out_pack->damt0), &(out_pack->damt1), out_pack->sphone); out_pack->lvol11 = GetAccoutInfo(szStuEmpNo, &dRemainBalance); if(out_pack->lvol11==0) out_pack->lvol11 = 1; else if(out_pack->lvol11 == -2) out_pack->lvol11 = -1003; // if (ret) // out_pack->lvol11 = ret; // L_LVOL11作为返回码查看 // else // out_pack->lvol11 = 999; out_pack->damt0 = dRemainBalance; // out_pack->damt1 = dOweBalanece; // memcpy(szAccSerOutOfDate, out_pack->sphone, sizeof(szAccSerOutOfDate) - 1); PutRow(handle, out_pack, pRetCode, szMsg); return 0; }
int F847150(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret =0; T_t_aif_account tAccount; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); memset(&tAccount,0,sizeof(tAccount)); ResetNormalCPack(&aPack,0,1); SetCol(handle,0); SetCol(handle,F_SBANKNAME,0); if(!strlen(rPack->sbank_acc)) { *pRetCode=E_INPUT_ACTNO_NULL; goto L_RETU; } ret=DB_t_aif_account_read_by_account_id(rPack->sbank_acc, &tAccount); if(ret) { if(DB_NOTFOUND==ret) *pRetCode= E_ACTNO_NOT_EXIST; else *pRetCode= E_DB_ACCOUNT_R; goto L_RETU; } strcpy(out_pack->sbankname,tAccount.cut_name); PutRow(handle,out_pack,pRetCode,szMsg); return 0; L_RETU: return -1; }
int F847353(TRUSERID *handle, int iRequest, ST_PACK *in_pack, int *pRetCode, char *szMsg) { int error_code = 0; int cut_id = in_pack->lvol0; int money = 0; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); ResetNormalCPack(&aPack, 0, 1); Save_Info save_info; memset(&save_info, 0, sizeof(save_info)); SetCol(handle,0); SetCol(handle, F_DAMT0, F_DAMT1, F_SPHONE, F_LVOL10, F_LVOL0, 0); CheckAccountNo(cut_id, &money, &error_code); out_pack->lvol0 = money; if (error_code != 0) { g_LogFile.WriteLogEx(1001, "客户号[%d]--转帐金额[%d]--错误码[%d]--序号[%d]", cut_id, money, error_code, ++count2); error_code = DLLFUN_ERR_CHECK_ACC_THIRD_PART_FAIL; } *pRetCode = error_code; PutRow(handle, out_pack, pRetCode, szMsg); return error_code; }
int ClearCardInfo(TRUSERID *handle,int *pRetCode,char *szMsg) { int ret=0; CAccTrans& ats=CAccTrans::GetInst(); TRANS& trans=ats.trans; T_t_card tCard; memset(&tCard,0,sizeof(tCard)); ret=DB_t_card_read_by_cardphyid_and_status(trans.cardphyid,"1",&tCard); if(ret) { writelog(LOG_ERR,"cardno[%d]",trans.cardno); if(DB_NOTFOUND==ret) { ST_CPACK aPack; ST_PACK *outPack = &(aPack.pack); ResetNormalCPack(&aPack,0,1); SetCol(handle,0); SetCol(handle,F_LVOL0,F_VSMESS,0); strcpy(outPack->vsmess,"该卡信息可以清空"); PutRow(handle,outPack,pRetCode,szMsg); return 0; } else return E_DB_CARD_R; } ERRTIP("该卡未注销,不能清空卡信息"); return E_COMMON_ERR; }
int F847357(TRUSERID *handle, int iRequest, ST_PACK *in_pack, int *pRetCode, char *szMsg) { int error_code = 0; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); ResetNormalCPack(&aPack, 0, 1); SetCol(handle,0); SetCol(handle, F_LVOL0, F_LVOL1, F_DAMT0, F_DAMT1, F_SPHONE, F_SORDER0, F_LVOL10, 0); out_pack->damt0 = CNectDB(true); if ((error_code = SellElec(in_pack->lvol0, in_pack->lvol1, in_pack->sorder0)) != 1) // 房间号, 购电金额, 购电人姓名 { g_LogFile.WriteLogEx(1003, "转帐出错--[%d]--房间号码[%d]--购电金额[%d]--购电姓名[%s]", error_code, in_pack->lvol0, in_pack->lvol1, in_pack->sorder0); error_code = DLLFUN_ERR_TRANSFER_ELEC; goto L_RETU; } error_code = 0; L_RETU: out_pack->lvol0 = in_pack->lvol0; out_pack->lvol1 = in_pack->lvol1; memcpy(out_pack->sorder0, in_pack->sorder0, sizeof(out_pack->sorder0) - 1); out_pack->damt1 = CNectDB(false); out_pack->lvol10 = *pRetCode = error_code; PutRow(handle, out_pack, pRetCode, szMsg); return error_code; }
int F249999(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret=0; ST_PACK ArrayPack; // 设置返回包 ST_CPACK aPack; // 设置应答包 ST_PACK *out_pack = &(aPack.pack); ST_CPACK sPack; // 设置发送包 ResetNormalCPack(&aPack, 0, 1); memset(&ArrayPack, 0, sizeof(ArrayPack)); ResetNormalCPack(&sPack, 0, 1); sPack.head.RequestType = 999999; SetHeadCol(&sPack, F_SCLOSE_EMP, F_SORDER2, F_SSERIAL0, F_SEMP_PWD, F_DAMT0, F_LVOL3, 0); memcpy(&(sPack.pack), rPack, sizeof(sPack.pack)); writelog(LOG_ERR,"branch_no[%d], base_funcno[%d]",g_Bank.DRTP_BRANCH,g_Bank.BCC_BASEFUNCNO); ret = ExtCall(0, g_Bank.DRTP_BRANCH, g_Bank.BCC_BASEFUNCNO, 0, g_Bank.TIMEOUT, &sPack, &aPack, &ArrayPack); writelog(LOG_ERR,"Call 999999 retCode=[%d]", ret); if (ret < 0 || aPack.head.retCode != 0) { memcpy(szMsg, aPack.pack.vsmess, sizeof(aPack.pack.vsmess) -1); if (ret < 0) { writelog(LOG_ERR,"Call 999999 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); *pRetCode = ret; return E_TRANS_UNKNOW_ERROR; } else { writelog(LOG_ERR,"Call 999999 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); *pRetCode = ret; return aPack.head.retCode; } } SetCol(handle,0); SetCol(handle,F_LVOL0,F_LVOL1,F_DAMT0,F_DAMT1,F_DAMT2,F_DAMT10,F_DAMT11,F_DAMT12,F_VSMESS,0); PutRow(handle, out_pack, pRetCode, szMsg); return 0; }
//查询第三方账户状态 static int QryAcc(TRUSERID *handle,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret; ST_CPACK aPack; ST_PACK *outPack = &(aPack.pack); ResetNormalCPack(&aPack,0,1); SetCol(handle,0); SetCol(handle,F_LVOL0,F_LVOL1,F_LVOL5,F_DAMT0,F_DAMT1,F_DAMT2,F_SDATE1,F_LWITHDRAW_FLAG, F_SBANKNAME,F_SADDR,F_SNAME2,F_SPHONE3,F_VSMESS,0); CAccTrans *pAccTrans=CAccTrans::getInstance(); TRANS& trans=pAccTrans->trans; trans.cardno=rPack->lvol0; T_t_card tCard; memset(&tCard,0,sizeof(tCard)); T_t_account tAccount; memset(&tAccount,0,sizeof(tAccount)); ret=pAccTrans->CheckAcc(&tCard,&tAccount); if(ret) { writelog(LOG_INFO,"检查状态失败"); return ret; } if(strlen(rPack->stx_pwd)) { ret=check_card_pwd_by_card(trans.cardno,rPack->stx_pwd); if(ret) return ret; } int paycode=rPack->lcert_code; CPaymentBase *payment; payment = CPaymentBase::find_payment(paycode); if(NULL == payment) { return E_TRANS_FUNC_NONSUPPORT; } ret = payment->init(handle,&aPack,rPack); if(ret) { writelog(LOG_ERR,"trade[%d],ret[%d]",paycode,ret); return ret; } if(payment->payment_.onlinepay>0) { ret = payment->qry_acc(handle,rPack,outPack); if(ret) { writelog(LOG_ERR,"查询收款方账户信息错误trade[%d],ret[%d]",paycode,ret); return ret; } } if(payment->pushflag_) PutRow(handle,outPack,pRetCode,szMsg); return 0; }
int F846302(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret=0; CAccTrans *pAccTrans=CAccTrans::getInstance(); // ret=pAccTrans->checkCfgUpdate(); // if(ret) // return ret; des2src(pAccTrans->trans.opercode,rPack->semp); pAccTrans->trans.transcode=TC_CARDOPENREV; ret=pAccTrans->InitTrans(); if(ret) return ret; TRANS& trans=pAccTrans->trans; char authrightflag=rPack->sstatus2[0]; des2src(trans.chkopercode,rPack->semp_no); if('1'==authrightflag) { ret=chk_oper_pwd(trans.chkopercode,rPack->scust_limit); if(ret) return ret; } ST_CPACK aPack; ST_PACK *outPack = &(aPack.pack); ResetNormalCPack(&aPack,0,1); char oldaccdate[9]=""; des2src(oldaccdate,rPack->sdate3); int oldtermid=rPack->lwithdraw_flag; int oldtermseqno=rPack->lserial1; trans.dpscnt=rPack->lvol5; trans.paycnt=rPack->lvol6; trans.cardbefbal=rPack->lvol7; des2src(trans.cardphyid,rPack->sstation1); if(trans.dpscnt>1||trans.paycnt>0) return E_CARD_USED; if(strlen(oldaccdate)<1) return E_INPUTNULL_ACCDATE; if(oldtermid<1) return E_INPUTNULL_TERMID; if(oldtermseqno<1) return E_INPUTNULL_TERMSEQNO; SetCol(handle,F_LVOL0,F_LVOL8,F_SDATE3,F_SEMP,F_LSERIAL1,F_SSTATION0,F_VSMESS,F_STIME3,0); ret=doReverse(oldaccdate,oldtermid,oldtermseqno,outPack->sstation0); if(ret) return ret; outPack->lvol0=pAccTrans->trans.cardno; outPack->lvol8=0; des2src(outPack->sdate3,pAccTrans->trans.accdate); des2src(outPack->stime3,pAccTrans->trans.acctime); des2src(outPack->semp,pAccTrans->trans.opercode); outPack->lserial1=pAccTrans->trans.termseqno; strcpy(outPack->vsmess,"开户冲正成功"); strcat(outPack->vsmess,pAccTrans->remark.c_str()); PutRow(handle,outPack,pRetCode,szMsg); return 0; }
int F846333(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret=0; CAccTrans *pAccTrans=CAccTrans::getInstance(); des2src(pAccTrans->trans.opercode,rPack->semp); pAccTrans->trans.transcode=TC_EACCDEPOSIT; ret=pAccTrans->InitTrans(); if(ret) return ret; TRANS& trans=pAccTrans->trans; ST_CPACK aPack; ST_PACK *outPack = &(aPack.pack); ResetNormalCPack(&aPack,0,1); SetCol(handle,0); des2src(trans.craccno,rPack->sbank_acc); des2src(trans.eaccno,rPack->sbank_acc); if(!strlen(trans.eaccno)) return E_INPUTNULL_ACCNO; //检查客户 //去帐户信息 T_t_netacc tNetAcc; memset(&tNetAcc,0,sizeof(tNetAcc)); ret=DB_t_netacc_read_by_accno(trans.eaccno,&tNetAcc); if(ret) { writelog(LOG_ERR,"accno[%s]",trans.eaccno); if(DB_NOTFOUND==ret) return E_NOTEXIST_EACCNO; else return E_DB_ACCOUNT_R; } if(tNetAcc.status[0]!=STATUS_NORMAL) { return E_EACCNO_LOGOUT; } // 创建账号 pAccTrans->trans.custid=tNetAcc.custid; pAccTrans->trans.inputamt=rPack->damt0; pAccTrans->trans.unusedamt = trans.inputamt; if(!pAccTrans->trans.inputamt) return E_INPUT_AMT_NULL; pAccTrans->trans.fundtype=rPack->lvol9; des2src(pAccTrans->trans.voucherno,rPack->scust_auth2); ret=pAccTrans->doTrans(); if(ret) return ret; SetCol(handle,F_LVOL0,F_LVOL8,F_SDATE3,F_SEMP,F_LWITHDRAW_FLAG,F_LSERIAL1,F_VSMESS,0); des2src(outPack->sdate3,pAccTrans->trans.accdate); des2src(outPack->semp,trans.opercode); outPack->lwithdraw_flag=trans.termid; outPack->lserial1=trans.termseqno; sprintf(outPack->vsmess,"客户[%s] %s 帐户余额:%.2f元",tNetAcc.accname,pAccTrans->remark.c_str(),pAccTrans->trans.craccaftbal); des2src(trans.remark,outPack->vsmess); PutRow(handle,outPack,pRetCode,szMsg); return 0; }
//POS登陆 240101 int Pos_Login(INNER_TRANS_REQUEST * pNode) { //double unique=0; int ret=0; // INNER_TRANS_REQUEST from_pos; ST_PACK ArrayPack; // 设置返回包 ST_CPACK aPack; // 设置应答包 // ST_PACK *out_pack = &(aPack.pack); ST_CPACK sPack; // 设置发送包 ResetNormalCPack(&aPack, 0, 1); memset(&ArrayPack, 0, sizeof(ArrayPack)); //银行未签到成功,POS不能登陆授予密钥 //考虑银行登陆不成功也可以进行校园卡业务 //所以此处不经判断银行是否登陆成功 /* if(!BANK_LOGIN) { writelog(LOG_ERR,"System not login to bank,pos login forbidden!shm[1]=[%d]",shm[1]); return E_TRANS_BANK_NETERR; } */ ResetNormalCPack(&sPack, 0, 1); sPack.head.RequestType = 240008; SetHeadCol(&sPack, F_SORDER2, 0); // 设置发送windows BU的头部视图信息 //memcpy(&(sPack.pack), in_pack, sizeof(sPack.pack)); des2src(sPack.pack.sorder2,pNode->TerminalId); ret = ExtCall(0, g_Bank.DRTP_BRANCH, g_Bank.BCC_BASEFUNCNO, 0, g_Bank.TIMEOUT, &sPack, &aPack, &ArrayPack); if (ret < 0||aPack.head.retCode!=0) { writelog(LOG_ERR,"Call 240008 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return E_TRANS_SCHOOL_NETERR; } //填充应答包---pNode,返回读卡密钥和银行通讯密钥 if(BANK_LOGIN) { memcpy(pNode->BankCardPwd,shm+2+8,sizeof(pNode->BankCardPwd)); } memcpy(pNode->BankCardNewPwd,aPack.pack.scard0,sizeof(pNode->BankCardNewPwd)); // writelog(LOG_ERR,"key=[%s]",aPack.pack.scard0); return 0; }
int F240008(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret=0; T_t_pif_device t_pif_device; T_t_pif_cur_syspara t_syspara; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); ResetNormalCPack(&aPack,0,1); SetCol(handle,0); SetCol(handle,F_SCARD0,0); memset(&t_pif_device,0,sizeof(t_pif_device)); memset(&t_syspara,0,sizeof(t_syspara)); ret=DB_t_pif_cur_syspara_read_by_id(GLOBLE_SYSPARA_STATIC_KEY, &t_syspara); if(ret) { writelog(LOG_ERR,"DB_t_pif_device_read_lock_by_cur_and_device_id error,error code=[%d]",ret); *pRetCode=E_DB_SYSPARA_R; goto L_RETU; } ret=DB_t_pif_device_read_lock_by_cur_and_device_id(atoi(rPack->sorder2),&t_pif_device); if(ret) { if(ret==DB_NOTFOUND) { writelog(LOG_ERR,"DB_t_pif_device_read_lock_by_cur_and_device_id error,error code=[%d]",ret); *pRetCode=E_DB_DEVASSET_N; } else { writelog(LOG_ERR,"DB_t_pif_device_read_lock_by_cur_and_device_id error,error code=[%d]",ret); *pRetCode=E_DB_DEVICE_R; } goto L_RETU; } t_pif_device.state_id=DEVISTAT_ONLINE; //更改设备注册表状态为在线状态 ret=DB_t_pif_device_update_lock_by_cur(&t_pif_device); if(ret) { writelog(LOG_ERR,"DB_t_pif_device_update_lock_by_cur error,error code=[%d]",ret); *pRetCode=E_DB_DEVICE_U; goto L_RETU; } des2src(out_pack->scard0,t_syspara.value); PutRow(handle,out_pack,pRetCode,szMsg); return 0; L_RETU: return ret; }
int F260002(TRUSERID *handle,int iRequest,ST_PACK *in_pack,int *pRetCode,char *szMsg) { int ret = 0; ST_PACK ArrayPack; // 设置返回包 ST_CPACK aPack; // 设置应答包 ST_CPACK sPack; // 设置发送包 ResetNormalCPack(&aPack, 0, 1); memset(&ArrayPack, 0, sizeof(ArrayPack)); // 向后台发写卡失败 ResetNormalCPack(&sPack, 0, 1); sPack.head.RequestType = 847304; SetHeadCol(&sPack, F_LVOL1, 0); // 设置发送windows BU的头部视图信息 memcpy(&(sPack.pack), in_pack, sizeof(sPack.pack)); writelog(LOG_ERR,"branch_no[%d], base_funcno[%d]",g_Bank.DRTP_BRANCH,g_Bank.BCC_BASEFUNCNO); ret = ExtCall(0, g_Bank.DRTP_BRANCH, g_Bank.BCC_BASEFUNCNO, 0, g_Bank.TIMEOUT, &sPack, &aPack, &ArrayPack); if (ret < 0 || aPack.head.retCode != 0) { if (ret < 0) { writelog(LOG_ERR,"Call 847316 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); strcpy(szMsg,"调用后台业务失败,业务终止"); goto L_retu; } else { writelog(LOG_ERR,"Call 847316 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); strcpy(szMsg,aPack.pack.vsmess); goto L_retu; } } return 0; L_retu: return -1; }
int verify_card_passwordEx(int card_id,char *stuemp_no,int cut_id,char *password, char *szMsg) { int ret=0; ST_PACK ArrayPack; // 设置返回包 ST_CPACK aPack; // 设置应答包 // ST_PACK *out_pack = &(aPack.pack); ST_CPACK sPack; // 设置发送包 ResetNormalCPack(&aPack, 0, 1); memset(&ArrayPack, 0, sizeof(ArrayPack)); ResetNormalCPack(&sPack, 0, 1); sPack.head.RequestType = 240010; SetHeadCol(&sPack, F_SSERIAL0,F_SCUST_AUTH,F_LVOL8,F_SEMP_PWD,0); // 设置发送windows BU的头部视图信息 //memcpy(&(sPack.pack), in_pack, sizeof(sPack.pack)); sprintf(sPack.pack.sserial0,"%d",card_id); des2src(sPack.pack.scust_auth, stuemp_no); sPack.pack.lvol8 = cut_id; des2src(sPack.pack.semp_pwd,password); ret = ExtCall(0, g_Bank.DRTP_BRANCH, g_Bank.BCC_BASEFUNCNO, 0, g_Bank.TIMEOUT, &sPack, &aPack, &ArrayPack); if (ret < 0 || aPack.head.retCode!=0) { memcpy(szMsg, aPack.pack.vsmess, sizeof(aPack.pack.vsmess) -1); if (ret < 0) { writelog(LOG_ERR,"Call 240010 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return E_TRANS_UNKNOW_ERROR; } else { writelog(LOG_ERR,"Call 240010 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return aPack.head.retCode; } } return 0; }
int F846315(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret=0; ST_CPACK aPack; ST_PACK *outPack = &(aPack.pack); ResetNormalCPack(&aPack,0,1); char oldaccdate[9]=""; des2src(oldaccdate,rPack->sdate3); int oldtermid=rPack->lwithdraw_flag; int oldtermseqno=rPack->lserial1; char authrightflag=rPack->sstatus2[0]; if(strlen(oldaccdate)<1) return E_INPUTNULL_ACCDATE; if(oldtermid<1) return E_INPUTNULL_TERMID; if(oldtermseqno<1) return E_INPUTNULL_TERMSEQNO; if('1'==authrightflag) { ret=chk_oper_pwd(rPack->semp_no,rPack->scust_limit); if(ret) return ret; } CAccTrans *pAccTrans=CAccTrans::getInstance(); ret=pAccTrans->checkCfgUpdate(); if(ret) return ret; pAccTrans->clear(); GetCpackDataString(rPack,pAccTrans->cpackdata); pAccTrans->trans.transcode=TC_TRANSREV; ret=pAccTrans->addOperDtl(rPack->semp); if(ret) return ret; ret=doReverse(authrightflag,oldaccdate,oldtermid,oldtermseqno); if(ret) return ret; SetCol(handle,F_LVOL0,F_LVOL8,F_SDATE3,F_SEMP,F_LSERIAL1,F_VSMESS,0); outPack->lvol0=pAccTrans->trans.cardno; outPack->lvol8=0; des2src(outPack->sdate3,pAccTrans->trans.accdate); des2src(outPack->semp,pAccTrans->trans.opercode); outPack->lserial1=pAccTrans->trans.termseqno; strcpy(outPack->vsmess,pAccTrans->remark.c_str()); PutRow(handle,outPack,pRetCode,szMsg); return 0;
int F847352(TRUSERID *handle, int iRequest, ST_PACK *in_pack, int *pRetCode, char *szMsg) { int error_code = 0; int money = 0; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); ResetNormalCPack(&aPack, 0, 1); Save_Info save_info; memset(&save_info, 0, sizeof(save_info)); SetCol(handle,0); SetCol(handle, F_LVOL0, F_LVOL1, F_DAMT0, F_DAMT1, F_SPHONE, F_LVOL10, 0); if (1 == in_pack->lvol3) { // 连接第三方数据库 if (error_code = InitDB()) { error_code = DLLFUN_ERR_TRANSFER_THIRD_PART_FAIL; goto L_RETU; } // 检测第三方帐号 CheckAccountNo(in_pack->lvol4, &money, &error_code); if (0 != error_code) { error_code = DLLFUN_ERR_CHECK_ACC_THIRD_PART_FAIL; } out_pack->lvol0 = money; goto L_RETU; } save_info.cut_id = in_pack->lvol0; save_info.save_Money = in_pack->lvol1; save_info.save_type = in_pack->lvol2; SaveInfo(&save_info, &error_code); if (error_code != 0) { g_LogFile.WriteLogEx(1001, "客户号[%d]--转帐金额[%d]--转账类型[%d]--错误码[%d]--序号[%d]", save_info.cut_id, save_info.save_Money, save_info.save_type, error_code, ++count1); error_code = DLLFUN_ERR_TRANSFER_FAIL; } L_RETU: out_pack->lvol1 = error_code; *pRetCode = error_code; PutRow(handle, out_pack, pRetCode, szMsg); return error_code; }
int verify_sch_bank_relationship(int cut_id,int card_id,char *stuemp_no,int area_id,char *bankcard_no) { int ret=0; ST_PACK ArrayPack; // 设置返回包 ST_CPACK aPack; // 设置应答包 // ST_PACK *out_pack = &(aPack.pack); ST_CPACK sPack; // 设置发送包 ResetNormalCPack(&aPack, 0, 1); memset(&ArrayPack, 0, sizeof(ArrayPack)); ResetNormalCPack(&sPack, 0, 1); sPack.head.RequestType = 240011; SetHeadCol(&sPack, F_LVOL8,F_SCUST_AUTH,F_LVOL0,F_SPHONE,F_LVOL1,0); // 设置发送windows BU的头部视图信息 //memcpy(&(sPack.pack), in_pack, sizeof(sPack.pack)); sPack.pack.lvol0=card_id; sPack.pack.lvol8=cut_id; sPack.pack.lvol1=area_id; des2src(sPack.pack.scust_auth,stuemp_no); des2src(sPack.pack.sphone,bankcard_no); ret = ExtCall(0, g_Bank.DRTP_BRANCH, g_Bank.BCC_BASEFUNCNO, 0, g_Bank.TIMEOUT, &sPack, &aPack, &ArrayPack); if (ret < 0||aPack.head.retCode!=0) { if(ret<0) { writelog(LOG_ERR,"Call 240011 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return E_TRANS_UNKNOW_ERROR; } else { writelog(LOG_ERR,"Call 240011 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return aPack.head.retCode; } } return 0; }
int do_mobile_transfer(ST_PACK *in_pack,TRUSERID *handle,int *pRetCode,char *szMsg) { int ret=0; char device_id[10+1]=""; char card_id[12+1]=""; ST_PACK ArrayPack; // 设置返回包 ST_CPACK aPack; // 设置应答包 // ST_PACK *out_pack = &(aPack.pack); ST_CPACK sPack; // 设置发送包 ResetNormalCPack(&aPack, 0, 1); memset(&ArrayPack, 0, sizeof(ArrayPack)); //向后台发水控转账 ResetNormalCPack(&sPack, 0, 1); sPack.head.RequestType = 847316; SetHeadCol(&sPack, F_LVOL1,F_LVOL2,F_SCUST_LIMIT,F_LVOL6,F_LVOL7, 0); // 设置发送windows BU的头部视图信息 memcpy(&(sPack.pack), in_pack, sizeof(sPack.pack)); ret = ExtCall(0, g_Bank.DRTP_BRANCH, g_Bank.BCC_BASEFUNCNO, 0, g_Bank.TIMEOUT, &sPack, &aPack, &ArrayPack); if (ret < 0 || aPack.head.retCode != 0) { if (ret < 0) { writelog(LOG_ERR,"Call 847317 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return E_TRANS_UNKNOW_ERROR; } else { writelog(LOG_ERR,"Call 847317 error,errcode=[%d],retCode=[%d]",ret,aPack.head.retCode); return aPack.head.retCode; } } return 0; }
int F846313(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret=0; cpu_trade_t cpu_trade; ST_CPACK aPack; ST_PACK *outPack = &(aPack.pack); ResetNormalCPack(&aPack,0,1); SetCol(handle,0); SetCol(handle,F_LVOL0,F_SSTOCK_CODE2,F_LSERIAL1,F_SEMAIL,0); memset(&cpu_trade,0,sizeof cpu_trade); cpu_trade.trade_type=rPack->lsafe_level; des2src(cpu_trade.random_key,rPack->sstock_code); des2src(cpu_trade.cardphyid,rPack->sstation1); cpu_trade.tradeamt = rPack->lvol1; cpu_trade.tradecnt = rPack->lvol6; // 必须是交易前次数 cpu_trade.balance = rPack->lvol7; cpu_trade.termsno = rPack->lserial0; des2src(cpu_trade.termno,rPack->sserial0); // 终端号 strncpy(cpu_trade.tx_datetime,rPack->sdate0,8); strncpy(cpu_trade.tx_datetime+8,rPack->stime0,6); des2src(outPack->sstock_code2,rPack->sstock_code2); // MAC1,只在移动规范中使用 // 计算出 MAC2 if(rPack->lvol5 == 2) { ret = calc_cpucard_mac(&cpu_trade,outPack->semail,rPack->lvol5); } else { ret = calc_cpucard_mac(&cpu_trade,outPack->sstock_code2,rPack->lvol5); } if(ret) { writelog(LOG_ERR,"doCheckMac err[%d]",ret); return ret; } outPack->lvol0 = rPack->lvol0; //交易卡号 outPack->lserial1=rPack->lserial1; // 交易流水号 PutRow(handle,outPack,pRetCode,szMsg); return 0; }
int F240008(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg) { int ret=0; T_t_device device; T_t_syspara t_syspara; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); ResetNormalCPack(&aPack,0,1); SetCol(handle,0); SetCol(handle,F_SCARD0,0); memset(&device,0,sizeof(device)); memset(&t_syspara,0,sizeof(t_syspara)); ret=DB_t_syspara_read_by_paraid(GLOBLE_SYSPARA_STATIC_KEY, &t_syspara); if(ret) { writelog(LOG_ERR,"DB_t_syspara_read_by_paraid error,error code=[%d]",ret); if(DB_NOTFOUND==ret) return E_DB_SYSPARA_N; else return E_DB_SYSPARA_R; } ret=DB_t_device_read_lock_by_c0_and_deviceid(atoi(rPack->sorder2),&device); if(ret) { if(ret==DB_NOTFOUND) { writelog(LOG_ERR,"DB_t_device_read_lock_by_c0_and_deviceid error,error code=[%d]",ret); return E_NOTEXIST_DEVICE; } else { writelog(LOG_ERR,"DB_t_device_read_lock_by_c0_and_deviceid error,error code=[%d]",ret); return E_DB_DEVICE_R; } } device.runstatus[0]=DEVRUNSTATUS_ONLINE; //更改设备注册表状态为在线状态 ret=DB_t_device_update_lock_by_c0(&device); if(ret) { writelog(LOG_ERR,"DB_t_device_update_lock_by_c0 error,error code=[%d]",ret); return E_DB_DEVICE_U; } des2src(out_pack->scard0,t_syspara.paraval); PutRow(handle,out_pack,pRetCode,szMsg); return 0; }