更新商户交易申请
This commit is contained in:
parent
70fbe1ed9f
commit
6ecce17f60
@ -1355,16 +1355,15 @@ class Auth extends BaseController
|
||||
//同步商户状态信息
|
||||
public function merchantStatus($id)
|
||||
{
|
||||
Log::info("接收到同步商户状态HOST:" . request()->host() . request()->url());
|
||||
Log::info("接收到同步商户状态数据:" . json_encode(request()->param()));
|
||||
// business_status 交易申请状态:0未申请 1申请中 2申请通过 3申请拒绝
|
||||
Log::info("同步商户交易申请状态HOST:" . request()->host() . request()->url());
|
||||
Log::info("同步商户交易申请状态数据:" . json_encode(request()->param()));
|
||||
$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['status'] = $param['status'];
|
||||
$data['create_mer'] = -1;
|
||||
$data['fail_msg'] = $param['status'] == 1 ? '自动审核通过' : '自动审核拒绝';
|
||||
$repository->updateStatus($id, $data);
|
||||
$data['business_status'] = ($param['status'] ?? 0) == 1 ? 2 : 3;
|
||||
Db::name('merchant')->where('mer_intention_id', $id)->where('status', 1)->update($data);
|
||||
return app('json')->success('同步成功');
|
||||
}
|
||||
}
|
||||
|
@ -97,6 +97,40 @@ class MerchantIntention extends BaseController
|
||||
return app('json')->success('提交成功');
|
||||
}
|
||||
|
||||
public function businessApply()
|
||||
{
|
||||
if (!systemConfig('mer_intention_open')) {
|
||||
return app('json')->fail('未开启商户入驻');
|
||||
}
|
||||
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($intenInfo)) {
|
||||
return app('json')->fail('商户状态异常');
|
||||
}
|
||||
$areaInfo = Db::name('geo_area')->where('area_code', $intenInfo['area_id'] ?? '')->find();
|
||||
$sendData = [
|
||||
'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'] ?? '',
|
||||
'organization_code' => $intenInfo['social_credit_code'] ?? '',
|
||||
'master_name' => $intenInfo['name'],
|
||||
'master_phone' => $intenInfo['phone'],
|
||||
'images' => !empty($intenInfo['images'])?json_encode(explode(',', $intenInfo['images'])):'',
|
||||
'city' => $areaInfo['city_code'] ?? '',
|
||||
'area' => $intenInfo['area_id'] ?? '',
|
||||
'street' => $intenInfo['street_id'] ?? '',
|
||||
'address' => $intenInfo['address'] ?? '',
|
||||
'mer_intention_id' => $intenInfo['mer_intention_id']
|
||||
];
|
||||
$res = $this->sendMerIntentionApply($sendData);
|
||||
if (!$res) {
|
||||
throw new ValidateException('商户交易申请失败,请联系平台');
|
||||
}
|
||||
Db::name('merchant')->where('uid', $this->userInfo->uid)->where('status', 1)->update(['business_status'=>1]);
|
||||
return app('json')->success('申请成功');
|
||||
}
|
||||
|
||||
//发送商户入驻申请
|
||||
public function sendMerIntentionApply($data)
|
||||
{
|
||||
|
@ -555,6 +555,7 @@ Route::group('api/', function () {
|
||||
Route::post('upload/video', 'merchant.Common/uploadVideo');
|
||||
Route::get('excel/download/:id', 'merchant.store.order.Order/download');
|
||||
//申请商户
|
||||
Route::post('intention/business', 'api.store.merchant.MerchantIntention/businessApply');
|
||||
Route::post('intention/create', 'api.store.merchant.MerchantIntention/create');
|
||||
Route::get('intention/cate', 'api.store.merchant.MerchantIntention/cateLst');
|
||||
Route::get('intention/v2/cate', 'api.store.merchant.MerchantIntention/v2CateLst');
|
||||
|
Loading…
x
Reference in New Issue
Block a user