GoodsController.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Http\Controllers\Admin;
  12. use App\Services\Common\GoodsService;
  13. /**
  14. * 商品管理-控制器
  15. * @author laravel开发员
  16. * @since 2020/11/11
  17. * Class GoodsController
  18. * @package App\Http\Controllers
  19. */
  20. class GoodsController extends Backend
  21. {
  22. /**
  23. * 构造函数
  24. * @author laravel开发员
  25. * @since 2020/11/11
  26. * GoodsController constructor.
  27. */
  28. public function __construct()
  29. {
  30. parent::__construct();
  31. $this->service = new GoodsService();
  32. }
  33. /**
  34. * 列表
  35. * @return array
  36. */
  37. public function index()
  38. {
  39. $pageSize = request()->get('limit', 15);
  40. $list = $this->service->getDataList(request()->all(), $pageSize);
  41. $message = array(
  42. "msg" => '操作成功',
  43. "code" => 0,
  44. "data" => isset($list['list'])? $list['list']:[],
  45. "count" => isset($list['total'])? $list['total']:0,
  46. );
  47. return $message;
  48. }
  49. /**
  50. * 删除数据
  51. * @return mixed
  52. * @since 2020/11/11
  53. * @author laravel开发员
  54. */
  55. public function delete()
  56. {
  57. $result = $this->service->delete();
  58. return $result;
  59. }
  60. }