更新商户编辑
This commit is contained in:
parent
fad5f44664
commit
87e94df5f7
@ -256,8 +256,8 @@ class MerchantRepository extends BaseRepository
|
|||||||
$merchantCategoryRepository = app()->make(MerchantCategoryRepository::class);
|
$merchantCategoryRepository = app()->make(MerchantCategoryRepository::class);
|
||||||
$adminRepository = app()->make(MerchantAdminRepository::class);
|
$adminRepository = app()->make(MerchantAdminRepository::class);
|
||||||
|
|
||||||
if (!$data['category_id'] || !$merchantCategoryRepository->exists($data['category_id']))
|
// if (!$data['category_id'] || !$merchantCategoryRepository->exists($data['category_id']))
|
||||||
throw new ValidateException('商户分类不存在');
|
// throw new ValidateException('商户分类不存在');
|
||||||
if ($adminRepository->fieldExists('account', $data['mer_account']))
|
if ($adminRepository->fieldExists('account', $data['mer_account']))
|
||||||
throw new ValidateException('账号已存在');
|
throw new ValidateException('账号已存在');
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ class MerchantRepository extends BaseRepository
|
|||||||
$margin = app()->make(MerchantTypeRepository::class)->get($data['type_id']);
|
$margin = app()->make(MerchantTypeRepository::class)->get($data['type_id']);
|
||||||
$data['is_margin'] = $margin['is_margin'] ?? -1;
|
$data['is_margin'] = $margin['is_margin'] ?? -1;
|
||||||
$data['margin'] = $margin['margin'] ?? 0;
|
$data['margin'] = $margin['margin'] ?? 0;
|
||||||
|
|
||||||
return Db::transaction(function () use ($data, $make) {
|
return Db::transaction(function () use ($data, $make) {
|
||||||
$account = $data['mer_account'];
|
$account = $data['mer_account'];
|
||||||
$password = $data['mer_password'];
|
$password = $data['mer_password'];
|
||||||
|
@ -148,7 +148,7 @@ class Merchant extends BaseController
|
|||||||
return app('json')->fail('请输入正确的手机号');
|
return app('json')->fail('请输入正确的手机号');
|
||||||
// if (!$data['category_id'] || !$merchantCategoryRepository->exists($data['category_id']))
|
// if (!$data['category_id'] || !$merchantCategoryRepository->exists($data['category_id']))
|
||||||
// return app('json')->fail('商户分类不存在');
|
// return app('json')->fail('商户分类不存在');
|
||||||
|
|
||||||
$newUid = Db::name('User')->where('account', $data['mer_phone'])->value('uid', -1);
|
$newUid = Db::name('User')->where('account', $data['mer_phone'])->value('uid', -1);
|
||||||
$merId = Db::name('Merchant')->where('uid', $newUid)->value('mer_id', 0);
|
$merId = Db::name('Merchant')->where('uid', $newUid)->value('mer_id', 0);
|
||||||
if ($newUid != -1 && $id != $merId) {
|
if ($newUid != -1 && $id != $merId) {
|
||||||
|
@ -33,7 +33,7 @@ class MerchantValidate extends Validate
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $rule = [
|
protected $rule = [
|
||||||
'category_id|商户分类' => '',
|
// 'category_id|商户分类' => '',
|
||||||
'type_id|店铺类型' => 'integer',
|
'type_id|店铺类型' => 'integer',
|
||||||
'mer_name|商户名称' => 'require|max:32',
|
'mer_name|商户名称' => 'require|max:32',
|
||||||
'mer_account|商户账号' => 'require|alphaNum|min:4|max:16',
|
'mer_account|商户账号' => 'require|alphaNum|min:4|max:16',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user