From 0a7be319f2d451b5d87eed280f5cbf88445f4693 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Fri, 26 Jan 2024 20:24:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E8=B1=86=E8=B1=86?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=9A=E5=95=86=E6=88=B7=E6=8F=90=E7=8E=B0=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=92=8C=E6=94=AF=E4=BB=98=E5=AE=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platformCommission/LegumesRepository.php | 6 +++--- .../platformCommission/RecordRepository.php | 20 +++++++++++++++++++ .../system/financial/FinancialRepository.php | 8 ++++---- 3 files changed, 27 insertions(+), 7 deletions(-) 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,