wesmiler 1 周之前
父节点
当前提交
673da2508c
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      app/Services/Api/PriceService.php

+ 5 - 4
app/Services/Api/PriceService.php

@@ -142,7 +142,7 @@ class PriceService extends BaseService
                 $lastPrice = $this->getTodayPrice($type);
 
                 // 昨日全网资产
-                $lastPropertyTotal = isset($ptAccount['last_property'])?$ptAccount['last_property']:0;
+                $lastProperty = isset($ptAccount['last_property'])?$ptAccount['last_property']:0;
                 $ptProperty = isset($ptAccount['property'])?$ptAccount['property']:0; // 平台初始资产
 
                 // 今日新增资产
@@ -150,7 +150,8 @@ class PriceService extends BaseService
                 $todayProperty = AccountLogModel::where(['date'=>$date,'type'=>8,'account_type'=>2,'mark'=>1])->sum('money');
                 if($todayProperty>=0){
                     // 当日全网资产衰减后
-                    $propertyTotalByReduce = moneyFormat($lastPropertyTotal * 0.99,6);
+                    $lastProperty = $lastProperty?$lastProperty:$ptProperty;
+                    $propertyTotalByReduce = moneyFormat($lastProperty * 0.99,6);
 
                     // 当日全网总资产
                     $todayPropertyTotal = moneyFormat($propertyTotalByReduce + $todayProperty, 6);
@@ -173,7 +174,7 @@ class PriceService extends BaseService
                         'last_price'=> isset($lastPriceData['price'])?$lastPriceData['price'] : 0,
                         'pool_total'=>$poolTotal,
                         'today_pool'=>$todayPoolTotal,
-                        'last_property'=>$lastPropertyTotal,
+                        'last_property'=>$lastProperty,
                         'today_property'=>$todayProperty,
                         'property_total'=>$todayPropertyTotal,
                         'date'=>$date,
@@ -190,7 +191,7 @@ class PriceService extends BaseService
 
                     $updateData = [
                         'property_price'=> $price,
-                        'last_property'=> $lastPropertyTotal,
+                        'last_property'=> $todayPropertyTotal,
                         'today_property'=> 0,
                         'today_pool'=> 0,
                         'update_time'=>time()