diff --git a/app/admin/controller/Tag.php b/app/admin/controller/Tag.php index f5d942f..96f6f94 100644 --- a/app/admin/controller/Tag.php +++ b/app/admin/controller/Tag.php @@ -10,118 +10,118 @@ use think\Request; class Tag extends Common { - /** - * 显示资源列表 - * - * @return \think\Response - */ - public function index() - { - // + /** + * 显示资源列表 + * + * @return \think\Response + */ + public function index() + { + // - $list_tag = ModelTag::order('id desc') - ->where('type',$this->request->param('type',1)) - ->paginate(); + $list_tag = ModelTag::order('id desc') + ->where('type', $this->request->param('type', 1)) + ->paginate(); - if($this->request->isAjax()){ - return json_message($list_tag); + if ($this->request->isAjax()) { + return json_message($list_tag); + } + + View::assign('list', $list_tag); + + return View::fetch(); } - View::assign('list',$list_tag); - - return View::fetch(); - } - - /** - * 显示创建资源表单页. - * - * @return \think\Response - */ - public function create() - { - // - } - - /** - * 保存新建的资源 - * - * @param \think\Request $request - * @return \think\Response - */ - public function save(Request $request) - { - // - - $post_data = $request->post(); - - $arr = explode(' ',$post_data['tags']); - - $arr = array_unique(array_filter($arr)); - - foreach ($arr as $tag) { - $model_tag = ModelTag::where('title',$tag)->find(); - - if(empty($model_tag)){ - ModelTag::create(['title'=>$tag]); - } + /** + * 显示创建资源表单页. + * + * @return \think\Response + */ + public function create() + { + // } - return json_message(); - } + /** + * 保存新建的资源 + * + * @param \think\Request $request + * @return \think\Response + */ + public function save(Request $request) + { + // - /** - * 显示指定的资源 - * - * @param int $id - * @return \think\Response - */ - public function read($id) - { - // - } + $post_data = $request->post(); - /** - * 显示编辑资源表单页. - * - * @param int $id - * @return \think\Response - */ - public function edit($id) - { - // + $arr = explode(' ', $post_data['tags']); - } + $arr = array_unique(array_filter($arr)); - /** - * 保存更新的资源 - * - * @param \think\Request $request - * @param int $id - * @return \think\Response - */ - public function update(Request $request, $id) - { - // + foreach ($arr as $tag) { + $model_tag = ModelTag::where('title', $tag)->find(); - $post_data = $request->post(); + if (empty($model_tag)) { + ModelTag::create(['title' => $tag, 'type' => $request->param('type',1)]); + } + } - $post_data['title'] = str_replace(' ','',$post_data['title']); - - $model_tag = ModelTag::find($id); + return json_message(); + } - $model_tag->save($post_data); + /** + * 显示指定的资源 + * + * @param int $id + * @return \think\Response + */ + public function read($id) + { + // + } - return json_message(); - } + /** + * 显示编辑资源表单页. + * + * @param int $id + * @return \think\Response + */ + public function edit($id) + { + // - /** - * 删除指定资源 - * - * @param int $id - * @return \think\Response - */ - public function delete($id) - { - // - } + } + + /** + * 保存更新的资源 + * + * @param \think\Request $request + * @param int $id + * @return \think\Response + */ + public function update(Request $request, $id) + { + // + + $post_data = $request->post(); + + $post_data['title'] = str_replace(' ', '', $post_data['title']); + + $model_tag = ModelTag::find($id); + + $model_tag->save($post_data); + + return json_message(); + } + + /** + * 删除指定资源 + * + * @param int $id + * @return \think\Response + */ + public function delete($id) + { + // + } } diff --git a/app/model/Post.php b/app/model/Post.php index ab9a2d2..1f0b8cd 100644 --- a/app/model/Post.php +++ b/app/model/Post.php @@ -157,7 +157,7 @@ class Post extends Model { $url_info = parse_url((string)url('index/Index/index')->domain('www')); - return $url_info['scheme'] . '://' . $url_info['host'] . '/a' . $this->getData('uid') . '.html'; + return $url_info['scheme'] . '://' . $url_info['host'] . '/index/a' . $this->getData('uid') . '.html'; } public function getShareTextAttr() diff --git a/view/admin/post/create.html b/view/admin/post/create.html index 996490a..fe3ad34 100644 --- a/view/admin/post/create.html +++ b/view/admin/post/create.html @@ -2,477 +2,478 @@
- - - -