From c62df020e797972a1200f4433da3676860cf24cd Mon Sep 17 00:00:00 2001
From: wuhui_zzw <1760308791@qq.com>
Date: Wed, 13 Mar 2024 10:47:25 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E6=B6=88=E8=B4=B9?=
=?UTF-8?q?=E8=BF=94=E5=88=A9=20-=20=E5=9F=BA=E6=9C=AC=E8=AE=BE=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers.php | 10 +
plugins/rebate/src/admin/IndexController.php | 14 ++
plugins/rebate/views/index/set.blade.php | 250 ++++++++++++++-----
3 files changed, 207 insertions(+), 67 deletions(-)
diff --git a/app/helpers.php b/app/helpers.php
index 76b000ff..6a0f2164 100644
--- a/app/helpers.php
+++ b/app/helpers.php
@@ -3939,3 +3939,13 @@ if (!function_exists('curlPost')) {
return json_decode($result,true);
}
}
+// 获取下个月的今天(如果时间超出下个月则返回下个月最后一天)
+function getNextMonthDays($timestamp,$num = 1){
+ $nextMoneyToday = strtotime(date("Y-m-d H:i:s",$timestamp). " +{$num} month");// 获取下个月的今天
+ $toMoneyFirstDay = strtotime(date("Y-m-1 H:i:s", $timestamp));// 获取当月第一天
+ $nextMonthFirstDay = strtotime(date("Y-m-d H:i:s", $toMoneyFirstDay). " +{$num} month");// 获取下一个月第一天
+ $nextMonthLastDay = strtotime(date("Y-m-t H:i:s", $nextMonthFirstDay));// 获取下一个月最后一天
+ // 判断:如果下个月的今天时间 大于 下个月最后一天的时间;则返回下个月最后一天 否则返回下个月的今天的时间
+
+ return $nextMoneyToday > $nextMonthLastDay ? $nextMonthLastDay : $nextMoneyToday;
+}
diff --git a/plugins/rebate/src/admin/IndexController.php b/plugins/rebate/src/admin/IndexController.php
index 3fd3ecf3..ddfbf547 100644
--- a/plugins/rebate/src/admin/IndexController.php
+++ b/plugins/rebate/src/admin/IndexController.php
@@ -38,6 +38,20 @@ class IndexController extends BaseController{
// 获取信息
$set = Setting::get('plugin.rebate');
+ // $start = "2024-3-31 12:12:59";
+ // echo "购买时间:".$start."
";
+ // for($i=1;$i <= 20;$i++){
+ // $d = strtotime($start );
+ // echo "第{$i}个月返利时间:".date("Y-m-d H:i:s",getNextMonthDays($d, $i))."
";
+ // }
+ // die;
+
+
+
+
+
+
+
return view('Yunshop\Rebate::index.set',[
'set' => $set,
])->render();
diff --git a/plugins/rebate/views/index/set.blade.php b/plugins/rebate/views/index/set.blade.php
index 945a31ec..1bd8ffd1 100644
--- a/plugins/rebate/views/index/set.blade.php
+++ b/plugins/rebate/views/index/set.blade.php
@@ -3,59 +3,130 @@
@section('content')
-
+