Explorar o código

Wesmiler OTC 提交更新 0729

APPLE %!s(int64=3) %!d(string=hai) anos
pai
achega
c1c2236dcb
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  1. 11 0
      app/Services/Common/ArticleService.php

+ 11 - 0
app/Services/Common/ArticleService.php

@@ -160,6 +160,17 @@ class ArticleService extends BaseService
             $data['post_time'] = time();
         }
 
+        $type = isset($data['type'])? $data['type'] : 0;
+        $attrType = isset($data['attr_type'])? $data['attr_type'] : 0;
+        $id = isset($data['id'])? $data['id'] : 0;
+        if($attrType==2){
+            if($id && $this->model->where(['type'=> $type])->whereNotIn('id',[$id])->value('id')){
+                return returnJson('已经存在该分类单页文章', false);
+            }else if($this->model->where(['type'=> $type,'attr_type'=>2])->value('id')){
+                return returnJson('已经存在该分类单页文章', false);
+            }
+        }
+
         return parent::edit($data); // TODO: Change the autogenerated stub
     }