修复 金额过小时统计不到的问题
This commit is contained in:
parent
9ff6a189d3
commit
b1593b48ec
@ -11,6 +11,7 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo as BelongsToAlias;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany as HasManyAlias;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
// use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
@ -254,8 +255,12 @@ public function costBalance($amount = 1): bool
|
||||
}
|
||||
|
||||
|
||||
public function addLog($type = 'drops', $amount = 0)
|
||||
public function addLog($type = 'drops', float $amount = 0)
|
||||
{
|
||||
if ($amount == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** 统计收益开始 */
|
||||
$current_month = now()->month;
|
||||
$current_year = now()->year;
|
||||
@ -270,9 +275,22 @@ public function addLog($type = 'drops', $amount = 0)
|
||||
if ($type == 'drops') {
|
||||
// 换成 余额
|
||||
|
||||
$amount = round($amount / $rate, 2);
|
||||
// 如果小于 0.00,则不四舍五入
|
||||
$c = $amount / $rate;
|
||||
|
||||
if ($c > 0.01) {
|
||||
$amount = $amount / $rate;
|
||||
}
|
||||
}
|
||||
|
||||
$amount = round($amount, 2);
|
||||
Log::debug('addLog', [
|
||||
'amount' => $amount,
|
||||
'rate' => $rate,
|
||||
'commission' => $commission,
|
||||
]);
|
||||
|
||||
|
||||
$should_amount = round($amount * $commission, 2);
|
||||
|
||||
// 应得的余额
|
||||
|
Loading…
Reference in New Issue
Block a user