123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?php
- // +----------------------------------------------------------------------
- // | Niucloud-admin 企业快速开发的saas管理平台
- // +----------------------------------------------------------------------
- // | 官方网址:https://www.niucloud.com
- // +----------------------------------------------------------------------
- // | niucloud团队 版权所有 开源版本可自由商用
- // +----------------------------------------------------------------------
- // | Author: Niucloud Team
- // +----------------------------------------------------------------------
- namespace app\adminapi\controller\shop\admin;
- use app\service\admin\shop\admin\ShopSiteGroupService;
- use core\base\BaseAdminController;
- use Exception;
- use think\Response;
- /**
- * 站点分组
- * Class ShopGroup
- * @package addon\mall\app\adminapi\controller\mall\shop
- */
- class ShopGroup extends BaseAdminController
- {
- /**
- * 站点列表
- * @return Response
- */
- public function lists()
- {
- $data = $this->request->params([
- ['keywords', ''],
- ]);
- return success((new ShopSiteGroupService())->getPage($data));
- }
- /**
- * 分组详情
- * @param int $group_id
- * @return Response
- */
- public function info(int $group_id)
- {
- return success((new ShopSiteGroupService())->getInfo($group_id));
- }
- /**
- * 添加分组
- * @return Response
- * @throws Exception
- */
- public function add()
- {
- $data = $this->request->params([
- ['group_name', ''],
- ['group_desc', ''],
- ['addon', []],
- ]);
- $this->validate($data, 'app\validate\shop\ShopGroup.add');
- $group_id = (new ShopSiteGroupService())->add($data);
- return success('ADD_SUCCESS', ['group_id' => $group_id]);
- }
- /**
- * 编辑分组
- * @param $group_id
- * @return Response
- */
- public function edit($group_id)
- {
- $data = $this->request->params([
- ['group_name', ''],
- ['group_desc', ''],
- ['addon', []],
- ]);
- $data['group_id'] = $group_id;
- $this->validate($data, 'app\validate\shop\ShopGroup.edit');
- (new ShopSiteGroupService())->edit($group_id, $data);
- return success('EDIT_SUCCESS');
- }
- /**
- * 删除分组
- * @param $group_id
- * @return Response
- */
- public function del($group_id)
- {
- (new ShopSiteGroupService())->del($group_id);
- return success('DELETE_SUCCESS');
- }
- /**
- * 所有分组
- * @return Response
- */
- public function all()
- {
- $data = $this->request->params([
- ['app', ''],
- ]);
- return success((new ShopSiteGroupService())->getAll());
- }
- }
|