From fa00a574e590c686070443127ceae432ea929ddc Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Tue, 19 Sep 2023 10:29:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=95=86=E6=88=B7=E4=BA=A4?= =?UTF-8?q?=E6=98=93=E7=94=B3=E8=AF=B7=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/store/merchant/MerchantIntention.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controller/api/store/merchant/MerchantIntention.php b/app/controller/api/store/merchant/MerchantIntention.php index f62aecd6..db9c0a39 100644 --- a/app/controller/api/store/merchant/MerchantIntention.php +++ b/app/controller/api/store/merchant/MerchantIntention.php @@ -107,7 +107,10 @@ class MerchantIntention extends BaseController } if ($this->userInfo) $data['uid'] = $this->userInfo->uid; $merInfo = Db::name('merchant')->where('uid', $this->userInfo->uid)->where('status', 1)->find(); - $intenInfo = Db::name('merchant_intention')->where('mer_intention_id', $merInfo['mer_intention_id'] ?? 0)->find(); + if (!empty($merInfo['business_status']) && ($merInfo['business_status']==2)) { + return app('json')->fail('商户交易申请已通过'); + } + $intenInfo = Db::name('merchant_intention')->where('mer_intention_id', $merInfo['mer_intention_id'] ?? 0)->where('type', 1)->find(); if (empty($intenInfo)) { return app('json')->fail('商户状态异常'); } @@ -133,6 +136,14 @@ class MerchantIntention extends BaseController throw new ValidateException('商户交易申请失败,请联系平台'); } Db::name('merchant')->where('uid', $this->userInfo->uid)->where('status', 1)->update(['business_status'=>1]); + $intenInfoArray = $intenInfo->toArray(); + $intenInfoArray['type'] = 1; + $bussIntention = Db::name('merchant_intention')->where('mer_intention_id', $intenInfo['mer_intention_id'])->where('type', 2)->find(); + if ($bussIntention) { + Db::name('merchant_intention')->where('mer_intention_id', $intenInfo['mer_intention_id'])->where('type', 2)->update($intenInfoArray); + }else { + Db::name('merchant_intention')->insert($intenInfoArray); + } return app('json')->success('申请成功'); }