|
|
@@ -136,13 +136,14 @@ class PriceService extends BaseService
|
|
|
}
|
|
|
|
|
|
// 昨日价格
|
|
|
- $lastPriceData = $this->getPriceData($lastDate, $type);
|
|
|
+ $lastPrice = $this->getTodayPrice($type);
|
|
|
|
|
|
// 昨日全网资产
|
|
|
$lastPropertyTotal = isset($ptAccount['last_property'])?$ptAccount['last_property']:0;
|
|
|
- $ptProperty = isset($ptAccount['pt_property'])?$ptAccount['pt_property']:0; // 平台初始资产
|
|
|
+ $ptProperty = isset($ptAccount['property'])?$ptAccount['property']:0; // 平台初始资产
|
|
|
|
|
|
// 今日新增资产
|
|
|
+ $todayPropertyTotal = 0;
|
|
|
$todayProperty = AccountLogModel::where(['date'=>$date,'type'=>8,'account_type'=>2,'mark'=>1])->sum('money');
|
|
|
if($todayProperty>=0 && $lastPropertyTotal>0){
|
|
|
// 当日全网资产衰减后
|
|
|
@@ -150,7 +151,7 @@ class PriceService extends BaseService
|
|
|
|
|
|
// 当日全网总资产
|
|
|
$todayPropertyTotal = moneyFormat($propertyTotalByReduce + $todayProperty, 6);
|
|
|
- }else{
|
|
|
+ }else if($lastPrice<=0){
|
|
|
// 当日全网总资产
|
|
|
$todayPropertyTotal = $ptProperty;
|
|
|
}
|
|
|
@@ -161,7 +162,7 @@ class PriceService extends BaseService
|
|
|
$todayPoolTotal = isset($ptAccount['today_pool'])?$ptAccount['today_pool']:0;
|
|
|
|
|
|
// 当日价格
|
|
|
- $price = moneyFormat($poolTotal/$todayPropertyTotal, 6);
|
|
|
+ $price = $todayPropertyTotal>0?moneyFormat($poolTotal/$todayPropertyTotal, 6) : 0;
|
|
|
if($price>0){
|
|
|
$data = [
|
|
|
'type'=>$type,
|
|
|
@@ -171,6 +172,7 @@ class PriceService extends BaseService
|
|
|
'today_pool'=>$todayPoolTotal,
|
|
|
'last_property'=>$lastPropertyTotal,
|
|
|
'today_property'=>$todayProperty,
|
|
|
+ 'property_total'=>$todayPropertyTotal,
|
|
|
'date'=>$date,
|
|
|
'create_time'=>time(),
|
|
|
'status'=>1,
|
|
|
@@ -190,12 +192,14 @@ class PriceService extends BaseService
|
|
|
'today_pool'=> 0,
|
|
|
'update_time'=>time()
|
|
|
];
|
|
|
- if(PtAccountModel::where(['id'=>$accountId])->update($updateData)){
|
|
|
+ if(!PtAccountModel::where(['id'=>$accountId])->update($updateData)){
|
|
|
DB::rollBack();
|
|
|
$this->error = '更新平台账户数据失败';
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ DB::commit();
|
|
|
+
|
|
|
$data['id'] = $logId;
|
|
|
RedisService::set($cacheKey, $data, 600);
|
|
|
RedisService::clear("caches:prices:data_{$type}_{$date}");
|