From 737d18702f639093ffbf919c9bf4d350e8169633 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Sat, 9 Sep 2023 17:51:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=A7=94=E6=89=98=E5=A4=A9?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/community/Community.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/controller/api/community/Community.php b/app/controller/api/community/Community.php index ed3eb076..20902695 100644 --- a/app/controller/api/community/Community.php +++ b/app/controller/api/community/Community.php @@ -303,6 +303,9 @@ class Community extends BaseController if ($merchantInfo['credit_buy'] && ($data['entrust_day'] < $merchantInfo['settle_cycle'])) { throw new ValidateException('委托天数不能小于结算周期'); } + if (!$merchantInfo['credit_buy'] && ($data['entrust_day'] < 15 || $data['entrust_day'] > 90)) { + throw new ValidateException('委托天数区间范围[15-90]天'); + } } $data['content'] = filter_emoji($data['content']); @@ -878,9 +881,10 @@ class Community extends BaseController return app('json')->fail('当前商户无申请结束此委托商品权限'); } $entrustInfo = Db::name('entrust')->where('community_id', $id)->where('is_del', 0)->find(); - $limitTime = strtotime($communityInfo['entrust_start_date']) + ($entrustInfo['entrust_day'] ?? 0) * 86400; + //委托周期截止5天内可申请结束委托 + $limitTime = strtotime($communityInfo['entrust_start_date']) + ($entrustInfo['entrust_day'] ?? 0) * 86400 - 5 * 86400; if (time() < $limitTime) { - return app('json')->fail('委托时间内不能申请结束委托'); + return app('json')->fail('委托周期截止5天内可申请结束委托'); } $res = Db::name('community')->where('community_id', $id)->where('is_del', 0)->update(['entrust_finish' => 3]); if (!$res) { @@ -909,9 +913,10 @@ class Community extends BaseController // 同意 if ($status == 1) { $entrustInfo = Db::name('entrust')->where('community_id', $id)->where('is_del', 0)->find(); - $limitTime = strtotime($communityInfo['entrust_start_date']) + ($entrustInfo['entrust_day'] ?? 0) * 86400; + //委托周期截止5天内可申请结束委托 + $limitTime = strtotime($communityInfo['entrust_start_date']) + ($entrustInfo['entrust_day'] ?? 0) * 86400 - 5 * 86400; if (time() < $limitTime) { - return app('json')->fail('委托时间内不能结束委托'); + return app('json')->fail('委托周期截止5天内可申请结束委托'); } // 分润 $res = Db::name('community')->where('community_id', $id)->where('is_del', 0)->update(['entrust_finish' => 1]);