OrderController.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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\OrderService;
  13. /**
  14. * 积分订单管理-控制器
  15. * @author laravel开发员
  16. * @since 2020/11/11
  17. * Class OrderController
  18. * @package App\Http\Controllers
  19. */
  20. class OrderController extends Backend
  21. {
  22. /**
  23. * 构造函数
  24. * @author laravel开发员
  25. * @since 2020/11/11
  26. * OrderController constructor.
  27. */
  28. public function __construct()
  29. {
  30. parent::__construct();
  31. $this->service = new OrderService();
  32. }
  33. public function index()
  34. {
  35. $params = request()->all();
  36. $pageSize = isset($params['pageSize'])? $params['pageSize'] : 10;
  37. $list = OrderService::make()->getDataList($params, $pageSize);
  38. $message = array(
  39. "msg" => '操作成功',
  40. "code" => 0,
  41. "data" => isset($list['list'])? $list['list']:[],
  42. "count" => isset($list['total'])? $list['total']:0,
  43. );
  44. return $message;
  45. }
  46. /**
  47. * 取消订单
  48. * @return array
  49. */
  50. public function cancel()
  51. {
  52. if(OrderService::make()->cancel()){
  53. return message(OrderService::make()->getError(), true);
  54. }else{
  55. return message(OrderService::make()->getError(), false);
  56. }
  57. }
  58. /**
  59. * 异常订单
  60. * @return array
  61. */
  62. public function exception()
  63. {
  64. if(OrderService::make()->exception()){
  65. return message(OrderService::make()->getError(), true);
  66. }else{
  67. return message(OrderService::make()->getError(), false);
  68. }
  69. }
  70. /**
  71. * 完成订单
  72. * @return array
  73. */
  74. public function complete()
  75. {
  76. if(OrderService::make()->complete()){
  77. return message(OrderService::make()->getError(), true);
  78. }else{
  79. return message(OrderService::make()->getError(), false);
  80. }
  81. }
  82. /**
  83. * 统计
  84. * @return array
  85. */
  86. public function count()
  87. {
  88. $result = OrderService::make()->countByWait();
  89. return message(1010, true, $result);
  90. }
  91. }