NewCustomerController.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\admin\controller\goods;
  3. use app\admin\service\goods\GoodsService;
  4. use app\admin\service\goods\NewCustomerService;
  5. use app\admin\validate\goods\GoodsValidate;
  6. use app\model\Coupon;
  7. use app\model\Goods;
  8. use app\model\GoodsDetail;
  9. use app\model\GoodsLabel;
  10. use app\model\GoodsRunning;
  11. use app\model\GoodsSku;
  12. use app\model\SysCategory;
  13. use support\Db;
  14. use support\exception\BusinessException;
  15. use support\Redis;
  16. use support\Request;
  17. use support\Response;
  18. class NewCustomerController
  19. {
  20. /**
  21. * @Desc 商品详情
  22. * @Author Gorden
  23. * @Date 2024/3/28 10:25
  24. *
  25. * @param Request $request
  26. * @return Response
  27. */
  28. public function info(Request $request)
  29. {
  30. $validate = new GoodsValidate();
  31. if (!$validate->scene('info')->check($request->get())) {
  32. return json_fail($validate->getError());
  33. }
  34. return NewCustomerService::info($request->get('goods_id'));
  35. }
  36. /**
  37. * @Desc 修改商品
  38. * @Author Gorden
  39. * @Date 2024/3/28 13:22
  40. *
  41. * @param Request $request
  42. * @return Response
  43. */
  44. public function update(Request $request): Response
  45. {
  46. $validate = new GoodsValidate();
  47. if (!$validate->scene('update')->check($request->post())) {
  48. return json_fail($validate->getError());
  49. }
  50. return NewCustomerService::update($request->post());
  51. }
  52. }