Event.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\store\controller\order;
  13. use app\store\controller\Controller;
  14. use app\store\model\Order as OrderModel;
  15. /**
  16. * 订单操作控制器
  17. * Class Operate
  18. * @package app\store\controller\order
  19. */
  20. class Event extends Controller
  21. {
  22. /**
  23. * 确认发货
  24. * @param int $orderId
  25. * @return array
  26. * @throws \Exception
  27. */
  28. public function delivery(int $orderId)
  29. {
  30. // 订单详情
  31. $model = OrderModel::detail($orderId);
  32. if ($model->delivery($this->postForm())) {
  33. return $this->renderSuccess('发货成功');
  34. }
  35. return $this->renderError($model->getError() ?: '发货失败');
  36. }
  37. /**
  38. * 修改订单价格
  39. * @param int $orderId
  40. * @return array
  41. */
  42. public function updatePrice(int $orderId)
  43. {
  44. // 订单详情
  45. $model = OrderModel::detail($orderId);
  46. if ($model->updatePrice($this->postForm())) {
  47. return $this->renderSuccess('操作成功');
  48. }
  49. return $this->renderError($model->getError() ?: '操作失败');
  50. }
  51. /**
  52. * 审核:用户取消订单
  53. * @param $orderId
  54. * @return array|bool
  55. */
  56. public function confirmCancel($orderId)
  57. {
  58. // 订单详情
  59. $model = OrderModel::detail($orderId);
  60. if ($model->confirmCancel($this->postForm())) {
  61. return $this->renderSuccess('操作成功');
  62. }
  63. return $this->renderError($model->getError() ?: '操作失败');
  64. }
  65. }