123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- // +----------------------------------------------------------------------
- // | Niucloud-admin 企业快速开发的多应用管理平台
- // +----------------------------------------------------------------------
- // | 官方网址:https://www.niucloud.com
- // +----------------------------------------------------------------------
- // | niucloud团队 版权所有 开源版本可自由商用
- // +----------------------------------------------------------------------
- // | Author: Niucloud Team
- // +----------------------------------------------------------------------
- namespace app\adminapi\controller\shop\site;
- use app\service\admin\shop\site\ShopMemberLabelService;
- use core\base\BaseAdminController;
- use think\db\exception\DataNotFoundException;
- use think\db\exception\DbException;
- use think\db\exception\ModelNotFoundException;
- use think\Response;
- /**
- * 店铺会员标签控制层
- */
- class ShopMemberLabel extends BaseAdminController
- {
- /**
- * 会员标签列表
- * @return Response
- */
- public function lists()
- {
- $data = $this->request->params([
- [ 'label_name', '' ],
- ]);
- return success(( new ShopMemberLabelService() )->getPage($data));
- }
- /**
- * 会员标签详情
- * @param int $id
- * @return Response
- */
- public function info(int $id)
- {
- return success(( new ShopMemberLabelService() )->getInfo($id));
- }
- /**
- * 添加会员标签
- * @return Response
- */
- public function add()
- {
- $data = $this->request->params([
- [ 'label_name', '' ],
- [ 'memo', '' ],
- [ 'sort', 0 ],
- ]);
- $this->validate($data, 'app\validate\member\MemberLabel.add');
- $id = ( new ShopMemberLabelService() )->add($data);
- return success('ADD_SUCCESS', [ 'label_id' => $id ]);
- }
- /**
- * 编辑会员标签
- */
- public function edit($id)
- {
- $data = $this->request->params([
- [ 'label_name', '' ],
- [ 'memo', '' ],
- [ 'sort', 0 ],
- ]);
- $this->validate($data, 'app\validate\member\MemberLabel.edit');
- ( new ShopMemberLabelService() )->edit($id, $data);
- return success('EDIT_SUCCESS');
- }
- /**
- * 会员标签删除
- * @param int $id
- * @return Response
- */
- public function del(int $id)
- {
- ( new ShopMemberLabelService() )->del($id);
- return success('DELETE_SUCCESS');
- }
- /**
- * 获取标签
- * @return Response
- * @throws DataNotFoundException
- * @throws DbException
- * @throws ModelNotFoundException
- */
- public function getAll()
- {
- return success(( new ShopMemberLabelService() )->getAll());
- }
- }
|