95 lines
2.2 KiB
PHP
95 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller\article;
|
|
|
|
|
|
use app\admin\controller\BaseAdminController;
|
|
use app\admin\lists\article\ArticleLikeLists;
|
|
use app\admin\logic\article\ArticleLikeLogic;
|
|
use app\admin\validate\article\ArticleLikeValidate;
|
|
|
|
|
|
/**
|
|
* 文章点赞控制器
|
|
* Class ArticleLikeController
|
|
* @package app\admin\controller\article
|
|
*/
|
|
class ArticleLikeController extends BaseAdminController
|
|
{
|
|
|
|
|
|
/**
|
|
* @notes 获取文章点赞列表
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2024/02/18 15:47
|
|
*/
|
|
public function lists()
|
|
{
|
|
return $this->dataLists(new ArticleLikeLists());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 添加文章点赞
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2024/02/18 15:47
|
|
*/
|
|
public function add()
|
|
{
|
|
$params = (new ArticleLikeValidate())->post()->goCheck('add');
|
|
$result = ArticleLikeLogic::add($params);
|
|
if (true === $result) {
|
|
return $this->success('添加成功', [], 1, 1);
|
|
}
|
|
return $this->fail(ArticleLikeLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑文章点赞
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2024/02/18 15:47
|
|
*/
|
|
public function edit()
|
|
{
|
|
$params = (new ArticleLikeValidate())->post()->goCheck('edit');
|
|
$result = ArticleLikeLogic::edit($params);
|
|
if (true === $result) {
|
|
return $this->success('编辑成功', [], 1, 1);
|
|
}
|
|
return $this->fail(ArticleLikeLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除文章点赞
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2024/02/18 15:47
|
|
*/
|
|
public function delete()
|
|
{
|
|
$params = (new ArticleLikeValidate())->post()->goCheck('delete');
|
|
ArticleLikeLogic::delete($params);
|
|
return $this->success('删除成功', [], 1, 1);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取文章点赞详情
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2024/02/18 15:47
|
|
*/
|
|
public function detail()
|
|
{
|
|
$params = (new ArticleLikeValidate())->goCheck('detail');
|
|
$result = ArticleLikeLogic::detail($params);
|
|
return $this->data($result);
|
|
}
|
|
|
|
|
|
} |