From c3f3d537525546bcb1322968cdeedf5f958e671a Mon Sep 17 00:00:00 2001 From: augushong Date: Wed, 30 Jun 2021 12:43:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=86=E7=B1=BB=E5=92=8C?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=9A=84=E5=BF=AB=E6=8D=B7=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Tag.php | 6 ++++-- view/admin/post/create.html | 6 ++++-- view/admin/post/edit.html | 18 ++++++++---------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/admin/controller/Tag.php b/app/admin/controller/Tag.php index f5d942f..abfbbea 100644 --- a/app/admin/controller/Tag.php +++ b/app/admin/controller/Tag.php @@ -54,15 +54,17 @@ class Tag extends Common $post_data = $request->post(); + $type = $post_data['type']; + $arr = explode(' ',$post_data['tags']); $arr = array_unique(array_filter($arr)); foreach ($arr as $tag) { - $model_tag = ModelTag::where('title',$tag)->find(); + $model_tag = ModelTag::where('title',$tag)->where('type',$type)->find(); if(empty($model_tag)){ - ModelTag::create(['title'=>$tag]); + ModelTag::create(['title'=>$tag,'type'=>$type]); } } diff --git a/view/admin/post/create.html b/view/admin/post/create.html index 071b6f6..6dfd138 100644 --- a/view/admin/post/create.html +++ b/view/admin/post/create.html @@ -391,7 +391,8 @@ } $.post('{:url("Tag/save")}', { - tags: value + tags: value, + type:'{$Request.param.type}' }, function (result) { layer.msg('添加成功') initTags() @@ -445,7 +446,8 @@ $.post('{:url("Category/save")}', { title: title, - pid: pid + pid: pid, + type:'{$Request.param.type}' }, function (result) { if (result.code == 0) { layer.msg('添加成功') diff --git a/view/admin/post/edit.html b/view/admin/post/edit.html index 037fe39..0baa572 100644 --- a/view/admin/post/edit.html +++ b/view/admin/post/edit.html @@ -50,8 +50,7 @@
标题
- +
@@ -144,8 +143,7 @@
发表时间
- +
@@ -178,8 +176,7 @@
- +
新增
@@ -196,8 +193,7 @@
跳转链接
- +
@@ -432,7 +428,8 @@ } $.post('{:url("Tag/save")}', { - tags: value + tags: value, + type: '{$Request.param.type}' }, function (result) { layer.msg('添加成功') initTags() @@ -492,7 +489,8 @@ $.post('{:url("Category/save")}', { title: title, - pid: pid + pid: pid, + type: '{$Request.param.type}' }, function (result) { if (result.code == 0) { layer.msg('添加成功')