wesmiler 2 semanas atrás
pai
commit
247dc5e4da

+ 6 - 0
app/Services/Common/StoreCategoryService.php

@@ -127,6 +127,12 @@ class StoreCategoryService extends BaseService
             $param['remark'] = ''; // 默认备注为空
             $param['remark'] = ''; // 默认备注为空
         }
         }
 
 
+        $id = isset($param['id'])?$param['id']:0;
+        $checkId = $this->model->where(['name' => $param['name'], 'mark' => 1])->value('id');
+        if ($checkId && ($id != $checkId)) {
+            return message('该商户分类已存在', false);
+        }
+
         // 保存数据
         // 保存数据
         $result = $this->model->edit($param);
         $result = $this->model->edit($param);
         if (!$result) {
         if (!$result) {

+ 2 - 2
app/Services/Common/StoreService.php

@@ -209,10 +209,10 @@ class StoreService extends BaseService
 
 
 
 
         // 手机号唯一性验证
         // 手机号唯一性验证
-        $type = isset($data['type']) && $data['type']? $data['type'] : 1;
+        $categoryId = isset($data['category_id']) && $data['category_id']? $data['category_id'] : 1;
         $id = isset($data['id']) ? $data['id'] : 0;
         $id = isset($data['id']) ? $data['id'] : 0;
         if ($mobile) {
         if ($mobile) {
-            $checkId = $this->model->where(['mobile' => $mobile,'type'=>$type, 'mark' => 1])->value('id');
+            $checkId = $this->model->where(['mobile' => $mobile,'category_id'=>$categoryId, 'mark' => 1])->value('id');
             if ($checkId && ($id != $checkId)) {
             if ($checkId && ($id != $checkId)) {
                 return message('该商户已存在', false);
                 return message('该商户已存在', false);
             }
             }