OperationController.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: shenyang
  5. * Date: 2018/6/22
  6. * Time: 上午11:22
  7. */
  8. namespace app\backend\modules\remittanceAudit\controllers;
  9. use app\backend\modules\process\controllers\Operate;
  10. use app\common\components\BaseController;
  11. use app\common\exceptions\AppException;
  12. use app\common\modules\payType\remittance\models\process\RemittanceAuditProcess;
  13. class OperationController extends BaseController
  14. {
  15. use Operate;
  16. public $transactionActions = ['*'];
  17. protected $process;
  18. /**
  19. * @return mixed
  20. * @throws AppException
  21. */
  22. protected function getProcess()
  23. {
  24. if (!isset($this->process)) {
  25. $processId = request()->input('process_id');
  26. $this->process = RemittanceAuditProcess::detail()->find($processId);
  27. if (!isset($this->process)) {
  28. throw new AppException("未找到id为{$processId}的审核进程记录");
  29. }
  30. }
  31. return $this->process;
  32. }
  33. /**
  34. * @return \Illuminate\Http\JsonResponse
  35. * @throws \Exception
  36. */
  37. public function pass()
  38. {
  39. $this->toNextState();
  40. return $this->successJson('成功', ['remittanceAudit' => $this->getProcess()]);
  41. }
  42. /**
  43. * @return \Illuminate\Http\JsonResponse
  44. * @throws \Exception
  45. */
  46. public function reject()
  47. {
  48. $this->toClosedState();
  49. return $this->successJson('成功', ['remittanceAudit' => $this->getProcess()]);
  50. }
  51. }