Exemple #1
0
<?php

if (xt_fanxian_is_pendingtixian()) {
    exit('<div class="well">暂停提现,请稍后操作</div>');
}
$user = wp_get_current_user();
if ($user->exists()) {
    $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'cash';
    if (!in_array($type, array('cash', 'jifenbao'))) {
        $type = 'cash';
    }
    $_fanxian = 0;
    $_tixian = 0;
    $_cash = 0;
    $_cash_text = '元';
    if ($type == 'cash') {
        $_fanxian = xt_user_total_fanxian($user->ID);
        $_tixians = xt_total_tixian($user->ID);
        $_tixian = $_tixians[0] + $_tixians[1];
        //未审核,已完成
        $_cash = $_fanxian - $_tixian;
        //余额
    } else {
        $_cash_text = xt_jifenbao_text();
        $_fanxian = xt_user_total_jifen($user->ID);
        $_tixians = xt_total_tixian_jifen($user->ID);
        $_tixian = $_tixians[0] + $_tixians[1];
        //未审核,已完成
        $_cash = $_fanxian - $_tixian;
        //余额
    }
function _xt_report_fanxian_save($cash, $jifen, $buyer_id, $buyer_name, $sharer_id, $sharer_name, $adser_id, $adser_name, $type, $platform, $trade_id, $commission, $pay_time)
{
    $user_id = 0;
    $user_name = '';
    switch ($type) {
        case 'BUY':
            $user_id = $buyer_id;
            $user_name = $buyer_name;
            break;
        case 'SHARE':
            $user_id = $sharer_id;
            $user_name = $sharer_name;
            break;
        case 'ADS':
            $user_id = $adser_id;
            $user_name = $adser_name;
            break;
    }
    if ($user_id > 0 && ($cash > 0 || $jifen > 0)) {
        if (xt_new_fanxian(array('platform' => $platform, 'trade_id' => $trade_id, 'type' => $type, 'user_id' => $user_id, 'user_name' => $user_name, 'buy_user_id' => $buyer_id, 'buy_user_name' => $buyer_name, 'share_user_id' => $sharer_id, 'share_user_name' => $sharer_name, 'ads_user_id' => $adser_id, 'ads_user_name' => $adser_name, 'commission' => $commission, 'fanxian' => $cash, 'jifen' => $jifen, 'create_time' => current_time('mysql'), 'order_time' => $pay_time))) {
            if (!xt_fanxian_is_pendingtixian() && xt_fanxian_is_autocash()) {
                //处理现金提现,集分宝提现
                $_cash = 0;
                if ($cash > 0) {
                    $_fanxian = xt_user_total_fanxian($user_id);
                    $_tixians = xt_total_tixian($user_id);
                    $_tixian = $_tixians[0] + $_tixians[1];
                    //未审核,已完成
                    $_cash = $_fanxian - $_tixian;
                    //余额
                }
                if ($_cash == 0 && $jifen > 0) {
                    $_fanxian = xt_user_total_jifen($user_id);
                    $_tixians = xt_total_tixian_jifen($user_id);
                    $_tixian = $_tixians[0] + $_tixians[1];
                    //未审核,已完成
                    $_cash = $_fanxian - $_tixian;
                    //余额
                }
                if ($_cash > 0) {
                    xt_new_tixian(array('user_id' => $user_id, 'cash' => $cash, 'jifen' => $jifen));
                }
            }
        }
    }
}
Exemple #3
0
        <tr valign="top">
            <th scope="row">返现</th>
            <td>
                <input name="isFanxian" type="checkbox" id="isFanxian" value="1" <?php 
echo xt_is_fanxian() ? 'checked' : '';
?>
>
                <label for="isFanxian">启用返现功能,支持会员购买,推广返现</label>	
            </td>
        </tr>
        <tr valign="top">
            <th scope="row">提现</th>
            <td>
                <label for="isPendingTixian">
                    <input name="isPendingTixian" type="checkbox" id="isPendingTixian" value="1" <?php 
echo xt_fanxian_is_pendingtixian() ? 'checked' : '';
?>
>
                    暂停提现
                </label>
                <br>
                <label for="isAutoCash">
                    <input name="isAutoCash" type="checkbox" id="isAutoCash" value="1" <?php 
echo xt_fanxian_is_autocash() ? 'checked' : '';
?>
>
                    无需会员手动提现,根据返利记录自动汇总并生成提现记录
                </label>	
            </td>
        </tr>
        <tr valign="top">