Ver Fonte

wesmiler

wesmiler há 2 semanas atrás
pai
commit
d81b5fd99e
1 ficheiros alterados com 3 adições e 3 exclusões
  1. 3 3
      app/Services/Common/StoreCategoryService.php

+ 3 - 3
app/Services/Common/StoreCategoryService.php

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