调整商户入驻申请
This commit is contained in:
parent
abab7ed19a
commit
01cbca8407
@ -12,6 +12,8 @@
|
||||
|
||||
namespace app\common\repositories\system\merchant;
|
||||
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use app\common\model\system\merchant\MerchantIntention;
|
||||
use app\common\repositories\BaseRepository;
|
||||
use crmeb\jobs\SendSmsJob;
|
||||
use crmeb\services\SmsService;
|
||||
@ -100,6 +102,7 @@ class MerchantIntentionRepository extends BaseRepository
|
||||
|
||||
public function updateStatus($id, $data)
|
||||
{
|
||||
$data['create_mer'] = !empty($data['create_mer']) ? $data['create_mer'] : 2;
|
||||
$create = ($data['create_mer'] == 1 || $data['create_mer'] == -1);
|
||||
$autoCreate = 0;
|
||||
if ($data['create_mer'] == -1) {
|
||||
@ -172,7 +175,8 @@ class MerchantIntentionRepository extends BaseRepository
|
||||
}
|
||||
Db::transaction(function () use ($config, $intention, $data, $create,$margin,$merData,$smsData,$autoCreate) {
|
||||
if ($data['status'] == 1) {
|
||||
if ($create && $intention['type'] == 1) {
|
||||
if ($intention['type'] == 1) {
|
||||
if ($create) {
|
||||
$merchant = app()->make(MerchantRepository::class)->createMerchant($merData);
|
||||
$data['mer_id'] = $merchant->mer_id;
|
||||
$data['uid'] = $intention['uid'];
|
||||
@ -194,6 +198,12 @@ class MerchantIntentionRepository extends BaseRepository
|
||||
$store_service_data['create_time'] = date('Y-m-d H:i:s');
|
||||
Db::name('store_service')->insert($store_service_data);
|
||||
}
|
||||
} else {
|
||||
$merId = MerchantIntention::where('uid', $intention['uid'])->where('status', 1)->value('mer_id');
|
||||
if (!empty($merId)) {
|
||||
Merchant::where('mer_id', $merId)->update(['business_status' => 2]);
|
||||
}
|
||||
}
|
||||
Queue::push(SendSmsJob::class, ['tempId' => 'APPLY_MER_SUCCESS', 'id' => $smsData]);
|
||||
} else {
|
||||
Queue::push(SendSmsJob::class, ['tempId' => 'APPLY_MER_FAIL', 'id' => $smsData]);
|
||||
|
@ -184,10 +184,13 @@ class MerchantIntention extends BaseController
|
||||
return app('json')->fail('未开启商户入驻');
|
||||
}
|
||||
if ($this->userInfo) $data['uid'] = $this->userInfo->uid;
|
||||
$settleIn = $this->repository->getWhere(['type' => 1, 'uid' => $data['uid'], 'is_del' => 0, 'status' => 1]);
|
||||
$settleIn = $this->repository->getWhere(['type' => 1, 'uid' => $data['uid'], 'is_del' => 0]);
|
||||
if (empty($settleIn)) {
|
||||
return app('json')->fail('请申请商户入驻申请!');
|
||||
}
|
||||
if ($settleIn['status'] == 0) {
|
||||
return app('json')->fail('请等待商户入驻申请审核!');
|
||||
}
|
||||
$merIntentionInfo = $this->repository->getWhere(['type' => 2, 'uid' => $data['uid'], 'is_del' => 0]);
|
||||
if (!empty($merIntentionInfo) && ($merIntentionInfo['status'] == 0)) {
|
||||
return app('json')->fail('商户交易已申请,正在审核中!');
|
||||
@ -195,7 +198,7 @@ class MerchantIntention extends BaseController
|
||||
if (!empty($merIntentionInfo) && ($merIntentionInfo['status'] == 1)) {
|
||||
return app('json')->fail('商户交易申请已通过');
|
||||
}
|
||||
$intenInfo['phone'] = $settleIn['bank_username'];
|
||||
$intenInfo['phone'] = $settleIn['phone'];
|
||||
$intenInfo['mer_name'] = $settleIn['mer_name'];
|
||||
$intenInfo['company_name'] = $settleIn['company_name'];
|
||||
$intenInfo['name'] = $settleIn['name'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user