Пример #1
0
                        <option value="userId">用户号</option>
                        <option value="nickname">用户昵称</option>
                        <option value="realname">用户真实姓名</option>
                    </select>
                    <input type="text" name="content" class="form-control" placeholder="请输入查找内容">
                    <button type="submit" class="btn  btn-small btn btn-primary">查找</button>
                </div>
                <?php 
echo Html::endForm();
?>
            </div>
        </div>
        <table class="table table-bordered table-striped margin-bottom-20">
            <tr class="font_bg_color">
                <td><strong>总计收入云豆:</strong><?php 
echo IncomeConsume::findTotalIncome($user['userId']);
?>
(颗)</td>
                <td><strong>总计支出云豆:</strong><?php 
echo IncomeConsume::findTotalConsume($user['userId']);
?>
(颗)</td>
            </tr>
        </table>
        <table class="table table-hover table-bordered text-align-center">
            <thead class="bordered-blue">
            <tr> <th class="text-align-center">序号</th>
                <th class="text-align-center">用户号</th>
                <th class="text-align-center">用户妮称</th>
                <th class="text-align-center">用户真实姓名</th>
                <th class="text-align-center">收入或支出云豆</th>
Пример #2
0
    ?>
</td>
                    <td><?php 
    echo $user->recommendCode;
    ?>
</td>
                    <td><?php 
    echo $user->recommendUser['nickname'];
    ?>
</td>
                    <td><?php 
    echo Money::findTotalPay($user->userId);
    ?>
</td>
                    <td><?php 
    echo IncomeConsume::findTotalIncome($user->userId);
    ?>
</td>
                    <td><?php 
    echo $user->bitcoin;
    ?>
</td>
                    <td><?php 
    echo count(Users::findBeRecommend($user->userId));
    ?>
</td>
                    <td><?php 
    echo $user->registerDate;
    ?>
</td>
                    <td><?php 
Пример #3
0
 /**
  * 计算用户提现的钱应该扣除的云豆数
  * @param $user
  * @param $money
  * @return float|mixed
  * @throws Exception
  */
 public static function calculateWithdrawBitcoin($user, $money)
 {
     $role = $user['role'];
     $leftBitcoin = Users::findBitcoin($user['userId']);
     //获取用户剩余云豆
     $schemes = Scheme::findWithdrawScheme($role);
     if ($role == Users::ROLE_AA) {
         $scheme = $schemes[0];
         return $money / $scheme['getMoney'] * $scheme['payBitcoin'];
     } elseif ($role == Users::ROLE_AAA) {
         $totalBitcoin = IncomeConsume::findTotalIncome($user['userId']);
         //获取该用户累计获得多少云豆
         $withdrawBitcoin = $totalBitcoin - $leftBitcoin;
         //已经提现掉的云豆数
         $scheme_low = $schemes[0];
         $scheme_high = $schemes[1];
         if ($withdrawBitcoin >= $scheme_high['totalBitcoin']) {
             //已经提现的云豆数大于高比例需要的云豆数,直接按照高比例算
             return $money / $scheme_high['getMoney'] * $scheme_high['payBitcoin'];
         } else {
             //按照第比例算或分段算
             if ($totalBitcoin >= $scheme_high['totalBitcoin']) {
                 //累计云豆数量达到高比例提现,分段算
                 $lowBitcoin = $scheme_high['totalBitcoin'] - $withdrawBitcoin;
                 //按照低比例算的云豆
                 $lowMoney = $lowBitcoin / $scheme_low['payBitcoin'] * $scheme_low['getMoney'];
                 //低比例最大可提现的钱
                 if ($money <= $lowMoney) {
                     //用户体现的钱未达到低比例最大提现的钱,按低比例计算云豆
                     return $money / $scheme_low['getMoney'] * $scheme_low['payBitcoin'];
                 } else {
                     //用户体现的钱超过低比例最大提现的钱,未超过部分为所有低比例云豆数,超过部分按高比例计算云豆
                     return $lowBitcoin + ($money - $lowMoney) / $scheme_high['getMoney'] * $scheme_high['payBitcoin'];
                 }
             } else {
                 //按低比例算
                 return $money / $scheme_low['getMoney'] * $scheme_low['payBitcoin'];
             }
         }
     } else {
         throw new Exception("role 未定义");
     }
 }