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('添加成功')