更新商户审核
This commit is contained in:
parent
0fe03a6de8
commit
a96a958f7e
@ -1362,9 +1362,20 @@ class Auth extends BaseController
|
||||
$repository = app()->make(MerchantIntentionRepository::class);
|
||||
if (!$repository->getWhereCount(['mer_intention_id' => $id, 'is_del' => 0]))
|
||||
return app('json')->fail('数据不存在');
|
||||
$param = $this->request->params(['status']);
|
||||
$data['business_status'] = ($param['status'] ?? 0) == 1 ? 2 : 3;
|
||||
Db::name('merchant')->where('mer_intention_id', $id)->where('status', 1)->update($data);
|
||||
$status = $this->request->params('status', 0);
|
||||
$type = $this->request->params('type', 1);
|
||||
if ($type == 1) {
|
||||
//商户入驻申请
|
||||
$data['status'] = $status;
|
||||
$data['create_mer'] = -1;
|
||||
$data['fail_msg'] = $status == 1 ? '自动审核通过' : '自动审核拒绝';
|
||||
$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);
|
||||
}
|
||||
|
||||
return app('json')->success('同步成功');
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,9 @@ class MerchantIntention extends BaseController
|
||||
]);
|
||||
$areaInfo = Db::name('geo_area')->where('area_code', $data['area_id'] ?? '')->find();
|
||||
$sendData = [
|
||||
'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', ''),
|
||||
'company_name' => $data['company_name'] ?? '',
|
||||
'organization_code' => $data['social_credit_code'] ?? '',
|
||||
'master_name' => $data['name'],
|
||||
@ -88,12 +91,12 @@ class MerchantIntention extends BaseController
|
||||
'address' => $data['address'] ?? '',
|
||||
'mer_intention_id' => $intention->mer_intention_id
|
||||
];
|
||||
// 新增交易申请流程取消合同签约
|
||||
// $res = $this->sendMerIntentionApply($sendData);
|
||||
// if (!$res) {
|
||||
// Db::name('merchant_intention')->where('mer_intention_id', $intention->mer_intention_id)->delete();
|
||||
// throw new ValidateException('申请商户入驻任务失败,请联系平台');
|
||||
// }
|
||||
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
|
||||
$res = $this->sendMerIntentionApply($sendData, $postUrl);
|
||||
if (!$res) {
|
||||
Db::name('merchant_intention')->where('mer_intention_id', $intention->mer_intention_id)->delete();
|
||||
throw new ValidateException('申请商户入驻任务,请联系平台');
|
||||
}
|
||||
return app('json')->success('提交成功');
|
||||
}
|
||||
|
||||
@ -110,6 +113,7 @@ class MerchantIntention extends BaseController
|
||||
}
|
||||
$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', ''),
|
||||
'company_name' => $intenInfo['company_name'] ?? '',
|
||||
@ -123,7 +127,8 @@ class MerchantIntention extends BaseController
|
||||
'address' => $intenInfo['address'] ?? '',
|
||||
'mer_intention_id' => $intenInfo['mer_intention_id']
|
||||
];
|
||||
$res = $this->sendMerIntentionApply($sendData);
|
||||
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
|
||||
$res = $this->sendMerIntentionApply($sendData, $postUrl);
|
||||
if (!$res) {
|
||||
throw new ValidateException('商户交易申请失败,请联系平台');
|
||||
}
|
||||
@ -132,11 +137,10 @@ class MerchantIntention extends BaseController
|
||||
}
|
||||
|
||||
//发送商户入驻申请
|
||||
public function sendMerIntentionApply($data)
|
||||
public function sendMerIntentionApply($data, $postUrl)
|
||||
{
|
||||
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
|
||||
Log::info("商户入驻申请HOST: {$postUrl}");
|
||||
Log::info("发送商户入驻申请信息: " . json_encode($data));
|
||||
Log::info("商户申请HOST: {$postUrl}");
|
||||
Log::info("发送商户申请信息: " . json_encode($data));
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $postUrl);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
@ -147,7 +151,7 @@ class MerchantIntention extends BaseController
|
||||
curl_close($ch);
|
||||
$ok = false;
|
||||
if (!empty($resData) && is_string($resData)) {
|
||||
Log::info("商户入驻申请反馈信息" . $resData);
|
||||
Log::info("商户申请反馈信息" . $resData);
|
||||
$resInfo = json_decode($resData, true);
|
||||
if(!empty($resInfo['code']) && $resInfo['code'] == 1){
|
||||
$ok = true;
|
||||
@ -196,6 +200,9 @@ class MerchantIntention extends BaseController
|
||||
]);
|
||||
$areaInfo = Db::name('geo_area')->where('area_code', $data['area_id'] ?? '')->find();
|
||||
$sendData = [
|
||||
'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', ''),
|
||||
'company_name' => $data['company_name'] ?? '',
|
||||
'organization_code' => $data['social_credit_code'] ?? '',
|
||||
'master_name' => $data['name'],
|
||||
@ -207,11 +214,11 @@ class MerchantIntention extends BaseController
|
||||
'address' => $data['address'] ?? '',
|
||||
'mer_intention_id' => $id
|
||||
];
|
||||
// 新增交易申请流程取消合同签约
|
||||
// $res = $this->sendMerIntentionApply($sendData);
|
||||
// if (!$res) {
|
||||
// throw new ValidateException('申请商户入驻任务失败,请联系平台');
|
||||
// }
|
||||
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
|
||||
$res = $this->sendMerIntentionApply($sendData, $postUrl);
|
||||
if (!$res) {
|
||||
throw new ValidateException('申请商户入驻失败,请联系平台');
|
||||
}
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user