Esempio n. 1
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;
}
Esempio n. 2
0
function getUcSaveCarry($amount, $paypassword, $bid)
{
    $status = array('status' => 0, 'show_err' => '');
    if ($GLOBALS['user_info']['id'] > 0) {
        $paypassword = strim($paypassword);
        $amount = floatval($amount);
        $bid = intval($bid);
        if ($paypassword == "") {
            $status['status'] = 0;
            $status['show_err'] = $GLOBALS['lang']['PAYPASSWORD_EMPTY'];
            return $status;
        }
        if (md5($paypassword) != $GLOBALS['user_info']['paypassword']) {
            $status['status'] = 0;
            $status['show_err'] = $GLOBALS['lang']['PAYPASSWORD_ERROR'];
            return $status;
        }
        $data['user_id'] = intval($GLOBALS['user_info']['id']);
        $data['money'] = $amount;
        if ($data['money'] <= 0) {
            $status['status'] = 0;
            $status['show_err'] = $GLOBALS['lang']['CARRY_MONEY_NOT_TRUE'];
            return $status;
        }
        $fee = getCarryFee($data['money'], $GLOBALS['user_info']);
        //判断提现金额限制
        if ($data['money'] + $fee + floatval($GLOBALS['user_info']['nmc_amount']) > floatval($GLOBALS['user_info']['money'])) {
            $status['status'] = 0;
            $status['show_err'] = $GLOBALS['lang']['CARRY_MONEY_NOT_ENOUGHT'];
            return $status;
        }
        $data['fee'] = $fee;
        if ($bid == 0) {
            $status['status'] = 0;
            $status['show_err'] = $GLOBALS['lang']['PLASE_ENTER_CARRY_BANK'];
            return $status;
        }
        //更新会员账户信息
        if (floatval($fee) + floatval($data['money']) <= $GLOBALS['db']->getOne("SELECT money-nmc_amount FROM " . DB_PREFIX . "user WHERE id=" . intval($GLOBALS['user_info']['id']))) {
            $user_bank = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "user_bank where user_id=" . intval($GLOBALS['user_info']['id']) . " AND id={$bid} ");
            $data['bank_id'] = $user_bank['bank_id'];
            $data['real_name'] = $user_bank['real_name'];
            $data['region_lv1'] = intval($user_bank['region_lv1']);
            $data['region_lv2'] = intval($user_bank['region_lv2']);
            $data['region_lv3'] = intval($user_bank['region_lv3']);
            $data['region_lv4'] = intval($user_bank['region_lv4']);
            $data['bankzone'] = trim($user_bank['bankzone']);
            $data['bankcard'] = trim($user_bank['bankcard']);
            $data['create_time'] = TIME_UTC;
            $data['create_date'] = to_date(TIME_UTC, "Y-m-d");
            $GLOBALS['db']->autoExecute(DB_PREFIX . "user_carry", $data, "INSERT");
            require APP_ROOT_PATH . 'system/libs/user.php';
            modify_account(array('money' => -$data['money'], 'lock_money' => $data['money']), $data['user_id'], "提现申请", 8);
            modify_account(array('money' => -$fee, 'lock_money' => $fee), $data['user_id'], "提现手续费", 9);
            //$content = "您于".to_date($data['create_time'],"Y年m月d日 H:i:s")."提交的".format_price($data['money'])."提现申请我们正在处理,如您填写的账户信息正确无误,您的资金将会于3个工作日内到达您的银行账户.";
            $notice['time'] = to_date($data['create_time'], "Y年m月d日 H:i:s");
            $notice['money'] = format_price($data['money']);
            $tmpl_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_WITHDRAWS_CASH'", false);
            $GLOBALS['tmpl']->assign("notice", $notice);
            $content = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content['content']);
            send_user_msg("", $content, 0, $data['user_id'], TIME_UTC, 0, true, 5);
            $status['status'] = 1;
            $status['show_err'] = $GLOBALS['lang']['CARRY_SUBMIT_SUCCESS'];
            return $status;
        } else {
            $status['status'] = 0;
            $status['show_err'] = $GLOBALS['lang']['CARRY_MONEY_NOT_ENOUGHT'];
            return $status;
        }
    } else {
        $status['show_err'] = "未登录";
    }
    return $status;
}
Esempio n. 3
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;
}