|
|
@@ -15,6 +15,7 @@ namespace app\common\repositories\user;
|
|
|
|
|
|
|
|
|
use app\common\dao\user\AwardIntegralPriceDao;
|
|
|
+use app\common\dao\user\AwardIntegralPriceDayDao;
|
|
|
use app\common\dao\user\AwardLakeDao;
|
|
|
use app\common\dao\user\AwardLakeLogDao;
|
|
|
use app\common\model\store\order\StoreOrder;
|
|
|
@@ -65,7 +66,7 @@ class AwardIntegralPriceRepository extends BaseRepository
|
|
|
->where('status', '>=', 0)
|
|
|
->sum('total_price');
|
|
|
@file_put_contents('yesterday.txt', StoreOrder::getLastSql() . PHP_EOL, FILE_APPEND);
|
|
|
- $achievement = bcmul((string)$achievement, '0.05', 6);
|
|
|
+ $achievement = bcmul((string)$achievement, '0.1', 6); //从总业绩的5%上涨到10%
|
|
|
/** @var UserExtractRepository $extractRepositories */
|
|
|
$extractRepositories = app()->make(UserExtractRepository::class);
|
|
|
$commission = $extractRepositories->search(['status' => 1])->whereBetween('check_time', [$time_start, $time_end])->sum('commission');
|
|
|
@@ -73,18 +74,26 @@ class AwardIntegralPriceRepository extends BaseRepository
|
|
|
$userService = app()->make(UserRepository::class);
|
|
|
$num = $userService->search(['status' => 1])->sum('award_integral');
|
|
|
$sum_achievement = bcadd((string)$commission, (string)$achievement, 6);
|
|
|
-
|
|
|
$rise = $num > 0 ? bcdiv($sum_achievement, $num, 6) : 0;
|
|
|
- $price = bcadd($rise, $basePrice, 6);
|
|
|
-
|
|
|
+ if ($rise >0){
|
|
|
+ // 增长值分成25份
|
|
|
+ $add_price = bcdiv($rise, 25, 6);
|
|
|
+ /** @var AwardIntegralPriceDayDao $AwardIntegralPriceDayDao */
|
|
|
+ $AwardIntegralPriceDayDao = app()->make(AwardIntegralPriceDayDao::class);
|
|
|
+ $AwardIntegralPriceDayDao->create(['day' => strtotime('-25 day'), 'price' => $rise,'add_price'=>$add_price]); //保存今天增长的总价格和每日增长价格
|
|
|
+ $day_25 =strtotime('-25 day');
|
|
|
+ $day_25_rise = $AwardIntegralPriceDayDao->search(['day' => $day])->sum('price');
|
|
|
+ }
|
|
|
+ $price = bcadd($day_25_rise, $basePrice, 6);
|
|
|
|
|
|
- return compact('basePrice', 'price', 'rise', 'achievement', 'commission', 'num');
|
|
|
+ @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)
|
|
|
+ public function setPrice($day, $price, $commission, $achievement, $num,$add_price)
|
|
|
{
|
|
|
$add_time = time();
|
|
|
- return $this->dao->create(compact('day', 'price', 'commission', 'achievement', 'num', 'add_time'));
|
|
|
+ return $this->dao->create(compact('day', 'price', 'commission', 'achievement', 'num', 'add_time','add_price'));
|
|
|
}
|
|
|
/**
|
|
|
* 列表搜索
|