CRMEB/backend/app/adminapi/controller/product/StoreProductLabelController.php
2026-09-23 15:15:02 +08:00

121 lines
3.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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\adminapi\controller\product;
use app\adminapi\controller\AuthController;
use app\services\product\product\StoreProductLabelCateServices;
use app\services\product\product\StoreProductLabelServices;
use think\facade\App;
class StoreProductLabelController extends AuthController
{
protected $labelCateServices;
protected $labelServices;
public function __construct(App $app, StoreProductLabelCateServices $labelCateServices, StoreProductLabelServices $labelServices)
{
parent::__construct($app);
$this->labelCateServices = $labelCateServices;
$this->labelServices = $labelServices;
}
public function labelCateList()
{
$where = $this->request->getMore([
['name', ''],
]);
$where['is_del'] = 0;
return app('json')->success($this->labelCateServices->getLabelCateList($where));
}
public function labelCateForm($id)
{
return app('json')->success($this->labelCateServices->labelCateForm($id));
}
public function labelCateSave($id)
{
$data = $this->request->postMore([
['name', ''],
['sort', 0],
]);
$this->labelCateServices->labelCateSave($id, $data);
return app('json')->success('保存成功');
}
public function labelCateDel($id)
{
$this->labelCateServices->labelCateDel($id);
return app('json')->success('删除成功');
}
public function labelList()
{
$where = $this->request->getMore([
['name', ''],
['cate_id', ''],
['status', ''],
['is_show', ''],
]);
$where['is_del'] = 0;
return app('json')->success($this->labelServices->LabelList($where));
}
public function labelInfo($id)
{
return app('json')->success($this->labelServices->labelInfo($id));
}
public function labelSave()
{
$data = $this->request->postMore([
['id', 0],
['name', ''],
['cate_id', 0],
['type', 0],
['font_color', ''],
['bg_color', ''],
['border_color', ''],
['image', ''],
['sort', 0],
['status', 1],
['is_show', 1],
]);
$this->labelServices->labelSave($data);
return app('json')->success('保存成功');
}
public function labelDel($id)
{
$this->labelServices->labelDel($id);
return app('json')->success('删除成功');
}
public function labelIsShow($id, $is_show)
{
$this->labelServices->labelIsShow($id, $is_show);
return app('json')->success('修改成功');
}
public function labelStatus($id, $status)
{
$this->labelServices->labelStatus($id, $status);
return app('json')->success('修改成功');
}
public function labelUseList()
{
return app('json')->success($this->labelServices->labelUseList());
}
}