diff --git a/app/common/repositories/store/platformCommission/LegumesRepository.php b/app/common/repositories/store/platformCommission/LegumesRepository.php index e3440b4..0ee45c4 100644 --- a/app/common/repositories/store/platformCommission/LegumesRepository.php +++ b/app/common/repositories/store/platformCommission/LegumesRepository.php @@ -32,11 +32,11 @@ class LegumesRepository extends BaseRepository{ // 获取周期时间 [$startTime,$endTime] = getTimeStamp('yesterday');// 天 // 获取周期内基金池金额 - [$totalIntegralReleaseMoney,$refundMoney,$realityMoney] = app()->make(RecordRepository::class)->getTotalIntegralReleaseMoney($startTime,$endTime); + [$totalIntegralReleaseMoney,$refundMoney,$realityMoney] = app()->make(RecordRepository::class)->getTotalPlatformCommissionMoneyMoney($startTime,$endTime); if($realityMoney <= 0) throw new Exception('基金池金额为0'); $legumesPrice = $set['legumes_price'] <= 0 ? 0.5 : $set['legumes_price']; - // 计算豆豆数量 文创豆=平台抽成的销售额10%➗首次价格0.5 - $legumesNum = (float)sprintf("%.2f",$realityMoney / $legumesPrice); + // 计算豆豆数量 文创豆=平台抽成的销售额20%➗首次价格0.5 + $legumesNum = (float)sprintf("%.2f",($realityMoney * 20 / 100) / $legumesPrice); // 明日价格 下次文创豆价格=基金池金额(消费者的70%)➗ 文创豆数量 [$allTotalIntegralReleaseMoney,$allRefundMoney,$allRealityMoney] = app()->make(RecordRepository::class)->getTotalIntegralReleaseMoney(); $allLegumes = (float)$this->dao->getSearch([])->sum('legumes_num'); diff --git a/app/common/repositories/store/platformCommission/RecordRepository.php b/app/common/repositories/store/platformCommission/RecordRepository.php index a6c9041..855f446 100644 --- a/app/common/repositories/store/platformCommission/RecordRepository.php +++ b/app/common/repositories/store/platformCommission/RecordRepository.php @@ -186,8 +186,28 @@ class RecordRepository extends BaseRepository{ return [(float)$totalIntegralReleaseMoney,(float)$refundMoney,(float)$realityMoney]; } + public function getTotalPlatformCommissionMoneyMoney(int $startTime = 0,int $endTime = 0):array{ + // 获取总数量 + $totalIntegralReleaseMoney = (float)$this->dao->getSearch([]) + ->when($startTime > 0 && $endTime > 0,function($query) use ($startTime,$endTime){ + $query->whereBetweenTime('create_time', $startTime, $endTime); + }) + ->sum('platform_commission_money'); + // 获取退款金额 + $refundTotalIntegralReleaseMoney = $this->dao->getSearch([]) + ->field('sum((platform_commission_money * refund_ratio / 100)) as refund_money') + ->when($startTime > 0 && $endTime > 0,function($query) use ($startTime,$endTime){ + $query->whereBetweenTime('create_time', $startTime, $endTime); + }) + ->find(); + $refundMoney = sprintf("%.2f",$refundTotalIntegralReleaseMoney->refund_money ?? 0); + // 实际金额 + $realityMoney = sprintf("%.2f",$totalIntegralReleaseMoney - $refundMoney); + return [(float)$totalIntegralReleaseMoney,(float)$refundMoney,(float)$realityMoney]; + } + diff --git a/app/common/repositories/system/financial/FinancialRepository.php b/app/common/repositories/system/financial/FinancialRepository.php index 90337d0..b667e37 100644 --- a/app/common/repositories/system/financial/FinancialRepository.php +++ b/app/common/repositories/system/financial/FinancialRepository.php @@ -33,8 +33,8 @@ class FinancialRepository extends BaseRepository Elm::radio('financial_type', '转账类型', $merchant->financial_type) ->setOptions([ ['value' => 1, 'label' => '银行卡'], - ['value' => 2, 'label' => '微信'], - ['value' => 3, 'label' => '支付宝'], + // ['value' => 2, 'label' => '微信'], + // ['value' => 3, 'label' => '支付宝'], ])->control([ [ 'value' => 1, @@ -125,8 +125,8 @@ class FinancialRepository extends BaseRepository ['type' => 'span','native' => FALSE,'title' => '商户可提现金额:','children' => ["$_extract"]], Elm::radio('financial_type', '转账类型:', $merchant->financial_type)->setOptions([ ['value' => 1, 'label' => '银行卡'], - ['value' => 2, 'label' => '微信'], - ['value' => 3, 'label' => '支付宝'], + // ['value' => 2, 'label' => '微信'], + // ['value' => 3, 'label' => '支付宝'], ])->control([ [ 'value' => 1,