更新完善商户申请
This commit is contained in:
parent
ccd808be17
commit
a35b04660e
@ -99,6 +99,12 @@ class Merchant extends BaseController
|
||||
public function create(MerchantValidate $validate)
|
||||
{
|
||||
$data = $this->checkParam($validate);
|
||||
if (!empty($data['mer_phone'])) {
|
||||
$newUid = Db::name('User')->where('account', $data['mer_phone'])->value('uid', 0);
|
||||
if ($newUid) {
|
||||
return app('json')->fail('该商家手机号已存在账户,请更换手机');
|
||||
}
|
||||
}
|
||||
$this->repository->createMerchant($data);
|
||||
return app('json')->success('添加成功');
|
||||
}
|
||||
@ -143,6 +149,11 @@ class Merchant extends BaseController
|
||||
if (!$data['category_id'] || !$merchantCategoryRepository->exists($data['category_id']))
|
||||
return app('json')->fail('商户分类不存在');
|
||||
|
||||
$newUid = Db::name('User')->where('account', $data['mer_phone'])->value('uid', -1);
|
||||
$merId = Db::name('Merchant')->where('uid', $newUid)->value('mer_id', 0);
|
||||
if ($newUid != -1 && $id != $merId) {
|
||||
return app('json')->fail('该商家手机号已存在账户,请更换手机');
|
||||
}
|
||||
unset($data['mer_account'], $data['mer_password']);
|
||||
$margin = $this->repository->checkMargin($id, $data['type_id']);
|
||||
$data['margin'] = $margin['margin'];
|
||||
|
@ -45,10 +45,14 @@ class MerchantIntention extends BaseController
|
||||
return app('json')->fail('未开启商户入驻');
|
||||
}
|
||||
if ($this->userInfo) $data['uid'] = $this->userInfo->uid;
|
||||
$newUid = Db::name('User')->where('account', $data['phone'])->value('uid', 0);
|
||||
if (!$newUid && ($this->userInfo->uid != $newUid)) {
|
||||
$newUid = Db::name('User')->where('account', $data['phone'])->value('uid', -1);
|
||||
if ($newUid != -1 && $this->userInfo->uid != $newUid) {
|
||||
throw new ValidateException('该申请手机已存在账户,不可申请');
|
||||
}
|
||||
$newMerid = Db::name('Merchant')->where('mer_phone', $data['phone'])->value('mer_id', -1);
|
||||
if ($newMerid != -1) {
|
||||
throw new ValidateException('该申请手机已存在商户,不可申请');
|
||||
}
|
||||
$make = app()->make(MerchantRepository::class);
|
||||
if ($make->fieldExists('mer_name', $data['mer_name']))
|
||||
throw new ValidateException('商户名称已存在,不可申请');
|
||||
@ -77,6 +81,9 @@ class MerchantIntention extends BaseController
|
||||
if (!systemConfig('mer_intention_open')) {
|
||||
return app('json')->fail('未开启商户入驻');
|
||||
}
|
||||
if (!empty($data['mer_phone'])) {
|
||||
unset($data['mer_phone']);
|
||||
}
|
||||
$data['create_time'] = date('Y-m-d H:i:s', time());
|
||||
$this->repository->updateIntention((int)$id, $data);
|
||||
SwooleTaskService::admin('notice', [
|
||||
|
Loading…
x
Reference in New Issue
Block a user