123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?php
- namespace app\admin\controller\goods;
- use app\admin\service\goods\GoodsService;
- use app\admin\validate\goods\GoodsValidate;
- use support\Request;
- use support\Response;
- class ServiceGoodsController
- {
- /**
- * @Desc 列表
- * @Author Gorden
- * @Date 2024/3/28 10:08
- *
- * @param Request $request
- * @return Response
- */
- public function select(Request $request)
- {
- return GoodsService::select($request, 'SERVICE');
- }
- public function selectList(Request $request)
- {
- return GoodsService::selectList($request, 'SERVICE');
- }
- public function selectPicking(Request $request)
- {
- return GoodsService::selectPicking($request);
- }
- /**
- * @Desc 商品详情
- * @Author Gorden
- * @Date 2024/3/28 10:25
- *
- * @param Request $request
- * @return Response
- */
- public function info(Request $request)
- {
- $validate = new GoodsValidate();
- if (!$validate->scene('info')->check($request->get())) {
- return json_fail($validate->getError());
- }
- return GoodsService::info($request->get('goods_id'));
- }
- /**
- * @Desc 添加商品
- * @Author Gorden
- * @Date 2024/3/11 10:21
- *
- * @param Request $request
- * @return Response
- */
- public function insert(Request $request): Response
- {
- $params = $request->post();
- $validate = new GoodsValidate();
- if (!$validate->scene('add')->check($params)) {
- return json_fail($validate->getError());
- }
- return GoodsService::insert($params);
- }
- /**
- * @Desc 修改商品
- * @Author Gorden
- * @Date 2024/3/28 13:22
- *
- * @param Request $request
- * @return Response
- */
- public function update(Request $request): Response
- {
- $validate = new GoodsValidate();
- if (!$validate->scene('update')->check($request->post())) {
- return json_fail($validate->getError());
- }
- return GoodsService::update($request->post());
- }
- public function changeStatus(Request $request): Response
- {
- $validate = new GoodsValidate();
- if (!$validate->scene('changeStatus')->check($request->post())) {
- return json_fail($validate->getError());
- }
- return GoodsService::changeStatus($request->post());
- }
- /**
- * @Desc 删除商品
- * @Author Gorden
- * @Date 2024/3/28 13:22
- *
- * @param Request $request
- * @return Response
- */
- public function delete(Request $request)
- {
- $ids = $request->post('goods_id');
- return GoodsService::delete($ids);
- }
- }
|