</tr>
    <tr>
        <td align="right">头像:</td>
        <td class="upload-row">
            <img src="<?php 
echo $info['user_avatar'];
?>
" width="100" height="100" alt="" />
        </td>
    </tr>
    <tr>
        <td class="td1" align="right">等级:</td>
        <td class="ms">
            <select class="select" name="fx_group">
                <?php 
$_result = get_fx_group();
if (is_array($_result)) {
    $i = 0;
    $__LIST__ = $_result;
    if (count($__LIST__) == 0) {
        echo "";
    } else {
        foreach ($__LIST__ as $key => $val) {
            $mod = $i % 2;
            ++$i;
            ?>
<option value="<?php 
            echo $key;
            ?>
" <?php 
            if ($key == $info['fx_group']) {
    <dt>
        <p onclick="syncUserInfo();">
            <img src="<?php 
echo $user_info['user_avatar'];
?>
" alt="">
            <em><a href="<?php 
echo U('index');
?>
" title=""><img src="/Public/Fenxiao/jfsd/images/bg2.png" alt=""></a></em>
        </p>
        <span><a href="<?php 
echo U('index');
?>
" title=""><?php 
echo get_fx_group($user_info['fx_group'], 'name');
?>
</a></span>
    </dt>
    <dd>
        会员ID :<?php 
echo $user_info['user_id'];
?>
        <br /> 昵称 :<?php 
echo $user_info['user_name'];
?>
        <br /> 推荐人:
        <?php 
echo empty($user_info['fx_sup']) ? '中华聚宝' : get_shop_info($user_info['user_avatar']);
?>
        <a href="<?php 
            ?>
" alt="<?php 
            echo $val['user_name'];
            ?>
" width="108" height="108"></a></dt>
                        <dd>
                            <a href="javascript:void(0);"><?php 
            echo $val['user_name'];
            ?>
</a>
                            推荐人:<?php 
            echo $val['fx_sup'];
            ?>
                            <p class="fix">
                                <b><?php 
            echo get_fx_group($val['fx_group'], 'name');
            ?>
</b>
                                <i>¥<?php 
            echo $val['fx_count'];
            ?>
</i>
                            </p>
                        </dd>
                    </dl>
                </span>
                        <em><?php 
            echo $i;
            ?>
</em>
                    </li><?php 
Example #4
0
 /**
  * 红包分销处理
  * @param  int $uid         用户
  * @param  font $money      金额
  * @return bool
  */
 private function _hongbaoMoney($uid, $money, $level = 0)
 {
     $base = C('HONG_BAO_BASE');
     $fx_group_list = get_fx_group();
     $map = array('user_id' => $uid);
     $this->where($map)->setInc('fx_hb_zxf_lj', $money);
     $user = $this->field('fx_sup,fx_group,fx_hb_zxf_lj,fx_hb_wlqxf_lj')->where($map)->find();
     //处理是否符合增加红包条件
     $hb_wlqxf_lj = $user['fx_hb_wlqxf_lj'] + $money;
     if ($hb_wlqxf_lj >= $base * 2) {
         $hb_shu = floor($hb_wlqxf_lj / ($base * 2));
         $this->_andhongbao($uid, $hb_shu);
         // +红包
         $shu = $base * 2 * $hb_shu;
         $this->where($map)->setInc('fx_hb_ylqxf_lj', $shu);
         // +已领取消费
         $this->where($map)->setField('fx_hb_wlqxf_lj', $hb_wlqxf_lj - $shu);
         // -未领取消费
     } else {
         $this->where($map)->setInc('fx_hb_wlqxf_lj', $money);
         // +未领取消费
     }
     // 自消费2个399, 升级为vip1;
     if ($level === 0 && $money >= $base * 2 && $user['fx_group'] == 1) {
         $this->where($map)->setField('fx_group', 3);
         $this->_andhongbao($uid, 20);
         //送20个红包
     }
     // 自消费1个399, 升级为正式会员;
     if ($level === 0 && $money >= $base && $user['fx_group'] == 1) {
         $this->where($map)->setField('fx_group', 2);
     }
     // 是否符合升级条件
     $zhituishu = $this->where(array('fx_sup' => $uid))->count();
     foreach (get_fx_group() as $key => $value) {
         //是否达到总分销记录和直推数, 并防止等级倒退, 必须是普通会员以上才可以升级
         if ($user['fx_group'] > 1 && $key > $user['fx_group'] && $user['fx_hb_zxf_lj'] >= $value['beishu'] * $base && $zhituishu >= $value['zhituishu']) {
             $this->where($map)->setField('fx_group', $key);
             if ($key == 3) {
                 $this->_andhongbao($uid, 20);
                 //送20个红包
             }
         }
     }
     // 三级分销递归处理
     if ($user['fx_sup'] > 0 && $level < 3) {
         $this->_hongbaoMoney($user['fx_sup'], $money, ++$level);
     } else {
         return false;
     }
 }