chore: 添加静态资源文件和版本配置文件
添加大量图片、字体、音频等静态资源文件,包括用户界面图片、模板文件和安装界面素材 添加系统版本配置文件(.version)和常量定义文件(.constant) 更新供应商依赖文件,包括Symfony VarDumper组件和相关许可证文件 添加验证码配置文件(captcha.php)和.gitignore规则
This commit is contained in:
136
app/controller/admin/v1/cms/Article.php
Normal file
136
app/controller/admin/v1/cms/Article.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\admin\v1\cms;
|
||||
|
||||
use app\controller\admin\AuthController;
|
||||
use app\services\article\ArticleServices;
|
||||
use think\annotation\Inject;
|
||||
|
||||
/**
|
||||
* 文章管理
|
||||
* Class Article
|
||||
* @package app\controller\admin\v1\cms
|
||||
*/
|
||||
class Article extends AuthController
|
||||
{
|
||||
/**
|
||||
* @var ArticleServices
|
||||
*/
|
||||
#[Inject]
|
||||
protected ArticleServices $service;
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['title', ''],
|
||||
['pid', 0, '', 'cid'],
|
||||
]);
|
||||
$data = $this->service->getList($where);
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存文章数据
|
||||
* @return mixed
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$data = $this->request->postMore([
|
||||
['id', 0],
|
||||
['cid', ''],
|
||||
['title', ''],
|
||||
['author', ''],
|
||||
['image_input', ''],
|
||||
['synopsis', 0],
|
||||
['share_title', ''],
|
||||
['share_synopsis', ''],
|
||||
['sort', 0],
|
||||
['url', ''],
|
||||
['is_banner', 0],
|
||||
['is_hot', 0],
|
||||
['status', 1]
|
||||
]);
|
||||
$data['content'] = $this->request->param('content', '');
|
||||
$this->service->save($data);
|
||||
return $this->success('添加成功!');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个文章数据
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function read($id)
|
||||
{
|
||||
if ($id) {
|
||||
$info = $this->service->read($id);
|
||||
return $this->success($info);
|
||||
} else {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文章
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if ($id) {
|
||||
$this->service->del($id);
|
||||
return $this->success('删除成功!');
|
||||
} else {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章关联商品
|
||||
* @param int $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function relation($id)
|
||||
{
|
||||
if (!$id) return $this->fail('缺少参数');
|
||||
[$product_id] = $this->request->postMore([
|
||||
['product_id', 0]
|
||||
], true);
|
||||
$res = $this->service->bindProduct($id, $product_id);
|
||||
if ($res) {
|
||||
return $this->success('关联成功');
|
||||
} else {
|
||||
return $this->fail('关联失败');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消商品关联
|
||||
* @param int $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function unrelation($id)
|
||||
{
|
||||
if (!$id) return $this->fail('缺少参数');
|
||||
$res = $this->service->bindProduct($id);
|
||||
if ($res) {
|
||||
return $this->success('取消关联成功!');
|
||||
} else {
|
||||
return $this->fail('取消失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
156
app/controller/admin/v1/cms/ArticleCategory.php
Normal file
156
app/controller/admin/v1/cms/ArticleCategory.php
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\controller\admin\v1\cms;
|
||||
|
||||
use app\controller\admin\AuthController;
|
||||
use app\services\article\ArticleCategoryServices;
|
||||
use crmeb\services\CacheService;
|
||||
use think\annotation\Inject;
|
||||
|
||||
/**
|
||||
* 文章分类管理
|
||||
* Class ArticleCategory
|
||||
* @package app\controller\admin\v1\cms
|
||||
*/
|
||||
class ArticleCategory extends AuthController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ArticleCategoryServices
|
||||
*/
|
||||
#[Inject]
|
||||
protected ArticleCategoryServices $service;
|
||||
|
||||
/**
|
||||
* 获取分类列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['status', ''],
|
||||
['title', ''],
|
||||
['type', 0]
|
||||
]);
|
||||
if ($where['status'] == 'all') $where['status'] = '';
|
||||
$type = $where['type'];
|
||||
unset($where['type']);
|
||||
if ($type == 1) {//后台选择分类使用
|
||||
//过滤下架的
|
||||
$where['status'] = 1;
|
||||
$data = $this->service->getList($where);
|
||||
$data = $data['list'];
|
||||
} else {
|
||||
$data = $this->service->getList($where);
|
||||
}
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建新增表单
|
||||
* @return mixed
|
||||
* @throws \FormBuilder\Exception\FormBuilderException
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return $this->success($this->service->createForm(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新建分类
|
||||
* @return mixed
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$data = $this->request->postMore([
|
||||
['title', ''],
|
||||
['intr', ''],
|
||||
['image', ''],
|
||||
['sort', 0],
|
||||
['status', 0]
|
||||
]);
|
||||
if (!$data['title']) {
|
||||
return $this->fail('请填写分类名称');
|
||||
}
|
||||
$data['add_time'] = time();
|
||||
$this->service->save($data);
|
||||
CacheService::delete('ARTICLE_CATEGORY');
|
||||
return $this->success('添加分类成功!');
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建修改表单
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws \FormBuilder\Exception\FormBuilderException
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return $this->success($this->service->createForm($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存修改分类
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
$data = $this->request->postMore([
|
||||
['id', 0],
|
||||
['title', ''],
|
||||
['intr', ''],
|
||||
['image', ''],
|
||||
['sort', 0],
|
||||
['status', 0]
|
||||
]);
|
||||
$this->service->update($data);
|
||||
CacheService::delete('ARTICLE_CATEGORY');
|
||||
return $this->success('修改成功!');
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文章分类
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
$this->service->del($id);
|
||||
CacheService::delete('ARTICLE_CATEGORY');
|
||||
return $this->success('删除成功!');
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文章分类状态
|
||||
* @param int $id
|
||||
* @param int $status
|
||||
* @return mixed
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
*/
|
||||
public function set_status($id, $status)
|
||||
{
|
||||
if ($status == '' || $id == 0) return $this->fail('参数错误');
|
||||
$this->service->setStatus($id, $status);
|
||||
CacheService::delete('ARTICLE_CATEGORY');
|
||||
return $this->success($status == 0 ? '隐藏成功' : '显示成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章分类
|
||||
* @return mixed
|
||||
*/
|
||||
public function categoryList()
|
||||
{
|
||||
return $this->success($this->service->getArticleCategory());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user