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

📄 tx_dispatch.c

📁 UNIX/LINUX平台下面SMS网管原代码
💻 C
📖 第 1 页 / 共 4 页
字号:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "apgloble.h"
#include "apmicro.h"
#include "bms_micro.h"
#include "bms_strcdef.h"

#include "etc.h"

#define  MAX_PAGE	12

static void FormatDate(char *des, char *src);
static int FormFile(int optcode, char *file, char *title, BIG_STRC *bs);
static int FormNFile(int optcode, char *file, char *title, BIG_STRC *bs) ;
static int get_currency_type(int curr,char *vox,char *name);
static int get_abstract_type(char *type, char *abstract);
static int get_save_type(char *save_type, char *abstract);
static int get_branch_name(char *brch_no, char *branch_name);


extern char errcode[4 + 1];
char	CurrType[4];

extern int  DB_search_pin(char *pin, char *cid);
extern int  DB_reset_pin(char *cid, char *pin);
extern int  DB_search_acct(char *acct, char *cid, char *aid, int type);
extern int  DB_check_bid_scope(char *cid, char *acct, short bid);

/** 签约客户查询交易 **/

/* 
 * 交易码:1000
 * 功能  :余额查询 
 * 客户  :签约客户
 */
int b1000( TRADE_HEAD *tr_h, BIG_STRC *bs)
{
	int ret = -1;
	int pAccType;
	
	if (strlen(bs->debi_acct) <=4) 
	{
		strcpy(bs->debi_aid,bs->debi_acct);
		memset(bs->debi_acct,'\0',sizeof(bs->debi_acct));
		
	}	
	if((ret = DB_search_acct(bs->debi_acct,bs->cid,bs->debi_aid,pAccType)) != 0)
	{
		if(ret == 100)
		{
			bs->result = 2000 ;		//签约客户不存在 
			return (FAILURE);
		}
		else
		{
			bs->result = 1406 ;
			return (FAILURE);
		}
	}
		
	if(CallHost(bs) == FAILURE) return FAILURE;
			
	if ( (ret=FormFile(bs->optcode, bs->address, bs->debi_acct, bs)) != SUCCESS) 
	if( ret )
	{
		if( ret == 1006)
		{
			bs->result = 1006;
			return FAILURE;
		}
		else
		{
			bs->result = 1406;
			return FAILURE;
		}
	}
	return( SUCCESS) ;
}

/* 
 * 交易码:1001
 * 功能  :当日明细查询
 * 客户  :签约客户
 */
int b1001( TRADE_HEAD *tr_h, BIG_STRC *bs)
{
	int ret = -1;
	int ActiveLog = 0;
	int Page = 0 ;
	int pAccType;
	
	if (strlen(bs->debi_acct) <=4) 
	{
		strcpy(bs->debi_aid,bs->debi_acct);
		memset(bs->debi_acct,'\0',sizeof(bs->debi_acct));
	}
if((ret = DB_search_acct(bs->debi_acct,bs->cid,bs->debi_aid,pAccType)) != 0)
	{
		if(ret == 100)
		{
			bs->result = 2000 ;		//签约客户不存在 
			return (FAILURE);
		}
		else
		{
			bs->result = 1406 ;
			return (FAILURE);
		}
	}
	
	sprintf(bs->date2, "%ld", GetDate());
	//strcpy(bs->date2, "20051225");
	bs->pz_type = 1; //1.当日明细 2.历史明细
	
	if(CallHost(bs) == FAILURE) return FAILURE;

	bms_trace("FormFile beginning........");
	ret = FormFile(bs->optcode, bs->address, bs->debi_acct, bs);
	if( ret )
	{
		if( ret == 1006)
		{
			bs->result = 1006;
			return FAILURE;
		}
		else
		{
			bs->result = 1406;
			return FAILURE;
		}
	}
	return( SUCCESS) ;
}

/* 
 * 交易码:1002
 * 功能  :历史明细查询
 * 客户  :签约客户
 */
int b1002( TRADE_HEAD *tr_h, BIG_STRC *bs)
{
	int ret = -1;
	int ActiveLog = 0;
	int Page = 0 ;
	int pAccType;
	
	if (strlen(bs->debi_acct) <=4) 
	{
		strcpy(bs->debi_aid,bs->debi_acct);
		memset(bs->debi_acct,'\0',sizeof(bs->debi_acct));
	}
	if((ret = DB_search_acct(bs->debi_acct,bs->cid,bs->debi_aid,pAccType)) != 0)
	{
		if(ret == 100)
		{
			bs->result = 2000 ;		//签约客户不存在 
			return (FAILURE);
		}
		else
		{
			bs->result = 1406 ;
			return (FAILURE);
		}
	}
	
	if(strlen(bs->date2) == 0)
		sprintf(bs->date2, "%ld", GetDate());
	bs->bill_flg = 0;
	bs->pz_type = 2; //1.当日明细 2.历史明细

	if(CallHost(bs) == FAILURE) return FAILURE;

	bms_trace("FormFile beginning........");
	ret = FormFile(bs->optcode, bs->address, bs->debi_acct, bs);
	if( ret )
	{
		if( ret == 1006)
		{
			bs->result = 1006;
			return FAILURE;
		}
		else
		{
			bs->result = 1406;
			return FAILURE;
		}
	}
	return( SUCCESS) ;
}
/* 
 * 交易码:1003
 * 功能  :未登折明细查询
 * 客户  :签约客户
 */
int b1003( TRADE_HEAD *tr_h, BIG_STRC *bs)
{
	int ret = -1;
	int pAccType;
	
	if (strlen(bs->debi_acct) <=4) 
	{
		strcpy(bs->debi_aid,bs->debi_acct);
		memset(bs->debi_acct,'\0',sizeof(bs->debi_acct));
	}
	if((ret = DB_search_acct(bs->debi_acct,bs->cid,bs->debi_aid,pAccType)) != 0)
	{
		if(ret == 100)
		{
			bs->result = 2000 ;		//签约客户不存在 
			return (FAILURE);
		}
		else
		{
			bs->result = 1406 ;
			return (FAILURE);
		}
	}

	if(CallHost(bs) == FAILURE) return FAILURE;
	bms_trace("FormFile beginning........");
	ret = FormFile(bs->optcode, bs->address, bs->debi_acct, bs);
	if( ret )
	{
		if( ret == 1006)
		{
			bs->result = 1006;
			return FAILURE;
		}
		else
		{
			bs->result = 1406;
			return FAILURE;
		}
	}
	
	return( SUCCESS) ;
}

/* 
 * 交易码:1004
 * 功能  :根据证件号码查询帐户信息
 * 客户  :签约客户
 */
int b1004( TRADE_HEAD *tr_h, BIG_STRC *bs)
{
	int ret = -1;

	if(CallHost(bs) == FAILURE) return FAILURE;
	bms_trace("FormFile beginning........");
	ret = FormFile(bs->optcode, bs->address, bs->debi_acct, bs);
	if( ret )
	{
		if( ret == 1006)
		{
			bs->result = 1006;
			return FAILURE;
		}
		else
		{
			bs->result = 1406;
			return FAILURE;
		}
	}
	
	return( SUCCESS) ;
}
/* 
 * 交易码:1005
 * 功能  :根据帐号查询帐户信息
 * 客户  :签约客户
 */
int b1005( TRADE_HEAD *tr_h, BIG_STRC *bs)
{
	int ret = -1;

	if(CallHost(bs) == FAILURE) return FAILURE;
	sprintf(bs->address, "%05d.%04d",bs->trade_serial,bs->optcode);

	bms_trace("FormNFile beginning........");
	ret = FormNFile(bs->optcode, bs->address, bs->debi_acct, bs);
	if(ret)
	{
			bs->result = 1406;
			return FAILURE;
	}
	pub_trim(bs->name);
	
	return( SUCCESS) ;
}
/* 
 * 交易码:1500
 * 功能  :转帐时验证转出帐户支付密码
 * 客户  :签约客户
 */
int b1500( TRADE_HEAD *tr_h, BIG_STRC *bs)
{
	int ret = -1;

	if(CallHost(bs) == FAILURE) return FAILURE;

	return( SUCCESS) ;
}

/* 
 * 交易码:1501
 * 功能  :转帐时验证转出帐户支付密码
 * 客户  :签约客户
 */
int b1501( TRADE_HEAD *tr_h, BIG_STRC *bs)
{
	int ret = -1;
	char IdType[1 + 1];
	char IdNo[20];
/*
	ret = DB_account_exists(bs->debi_acct);
	if( ret != SUCCESS )
	{
		bs->result = 1506;
		return FAILURE;
	}
*/

	if(CallHost(bs) == FAILURE) return FAILURE;



	return( SUCCESS) ;
}

/* 
 * 交易码:1502
 * 功能  :
 * 客户  :签约客户
 */
int b1502( TRADE_HEAD *tr_h, BIG_STRC *bs)
{
	int ret = -1;

	if(CallHost(bs) == FAILURE) return FAILURE;

	return( SUCCESS) ;
}

/* 
 * 交易码:1601
 * 功能  :一卡通内互转
 * 客户  :签约客户
 */
int b1601( TRADE_HEAD *tr_h, BIG_STRC *bs)
{
	int ret = -1;
	double aggr_amt = 0.00;
	double max_limit = 0.00;
	int pAccType;
	
	if (strlen(bs->debi_acct) <=4) 
	{
		strcpy(bs->debi_aid,bs->debi_acct);
		memset(bs->debi_acct,'\0',sizeof(bs->debi_acct));
		
	}	
	if((ret = DB_search_acct(bs->debi_acct,bs->cid,bs->debi_aid,pAccType)) != 0)
	{
		if(ret == 100)
		{
			bs->result = 2000 ;		//签约客户不存在 
			return (FAILURE);
		}
		else
		{
			bs->result = 1406 ;
			return (FAILURE);
		}
	}
	pub_trim(bs->debi_acct);
	if(strlen(bs->debi_acct) != 17)
	{
		bs->result = 2005;	//帐户帐户类型不符
		return (FAILURE);
	}
	
	/* 转帐前需要判断转帐金额是否超限 */
	if((ret=DB_seek_limit(&aggr_amt, &max_limit, bs->cid, bs->debi_acct)) !=SUCCESS)
	{
	if(ret==100)
	{
		bms_trace("ret[%d]", ret);
		bs->result = 1500;
		return FAILURE;
	}
	else
		{
		bs->result = 1002;
		return FAILURE;
	}
}

	bms_trace("aggr=[%.2lf], max_limit[%.2lf]", aggr_amt, max_limit);

	if( aggr_amt + bs->debi_amt > max_limit)
	{
		bs->result = 1502;
		return FAILURE;
	}

	//strcpy(bs->auther, "1");
	bs->debi_curr = 10 ;		//币种:10、人民币
	bs->pz_type = 1;		//交易类型:1、一卡通内转
	strcpy(bs->notes1, "2");
	strcpy(bs->cred_acct, bs->debi_acct);
	bs->debi_amt = bs->debi_amt * 100 ;	//金额扩大100倍
	if(CallHost(bs) == FAILURE) return FAILURE;

	bs->debi_amt = bs->debi_amt/100;	//转账成功之后转账金额还原为原来的金额
	/* 转帐成功后需要更新 转帐金额 */
	if( DB_update_agrr_amt(bs->cid, bs->debi_acct, bs->debi_amt) )
	{
		bs->result = 1002;
		return FAILURE;
	}

	return( SUCCESS) ;
}
/* 
 * 交易码:1602
 * 功能  :一本通内互转
 * 客户  :签约客户
 */
int b1602( TRADE_HEAD *tr_h, BIG_STRC *bs)
{
	int ret = -1;
	double aggr_amt = 0.00;
	double max_limit = 0.00;
	int pAccType;
	
	if (strlen(bs->debi_acct) <=4) 
	{
		strcpy(bs->debi_aid,bs->debi_acct);
		memset(bs->debi_acct,'\0',sizeof(bs->debi_acct));
		
	}	
	if((ret = DB_search_acct(bs->debi_acct,bs->cid,bs->debi_aid,pAccType)) != 0)
	{
		if(ret == 100)
		{
			bs->result = 2000 ;		//签约客户不存在 
			return (FAILURE);
		}
		else
		{
			bs->result = 1406 ;
			return (FAILURE);
		}
	}
	pub_trim(bs->debi_acct);
	if(strlen(bs->debi_acct) != 10)
        {
                bs->result = 2005;      //转出帐户类型不符
                return (FAILURE);
        }


	/* 转帐前需要判断转帐金额是否超限 */
	if((ret=DB_seek_limit(&aggr_amt, &max_limit, bs->cid, bs->debi_acct)) !=SUCCESS)
	{
	if(ret==100)
	{
		bms_trace("ret[%d]", ret);
		bs->result = 1500;
		return FAILURE;
	}
	else
		{
		bs->result = 1002;
		return FAILURE;
	}
}

	bms_trace("aggr=[%.2lf], max_limit[%.2lf]", aggr_amt, max_limit);

	if( aggr_amt + bs->debi_amt > max_limit)
	{
		bs->result = 1502;
		return FAILURE;
	}

	bs->debi_curr = 10 ;					//币种:10、人民币
	bs->pz_type = 1;		//交易类型:1、一本通内转
	strcpy(bs->notes1, "3");	//一本通客户
	strcpy(bs->cred_acct, bs->debi_acct);
	bs->debi_amt = bs->debi_amt * 100 ;		//转账金额扩大100倍
	if(CallHost(bs) == FAILURE) return FAILURE;

	bs->debi_amt = bs->debi_amt/100;	//转账成功之后转账金额还原为原来的金额
	/* 转帐成功后需要更新 转帐金额 */
	if( DB_update_agrr_amt(bs->cid, bs->debi_acct, bs->debi_amt) )
	{
		bs->result = 1002;
		return FAILURE;
	}

	return( SUCCESS) ;
}
/* 
 * 交易码:1603
 * 功能  :一卡通转出
 * 客户  :签约客户
 */
int b1603( TRADE_HEAD *tr_h, BIG_STRC *bs)
{
	int ret = -1;
	double aggr_amt = 0.00;
	double max_limit = 0.00;
	int pAccType;
	
	if (strlen(bs->debi_acct) <=4) 
	{
		strcpy(bs->debi_aid,bs->debi_acct);
		memset(bs->debi_acct,'\0',sizeof(bs->debi_acct));
		
	}	
	if((ret = DB_search_acct(bs->debi_acct,bs->cid,bs->debi_aid,pAccType)) != 0)
	{
		if(ret == 100)
		{
			bs->result = 2000 ;		//签约客户不存在 
			return (FAILURE);
		}
		else
		{
			bs->result = 1406 ;
			return (FAILURE);
		}
	}
	pub_trim(bs->debi_acct);
	if(strlen(bs->debi_acct) != 17)
	{
		bs->result= 2005;      //转出帐户类型不符
		return (FAILURE);
	}

	/* 转帐前需要判断转帐金额是否超限 */
	if((ret=DB_seek_limit(&aggr_amt, &max_limit, bs->cid, bs->debi_acct)) !=SUCCESS)
	{
	if(ret==100)
	{
		bms_trace("ret[%d]", ret);
		bs->result = 1500;
		return FAILURE;
	}
	else
		{
		bs->result = 1002;
		return FAILURE;
	}
}

	bms_trace("aggr=[%.2lf], max_limit[%.2lf]", aggr_amt, max_limit);

	if( aggr_amt + bs->debi_amt > max_limit)
	{
		bs->result = 1502;
		return FAILURE;
	}

	//strcpy(bs->auther, "1");
	bs->debi_curr = 10 ;					//币种:10、人民币
	bs->pz_type = 3;							//交易类型:一卡通转出
	pub_trim(bs->cred_acct);
	if(strlen(bs->cred_acct) == 10)
		strcpy(bs->notes1, "3");	//一本通客户
	else if(strlen(bs->cred_acct) == 17)
		strcpy(bs->notes1, "2");	//一卡通客户
	else
		strcpy(bs->notes1, "1");	//普通存折客户

	strcpy(bs->cred_aid, "AP01");
	bs->debi_amt = bs->debi_amt * 100 ;	//金额扩大100倍
	
	/*******addby zhongyp 20051108 *********/
	bs->optcode = 1005;
	if(CallHost(bs) == FAILURE) return FAILURE;
	bms_trace("bs->name[%s]", bs->name);
	bs->optcode = 1603;
	/**********/
	if(CallHost(bs) == FAILURE) return FAILURE;

⌨️ 快捷键说明

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