改进 计费
This commit is contained in:
parent
253b3f1be0
commit
60f2d5243e
@ -4,13 +4,10 @@
|
|||||||
|
|
||||||
use App\Helpers\Lock;
|
use App\Helpers\Lock;
|
||||||
use App\Models\Host;
|
use App\Models\Host;
|
||||||
use App\Models\User;
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
|
|
||||||
class HostCost implements ShouldQueue
|
class HostCost implements ShouldQueue
|
||||||
{
|
{
|
||||||
|
@ -77,23 +77,17 @@ public function scopeThisUser($query, $module = null)
|
|||||||
// cost
|
// cost
|
||||||
public function cost($price = null)
|
public function cost($price = null)
|
||||||
{
|
{
|
||||||
$price = abs($price);
|
|
||||||
|
|
||||||
$this->load('user');
|
$this->load('user');
|
||||||
|
|
||||||
$cache_key = 'user_drops_' . $this->user_id;
|
$cache_key = 'user_drops_' . $this->user_id;
|
||||||
|
|
||||||
$drops = Cache::get($cache_key);
|
$drops = Cache::get($cache_key);
|
||||||
|
|
||||||
// Log::debug($user);
|
|
||||||
|
|
||||||
if ($price !== null) {
|
if ($price !== null) {
|
||||||
$this->managed_price = $price;
|
$this->price = $price;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->managed_price) {
|
|
||||||
$this->price = $this->managed_price;
|
|
||||||
}
|
|
||||||
|
|
||||||
$amount = $price / Cache::get('drops_rate', 100) + 1;
|
$amount = $price / Cache::get('drops_rate', 100) + 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user