ソースを参照

Wesmiler OTC 提交更新 0729

APPLE 3 年 前
コミット
c1c2236dcb
1 ファイル変更11 行追加0 行削除
  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
     }