<div class="row-fluid X_Layout row-2-10 xt-first-child"> <div class="span2 X_Region X_Region_Span2"> <div id="X_Account-Nav" class="xt-account-nav well well-small"> <ul class="nav nav-list"> <?php if (xt_is_fanxian()) { ?> <li class="nav-header">返现管理</li> <li class="active"><a href="#info" id="X_Account-Info-A"><i class="icon-home"></i>我的账户</a></li> <li><a href="#orders" id="X_Account-Orders-A"><i class="icon-list-alt"></i>我的订单</a></li> <li><a href="#unorders" id="X_Account-Unorders-A"><i class="icon-search"></i>找回订单</a></li> <?php if (xt_fanxian_is_ad() || xt_fanxian_is_share()) { ?> <li><a href="#tuiguang" id="X_Account-Tuiguang-A"><i class="icon-share"></i>我的推广</a></li><?php } ?> <!--<li><a href="#jifen" id="X_Account-Jifen-A"><i class="icon-gift"></i>我的<?php echo xt_jifenbao_text(); ?> </a></li>--> <?php } ?> <li class="nav-header">账户设置</li> <li><a href="#profile" id="X_Account-Profile-A"><i class="icon-user"></i>个人信息</a></li> <li><a href="#bind" id="X_Account-Bind-A"><i class="icon-cog"></i>账号绑定</a></li> </ul> </div> </div> <div class="span10 X_Region X_Region_Span10">
function xt_report_fanxian_result($platform, $commission, $buyer, $sharer, $adser) { $result = array('isValid' => 0, 'commission' => $commission, 'income' => $commission, 'buy' => array('user_id' => 0, 'user_name' => '', 'rate' => 0, 'cash' => 0, 'jifen' => 0), 'share' => array('user_id' => 0, 'user_name' => '', 'rate' => 0, 'cash' => 0, 'jifen' => 0), 'ads' => array('user_id' => 0, 'user_name' => '', 'rate' => 0, 'cash' => 0, 'jifen' => 0)); $isJifen = xt_fanxian_is_jifenbao($platform); if ($isJifen) { $result['commission'] = $commission * 100; } $rate = $share_rate = 0; $total = 0; if ($sharer->exists()) { $result['share']['user_id'] = $sharer->ID; $result['share']['user_name'] = $sharer->user_login; if (xt_fanxian_is_share()) { $share_rate = xt_get_sharerate($sharer->ID); if ($share_rate > 0) { $fanxian = $jifen = 0; if ($isJifen) { $jifen = round($commission * $share_rate / 100, 2) * 100; } else { $fanxian = round($commission * $share_rate / 100, 2); } $result['share']['rate'] = $share_rate; $result['share']['cash'] = $fanxian; $result['share']['jifen'] = $jifen; $total += $share_rate; } } } if ($buyer->exists()) { $result['buy']['user_id'] = $buyer->ID; $result['buy']['user_name'] = $buyer->user_login; $rate = xt_get_rate($buyer->ID); if ($sharer->exists() && !xt_fanxian_is_sharebuy()) { //share no buy $rate = 0; } if ($rate > 0) { $fanxian = $jifen = 0; if ($isJifen) { $jifen = round($commission * $rate / 100, 2) * 100; } else { $fanxian = round($commission * $rate / 100, 2); } $result['buy']['rate'] = $rate; $result['buy']['cash'] = $fanxian; $result['buy']['jifen'] = $jifen; $total += $rate; } if ($adser->exists()) { $result['ads']['user_id'] = $adser->ID; $result['ads']['user_name'] = $adser->user_login; if (xt_fanxian_is_ad()) { $adrate = xt_get_adrate($adser); if ($adrate > 0) { $fanxian = $jifen = 0; if ($isJifen) { $jifen = round($commission * $adrate / 100, 2) * 100; } else { $fanxian = round($commission * $adrate / 100, 2); } $result['ads']['rate'] = $adrate; $result['ads']['cash'] = $fanxian; $result['ads']['jifen'] = $jifen; $total += $adrate; } } } } if ($total <= 90) { $result['isValid'] = 1; $result['income'] = round($commission * (90 - $total) / 100, 2); } return $result; }
<label for="rate_share"> 分享返现比例<input name="rate_share" type="number" step="1" min="0" max="90" id="rate_share" value="<?php echo xt_fanxian_default_sharerate(); ?> " class="small-text">% 启用分享返现后,会员分享的商品被购买可以获得的返现比例(返现=佣金x分享返现比例) </label> </td> </tr> <tr valign="top"> <th scope="row">推广返现</th> <td> <label for="isAd"> <input name="isAd" type="checkbox" id="isAd" value="1" <?php echo xt_fanxian_is_ad() ? 'checked' : ''; ?> >是否启用推广返现 </label> <br> <label for="rate_ad"> 推广返现比例<input name="rate_ad" type="number" step="1" min="0" max="90" id="rate_ad" value="<?php echo xt_fanxian_default_adrate(); ?> " class="small-text">% 启用推广返现后,会员推广其他人注册购买后可以获得的返现比例(返现=佣金x推广返现比例) </label> </td> </tr> <tr valign="top">
function xt_get_adrate($user = 0, $ismulti = false) { if (xt_is_fanxian() && xt_fanxian_is_ad()) { $isforce = false; if (!(is_object($user) && is_a($user, 'WP_User'))) { if ($user > 0) { $user = new WP_User($user); $isforce = true; } else { $user = wp_get_current_user(); } } else { $isforce = true; } if ($user->exists()) { $rate = xt_get_user_rate($user->ID, 'ads'); if ($rate === '') { return xt_get_role_adrate($user->roles, $ismulti = false); } return $rate; } else { if ($isforce) { //如果指定了会员,但不存在,则返回0 return 0; } return xt_fanxian_default_adrate(); } } return 0; }
<?php $user = wp_get_current_user(); $invite_url = ''; if (xt_fanxian_is_ad()) { $invite_url = xt_site_url('invite-' . $user->ID); } elseif (xt_fanxian_is_share()) { $invite_url = xt_site_url('uid-' . $user->ID); } if (!empty($invite_url)) { ?> <div id="X_Tuiguang-Invite" class="well"> <div> <h4>这是您的专用邀请链接,适合通过聊天工具如 QQ , 旺旺 , MSN 发送给好友:</h4> <input class="input-xxlarge" value="<?php echo $invite_url; ?> " type="text"> </div> <div> <h4>这是您的专用邀请代码,适合在支持HTML的网页如 论坛 , 博客 粘贴以下代码:</h4> <textarea class="input-xxlarge"><a href="<?php echo $invite_url; ?> " target="_blank"><?php esc_html(bloginfo('name')); ?> </a></textarea> </div> </div> <?php