function DoDwTrade($user_id, $platformNo, $pTrdAmt, $post_url, $sys = 'pc')
{
    $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Yeepay&class_act=DoDwTrade&from=" . $_REQUEST['from'];
    //web方式返回
    $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Yeepay&class_act=DoDwTrade&from=" . $_REQUEST['from'];
    //s2s方式返回
    $user = array();
    $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
    $yeepay_log = array();
    $yeepay_log['code'] = 'toWithdraw';
    $yeepay_log['create_date'] = to_date(NOW_TIME, 'Y-m-d H:i:s');
    $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log);
    $requestNo = $GLOBALS['db']->insert_id();
    $fee = 0;
    //getCarryFee($pTrdAmt,$user);
    $data = array();
    $data['requestNo'] = $requestNo;
    //请求流水号
    $data['platformUserNo'] = $user_id;
    //
    $data['platformNo'] = $platformNo;
    // 商户编号
    $data['amount'] = $pTrdAmt - $fee;
    $collocation_item = $GLOBALS['db']->getRow("select config from " . DB_PREFIX . "collocation where class_name='Yeepay'");
    $collocation_cfg = unserialize($collocation_item['config']);
    $data['feeMode'] = $collocation_cfg['TXfeeMode'] ? $collocation_cfg['TXfeeMode'] : 'USER';
    //费率模式PLATFORM PLATFORM 收取商户手续费 USER 收取用户手续费
    $data['fee'] = $fee;
    $data['create_time'] = NOW_TIME;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_withdraw", $data, 'INSERT');
    $id = $GLOBALS['db']->insert_id();
    $strxml = DoDwTradeXml($data, $pWebUrl, $pS2SUrl);
    $pSign = cfca($strxml);
    if ($sys == 'pc') {
        $act = 'bha';
    } elseif ($sys == 'mobile') {
        $act = 'bhawireless';
    }
    $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /></head><body>
		<form name="form1" id="form1" method="post" action="' . $post_url . '/' . $act . '/toWithdraw" target="_self">		
		<input type="hidden" name="sign" value="' . $pSign . '" />		
		<textarea name="req" cols="100" rows="5" style="display:none">' . $strxml . '</textarea>
 		<input type="hidden" value="提交"></input>
 		<div style="width:100%;text-align:center;padding:50px 0;"><img src="' . APP_ROOT . '/app/Tpl/' . app_conf("TEMPLATE") . '/images/loading.gif" />页面正在跳转,请稍后...</div>
		</form>
		</body></html>
		<script language="javascript">document.form1.submit();</script>';
    //echo $html; exit;
    $yeepay_log = array();
    $yeepay_log['strxml'] = $strxml;
    $yeepay_log['html'] = $html;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log, 'UPDATE', 'id=' . $requestNo);
    return $html;
}
Beispiel #2
0
function DoDwTrade($user_id, $platformNo, $pTrdAmt, $post_url)
{
    $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Yeepay&class_act=DoDwTrade&from=" . $_REQUEST['from'];
    //web方式返回
    $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Yeepay&class_act=DoDwTrade&from=" . $_REQUEST['from'];
    //s2s方式返回
    $user = array();
    $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
    $yeepay_log = array();
    $yeepay_log['code'] = 'toWithdraw';
    $yeepay_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s');
    $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log);
    $requestNo = $GLOBALS['db']->insert_id();
    $fee = getCarryFee($pTrdAmt, $user);
    $data = array();
    $data['requestNo'] = $requestNo;
    //请求流水号
    $data['platformUserNo'] = $user_id;
    //
    $data['platformNo'] = $platformNo;
    // 商户编号
    $data['amount'] = $pTrdAmt - $fee;
    $data['fee'] = $fee;
    $data['feeMode'] = 'USER';
    //费率模式PLATFORM PLATFORM 收取商户手续费 USER 收取用户手续费
    $data['create_time'] = TIME_UTC;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_withdraw", $data, 'INSERT');
    $id = $GLOBALS['db']->insert_id();
    $strxml = DoDwTradeXml($data, $pWebUrl, $pS2SUrl);
    $pSign = "signdata";
    $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /></head><body>
		<form name="form1" id="form1" method="post" action="' . $post_url . '/bha/toWithdraw" target="_self">		
		<input type="text" name="sign" value="' . $pSign . '" />		
				<textarea name="req" cols="100" rows="5">' . $strxml . '</textarea>
						 <input type="submit" value="提交"></input>
		</form>
		</body></html>
		<script language="javascript">document.form1.submit();</script>';
    //echo $html; exit;
    $yeepay_log = array();
    $yeepay_log['strxml'] = $strxml;
    $yeepay_log['html'] = $html;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log, 'UPDATE', 'id=' . $requestNo);
    return $html;
}
Beispiel #3
0
/**
 * 用户提现
 * @param int $user_id
 * @param int $user_type 0:普通用户fanwe_user.id;1:担保用户fanwe_deal_agency.id
 * @param float $pTrdAmt 提现金额
 * @param unknown_type $MerCode
 * @param unknown_type $cert_md5
 * @param unknown_type $post_url
 * @return string
 */
function DoDwTrade($user_id, $user_type, $pTrdAmt, $MerCode, $cert_md5, $post_url)
{
    $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Ips&class_act=DoDwTrade&from=" . $_REQUEST['from'];
    //web方式返回
    $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Ips&class_act=DoDwTrade&from=" . $_REQUEST['from'];
    //s2s方式返回
    $user = array();
    if ($user_type == 0) {
        $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
    } else {
        $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
    }
    $data = array();
    $data['user_type'] = $user_type;
    $data['user_id'] = $user_id;
    $data['pMerCode'] = $MerCode;
    // '“平台”账号 否 由IPS颁发的商户号 ',
    $data['pMerBillNo'] = $user_id . 'DW' . TIME_UTC;
    // '商户提现订单号商户系统唯一不重复',
    $data['pAcctType'] = 1;
    // '账户类型 否 0#机构(暂未开放) ;1#个人',
    $data['pOutType'] = 1;
    // '提现模式 否 1#普通提现;2#定向提现<暂不开放> ',
    $data['pBidNo'] = '';
    // '标号 是/否 提现模式为2时,此字段生效 内容是投标时的标号',
    $data['pContractNo'] = '';
    // '合同号 是/否 提现模式为2时,此字段生效 内容是投标时的合同号',
    $data['pDwTo'] = '';
    // '提现去向 是/否 提现模式为2时,此字段生效 上送IPS托管账户号(个人/商户号)',
    $data['pIdentNo'] = $user['idno'];
    // '证件号码 否 真实身份证(个人)/由IPS颁发的商户号(商户)',
    $data['pRealName'] = $user['real_name'];
    // '姓名 否 真实姓名(中文) ',
    $data['pIpsAcctNo'] = $user['ips_acct_no'];
    // 'IPS账户号 否 账户类型为1时,IPS个人托管账户号 账户类型为0时,由IPS颁发的商户号',
    $data['pDwDate'] = to_date(TIME_UTC, 'Ymd');
    // '提现日期 否 格式:YYYYMMDD ',
    $data['pTrdAmt'] = str_replace(',', '', number_format($pTrdAmt, 2));
    //'提现金额 否 金额单位,不能为负,不允许为0 ',
    $fee = 0;
    //获取手续费配置表
    $fee_config = load_auto_cache("user_carry_config");
    //如果手续费大于最大的配置那么取这个手续费
    if ($data['pTrdAmt'] >= $fee_config[count($fee_config) - 1]['max_price']) {
        $fee = $fee_config[count($fee_config) - 1]['fee'];
    } else {
        foreach ($fee_config as $k => $v) {
            if ($data['pTrdAmt'] >= $v['min_price'] && $data['pTrdAmt'] <= $v['max_price']) {
                $fee = floatval($v['fee']);
            }
        }
    }
    $data['pMerFee'] = str_replace(',', '', number_format($fee, 2));
    // '平台手续费 否 金额单位,不能为负,允许为0 这里是平台向用户收取的费用 ',
    $data['pIpsFeeType'] = 2;
    // 'IPS手续费收取方  这里是IPS收取的费用 1:平台支付 2:提现方支付',
    $GLOBALS['db']->autoExecute(DB_PREFIX . "ips_do_dw_trade", $data, 'INSERT');
    $id = $GLOBALS['db']->insert_id();
    $strxml = DoDwTradeXml($data, $pWebUrl, $pS2SUrl);
    //echo $strxml;exit;
    $Crypt3Des = new Crypt3Des();
    //new 3des class
    $p3DesXmlPara = $Crypt3Des->DESEncrypt($strxml);
    //3des 加密
    $str = $MerCode . $p3DesXmlPara . $cert_md5;
    //print_r($cert_md5); exit;
    $pSign = md5($str);
    $html = '
		<form name="form1" id="form1" method="post" action="' . $post_url . 'doDwTrade.aspx" target="_self">
		<input type="hidden" name="pMerCode" value="' . $MerCode . '" />
		<input type="hidden" name="p3DesXmlPara" value="' . $p3DesXmlPara . '" />
		<input type="hidden" name="pSign" value="' . $pSign . '" />
		</form>
		<script language="javascript">document.form1.submit();</script>';
    //echo $html; exit;
    $ips_log = array();
    $ips_log['code'] = 'DoDwTrade';
    $ips_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s');
    $ips_log['strxml'] = $strxml;
    $ips_log['html'] = $html;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "ips_log", $ips_log);
    return $html;
}
Beispiel #4
0
function DoDwTrade($cfg, $user_id, $pTrdAmt, $post_url)
{
    $merchant_id = $cfg['merchant_id'];
    $terminal_id = $cfg['terminal_id'];
    $key = $cfg['key'];
    $iv = $cfg['iv'];
    $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Baofoo&class_act=DoDwTrade&from=" . $_REQUEST['from'];
    //web方式返回
    $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Baofoo&class_act=DoDwTrade&from=" . $_REQUEST['from'];
    //s2s方式返回
    $user = array();
    $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
    //获得提现手续费
    $fee = getCarryFee($pTrdAmt, $user);
    $data = array();
    $data['merchant_id'] = $merchant_id;
    //商户号
    $data['terminal_id'] = $terminal_id;
    //终端号
    $data['order_id'] = 0;
    //订单号 (唯一不可重复)
    $data['user_id'] = $user_id;
    $data['amount'] = $pTrdAmt;
    //充值金额,单位:元
    $data['amount_fee'] = $fee;
    //平台收取用户的手续费
    /*
    //费用承担方(宝付收取的费用),1平台2用户自担
    例1:提现100元 平台收费2元  宝付收费1元  费用承担方为用户,则实际用户扣款103,到账100  平台收2  宝付收1 。		
    例2:提现100元 平台收费2元  宝付收费1元  费用承担方为平台,则实际用户扣款102,到账100  平台收(2-1) 宝付收1 。
    */
    //print_r($cfg);exit;
    if ($cfg['fee_taken_on'] == 2) {
        $data['fee_taken_on'] = 2;
    } else {
        $data['fee_taken_on'] = 1;
    }
    $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_fo_charge", $data, 'INSERT');
    $id = $GLOBALS['db']->insert_id();
    $data_update = array();
    $data_update['order_id'] = $id;
    $data['order_id'] = $id;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_fo_charge", $data_update, 'UPDATE', 'id=' . $id);
    $strxml = DoDwTradeXml($data, $pWebUrl, $pS2SUrl);
    $pSign = md5($strxml . "~|~" . $key);
    //$aes=new MyAES();
    //$requestParams=$aes->encrypt($strxml,$key,$iv); //加密
    $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /></head><body>
		<form name="form1" id="form1" method="post" action="' . $post_url . 'custody/foCharge.do" target="_self">		
				merchant_id:<input type="hidden" name="merchant_id" value="' . $merchant_id . '" /><br>
				terminal_id:<input type="hidden" name="terminal_id" value="' . $terminal_id . '" /><br>
				sign:<input type="hidden" name="sign" value="' . $pSign . '" /><br>
				requestParams:<textarea name="requestParams" cols="100" rows="5">' . $strxml . '</textarea>	<br>
				<input type="submit" value="提交"></input>
		</form>
		</body></html>
		<script language="javascript">document.form1.submit();</script>';
    //echo $html; exit;
    $baofoo_log = array();
    $baofoo_log['code'] = 'foCharge';
    $baofoo_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s');
    $baofoo_log['strxml'] = $strxml;
    $baofoo_log['html'] = $html;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_log", $baofoo_log);
    return $html;
}