diff --git a/app/controller/api/store/merchant/MerchantIntention.php b/app/controller/api/store/merchant/MerchantIntention.php index b3758bb3..1d2a48bc 100644 --- a/app/controller/api/store/merchant/MerchantIntention.php +++ b/app/controller/api/store/merchant/MerchantIntention.php @@ -96,9 +96,9 @@ class MerchantIntention extends BaseController ]; $postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant'; $res = $this->sendMerIntentionApply($sendData, $postUrl); - if (!$res) { + if (!$res['ok']) { Db::name('merchant_intention')->where('mer_intention_id', $intention->mer_intention_id)->delete(); - throw new ValidateException('申请商户入驻失败,请联系平台'); + throw new ValidateException('申请商户入驻失败,' . $res['msg']); } return app('json')->success('提交成功'); } @@ -195,9 +195,9 @@ class MerchantIntention extends BaseController ]; $postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant'; $res = $this->sendMerIntentionApply($sendData, $postUrl); - if (!$res) { + if (!$res['ok']) { Db::name('merchant_integntion')->where('mer_intention_id', $intentionId)->delete(); - throw new ValidateException('商户交易申请失败,请联系平台'); + throw new ValidateException('商户交易申请失败,' . $res['msg']); } Db::name('merchant')->where('uid', $this->userInfo->uid)->where('status', 1)->update(['business_status'=>1]); return app('json')->success('申请成功'); @@ -216,15 +216,20 @@ class MerchantIntention extends BaseController curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $resData = curl_exec($ch); curl_close($ch); - $ok = false; + $rtnData = [ + 'ok' => false, + 'msg' => '' + ]; if (!empty($resData) && is_string($resData)) { Log::info("商户申请反馈信息" . $resData); $resInfo = json_decode($resData, true); if(!empty($resInfo['code']) && $resInfo['code'] == 1){ - $ok = true; + $rtnData['ok'] = true; + } else { + $rtnData['msg'] = $resInfo['msg']; } } - return $ok; + return $rtnData; } public function update($id) @@ -284,8 +289,8 @@ class MerchantIntention extends BaseController ]; $postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant'; $res = $this->sendMerIntentionApply($sendData, $postUrl); - if (!$res) { - throw new ValidateException('申请商户入驻失败,请联系平台'); + if (!$res['ok']) { + throw new ValidateException('申请商户入驻失败,' . $res['msg']); } return app('json')->success('修改成功'); }