|
|
@@ -45,7 +45,7 @@ class AwardIntegralPriceRepository extends BaseRepository
|
|
|
public function awardIntegralPrice($day = '')
|
|
|
{
|
|
|
if (!$day) {
|
|
|
- $day = date('Y-m-d',strtotime('-1 day'));
|
|
|
+ $day = date('Y-m-d', strtotime('-1 day'));
|
|
|
}
|
|
|
if ($info = $this->dao->search(['day' => $day])->find()) {
|
|
|
return $info->toArray();
|
|
|
@@ -76,27 +76,35 @@ class AwardIntegralPriceRepository extends BaseRepository
|
|
|
$sum_achievement = bcadd((string)$commission, (string)$achievement, 6);
|
|
|
$rise = $num > 0 ? bcdiv($sum_achievement, $num, 6) : 0;
|
|
|
$add_price = 0;
|
|
|
- if ($rise >0){
|
|
|
- // 增长值分成25份
|
|
|
- $day_25_rise = bcdiv($rise, 25, 6);
|
|
|
- /** @var AwardIntegralPriceDayDao $AwardIntegralPriceDayDao */
|
|
|
- $AwardIntegralPriceDayDao = app()->make(AwardIntegralPriceDayDao::class);
|
|
|
- $AwardIntegralPriceDayDao->create(['day' => strtotime('-25 day'), 'price' => $rise,'add_price'=>$day_25_rise]); //保存今天增长的总价格和每日增长价格
|
|
|
- $day_25 =strtotime('-25 day');
|
|
|
- $add_price = $AwardIntegralPriceDayDao->search(['day' => $day_25])->sum('price');
|
|
|
+ if ($rise > 0) {
|
|
|
+ try {
|
|
|
+ // 增长值分成25份
|
|
|
+ $day_25_rise = bcdiv($rise, 25, 6);
|
|
|
+ /** @var AwardIntegralPriceDayDao $AwardIntegralPriceDayDao */
|
|
|
+ $AwardIntegralPriceDayDao = app()->make(AwardIntegralPriceDayDao::class);
|
|
|
+ $AwardIntegralPriceDayDao->create(['day' => strtotime('-25 day'), 'price' => $rise, 'add_price' => $day_25_rise]); //保存今天增长的总价格和每日增长价格
|
|
|
+ $day_25 = strtotime('-25 day');
|
|
|
+ $add_price = $AwardIntegralPriceDayDao->search(['day' => $day_25])->sum('price');
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ @file_put_contents('quanju4.txt', $e->getMessage() . "-积分价格报错内容\r\n", 8);
|
|
|
+ @file_put_contents('quanju4.txt', $e->getFile() . "-文件\r\n", 8);
|
|
|
+ @file_put_contents('quanju4.txt', $e->getLine() . "-位置\r\n", 8);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
$price = bcadd($add_price, $basePrice, 6);
|
|
|
|
|
|
- @file_put_contents('quanju4.txt', time()."-正常获取走的到这里吗\r\n",8);
|
|
|
- return compact('basePrice', 'price', 'rise', 'achievement', 'commission', 'num','add_price');
|
|
|
+ @file_put_contents('quanju4.txt', time() . "-正常获取走的到这里吗\r\n", 8);
|
|
|
+ return compact('basePrice', 'price', 'rise', 'achievement', 'commission', 'num', 'add_price');
|
|
|
}
|
|
|
|
|
|
- public function setPrice($day, $price, $commission, $achievement, $num,$add_price)
|
|
|
+ public function setPrice($day, $price, $commission, $achievement, $num, $add_price)
|
|
|
{
|
|
|
$add_time = time();
|
|
|
- @file_put_contents('quanju4.txt', $add_price."-我add_price呢\r\n",8);
|
|
|
- return $this->dao->create(compact('day', 'price', 'commission', 'achievement', 'num', 'add_time','add_price'));
|
|
|
+ @file_put_contents('quanju4.txt', $add_price . "-我add_price呢\r\n", 8);
|
|
|
+ return $this->dao->create(compact('day', 'price', 'commission', 'achievement', 'num', 'add_time', 'add_price'));
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 列表搜索
|
|
|
* @param int $merId
|
|
|
@@ -113,6 +121,7 @@ class AwardIntegralPriceRepository extends BaseRepository
|
|
|
$list = $query->page($page, $limit)->hidden(['update_time'])->select();
|
|
|
return compact('count', 'list');
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 根据条件获取列表数据
|
|
|
*
|
|
|
@@ -136,6 +145,7 @@ class AwardIntegralPriceRepository extends BaseRepository
|
|
|
// 返回包含数据总数和数据列表的数组
|
|
|
return compact('count', 'list');
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 根据条件获取列表数据
|
|
|
*
|
|
|
@@ -160,6 +170,7 @@ class AwardIntegralPriceRepository extends BaseRepository
|
|
|
// 返回包含数据总数和数据列表的数组
|
|
|
return compact('count', 'list');
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 根据条件获取列表数据
|
|
|
*
|
|
|
@@ -184,7 +195,9 @@ class AwardIntegralPriceRepository extends BaseRepository
|
|
|
// 返回包含数据总数和数据列表的数组
|
|
|
return compact('count', 'list');
|
|
|
}
|
|
|
- public function getPrice(){
|
|
|
+
|
|
|
+ public function getPrice()
|
|
|
+ {
|
|
|
$mark = app()->make(AwardIntegralPriceDao::class);
|
|
|
$price = $mark->search([])->order('add_time DESC')->value('price');
|
|
|
return $price;
|