优化页面内的分类快速添加;

This commit is contained in:
2022-02-12 15:37:36 +08:00
parent 5fb6590565
commit 90bbf61b6a
4 changed files with 1020 additions and 1023 deletions

View File

@@ -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)
{
//
}
}

View File

@@ -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()