diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index fbe60792..c0e7dbce 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -1372,8 +1372,8 @@ class Auth extends BaseController $repository->updateStatus($id, $data); } else { //商户交易申请 - $data['business_status'] = $status == 1 ? 2 : 3; - Db::name('merchant')->where('mer_intention_id', $id)->where('status', 1)->update($data); + Db::name('merchant_integntion')->where('mer_intention_id', $intentionId)->where('type', 2)->update(['status' => ($status == 1 ? 1 : 2)]); + Db::name('merchant')->where('mer_intention_id', $id)->where('status', 1)->update(['business_status' => ($status == 1 ? 2 : 3)]); } return app('json')->success('同步成功'); diff --git a/app/controller/api/store/merchant/MerchantIntention.php b/app/controller/api/store/merchant/MerchantIntention.php index 15125759..c46beaa8 100644 --- a/app/controller/api/store/merchant/MerchantIntention.php +++ b/app/controller/api/store/merchant/MerchantIntention.php @@ -114,11 +114,16 @@ class MerchantIntention extends BaseController if (empty($intenInfo)) { return app('json')->fail('商户状态异常'); } + $intenInfoArray = $intenInfo->toArray(); + $intenInfoArray['type'] = 2; + $intentionId = Db::name('merchant_intention')->insertGetId($intenInfoArray); $areaInfo = Db::name('geo_area')->where('area_code', $intenInfo['area_id'] ?? '')->find(); $sendData = [ 'type' => 2, 'type_name' => Db::name('merchant_type')->where('mer_type_id', $merInfo['type_id'])->value('type_name', ''), 'category_name' => Db::name('merchant_category')->where('merchant_category_id', $merInfo['category_id'])->value('category_name', ''), + 'mer_name' => $intenInfo['mer_name'] ?? '', + 'mer_name' => $intenInfo['mer_name'] ?? '', 'company_name' => $intenInfo['company_name'] ?? '', 'organization_code' => $intenInfo['social_credit_code'] ?? '', 'master_name' => $intenInfo['name'], @@ -128,17 +133,15 @@ class MerchantIntention extends BaseController 'area' => $intenInfo['area_id'] ?? '', 'street' => $intenInfo['street_id'] ?? '', 'address' => $intenInfo['address'] ?? '', - 'mer_intention_id' => $intenInfo['mer_intention_id'] + 'mer_intention_id' => $intentionId ]; $postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant'; $res = $this->sendMerIntentionApply($sendData, $postUrl); if (!$res) { + Db::name('merchant_integntion')->where('mer_intention_id', $intentionId)->delete(); throw new ValidateException('商户交易申请失败,请联系平台'); } Db::name('merchant')->where('uid', $this->userInfo->uid)->where('status', 1)->update(['business_status'=>1]); - $intenInfoArray = $intenInfo->toArray(); - $intenInfoArray['type'] = 1; - Db::name('merchant_intention')->insert($intenInfoArray); return app('json')->success('申请成功'); } @@ -209,6 +212,7 @@ class MerchantIntention extends BaseController 'type' => 1, 'type_name' => Db::name('merchant_type')->where('mer_type_id', $data['mer_type_id'])->value('type_name', ''), 'category_name' => Db::name('merchant_category')->where('merchant_category_id', $data['merchant_category_id'])->value('category_name', ''), + 'mer_name' => $intenInfo['mer_name'] ?? '', 'company_name' => $data['company_name'] ?? '', 'organization_code' => $data['social_credit_code'] ?? '', 'master_name' => $data['name'],