链街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.

62 lines
1.3 KiB

5 years ago
5 years ago
5 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. if ($state==30){
  30. $res = $orderMain->updateShippingType($id,1);
  31. }elseif ($state==100){
  32. }else{
  33. $res = $orderMain->modifyState($id,$state);
  34. }
  35. if ($res==true){
  36. return $this->response()->success('操作成功')->refresh();
  37. }else{
  38. return $this->response()->error('操作失败');
  39. }
  40. }
  41. /**
  42. * 设置要POST到接口的数据
  43. *
  44. * @return array
  45. */
  46. public function parameters()
  47. {
  48. return [
  49. 'state' => $this->state,
  50. ];
  51. }
  52. }