链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.1 KiB

6 years ago
  1. <?php
  2. namespace App\Admin\Extensions;
  3. use App\Models\ImsCjdcOrderMain;
  4. use Dcat\Admin\Grid\RowAction;
  5. use Illuminate\Http\Request;
  6. class OrderStateHandle extends RowAction
  7. {
  8. protected $model;
  9. protected $state;
  10. protected $title;
  11. public function __construct($title=null,$state=null)
  12. {
  13. parent::__construct($title);
  14. $this->state = $state;
  15. }
  16. /**
  17. * 处理请求
  18. *
  19. * @param Request $request
  20. *
  21. * @return \Dcat\Admin\Actions\Response
  22. */
  23. public function handle(Request $request)
  24. {
  25. // 获取当前行ID
  26. $id = $this->getKey();
  27. $orderMain = new ImsCjdcOrderMain();
  28. $state = $request->get('state');
  29. $res = $orderMain->modifyState($id,$state);
  30. if ($res==true){
  31. return $this->response()->success('操作成功')->refresh();
  32. }else{
  33. return $this->response()->error('操作失败');
  34. }
  35. }
  36. /**
  37. * 设置要POST到接口的数据
  38. *
  39. * @return array
  40. */
  41. public function parameters()
  42. {
  43. return [
  44. 'state' => $this->state,
  45. ];
  46. }
  47. }