From daebff05eb914032b724f1f319508faefea58ef8 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Thu, 7 Sep 2023 12:47:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=93=E6=9D=9F=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/community/Community.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/app/controller/api/community/Community.php b/app/controller/api/community/Community.php index 5b9a2ee3..9cb74c1f 100644 --- a/app/controller/api/community/Community.php +++ b/app/controller/api/community/Community.php @@ -745,7 +745,7 @@ class Community extends BaseController } /** - * 申请结束商品委托 + * 供应链商家申请结束商品委托 * @return mixed */ public function applyFinishEntrust($id) @@ -758,6 +758,11 @@ class Community extends BaseController if ($merchantId != $communityInfo['entrust_mer_id']) { return app('json')->fail('当前商户无申请结束此委托商品权限'); } + $entrustInfo = Db::name('entrust')->where('community_id', $id)->where('is_del', 0)->find(); + $limitTime = strtotime($entrustInfo['create_time']) + ($entrustInfo['entrust_day'] ?? 0) * 86400; + if (time() < $limitTime) { + return app('json')->fail('委托时间内不能申请结束委托'); + } $res = Db::name('community')->where('community_id', $id)->where('is_del', 0)->update(['entrust_finish' => 3]); if (!$res) { return app('json')->fail('申请操作失败'); @@ -784,16 +789,24 @@ class Community extends BaseController } // 同意 if ($status == 1) { - + $entrustInfo = Db::name('entrust')->where('community_id', $id)->where('is_del', 0)->find(); + $limitTime = strtotime($entrustInfo['create_time']) + ($entrustInfo['entrust_day'] ?? 0) * 86400; + if (time() < $limitTime) { + return app('json')->fail('委托时间内不能结束委托'); + } + $res = Db::name('community')->where('community_id', $id)->where('is_del', 0)->update(['entrust_finish' => 1]); + if (!$res) { + return app('json')->fail('结束操作失败'); + } } // 拒绝 if ($status == 2) { $refusal = $this->request->param('refusal', ''); $res = Db::name('community')->where('community_id', $id)->where('is_del', 0)->update(['entrust_finish_refusal' => $refusal, 'entrust_finish' => 2]); if (!$res) { - return app('json')->fail('审核操作失败'); + return app('json')->fail('结束操作失败'); } } - return app('json')->success('审核操作成功'); + return app('json')->success('结束操作成功'); } }