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

72 lines
1.8 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Admin\Extensions;
  3. use App\Admin\Common\Rpc;
  4. use App\Admin\Forms\RefundNote;
  5. use App\Models\ImsCjdcOrderMain;
  6. use Dcat\Admin\Grid\Displayers\Modal;
  7. use Dcat\Admin\Grid\RowAction;
  8. use Dcat\Admin\Layout\Content;
  9. use Illuminate\Http\Request;
  10. use Illuminate\Support\Facades\Log;
  11. class OrderStateHandle extends RowAction
  12. {
  13. protected $model;
  14. protected $state;
  15. protected $title;
  16. protected $content;
  17. public function __construct($title=null,$state=null)
  18. {
  19. parent::__construct($title);
  20. $this->state = $state;
  21. }
  22. /**
  23. * 处理请求
  24. *
  25. * @param Request $request
  26. *
  27. * @return \Dcat\Admin\Actions\Response
  28. */
  29. public function handle(Request $request)
  30. {
  31. // 获取当前行ID
  32. $id = $this->getKey();
  33. $orderMain = new ImsCjdcOrderMain();
  34. $state = $request->get('state');
  35. if ($state==4){
  36. $order = $orderMain::where('id',$id)->first();
  37. //记录分账流水
  38. $result = json_decode(Rpc::separateAccounts($id,$order->user_id));
  39. if ($result->result){
  40. return $this->response()->success('操作成功')->refresh();
  41. }else{
  42. Log::error('订单完成时分账接口调用失败',$result);
  43. return $this->response()->error('操作失败')->refresh();
  44. }
  45. }elseif ($state==9){//同意退款
  46. }
  47. $res = $orderMain->modifyState($id,$state);
  48. if ($res==true){
  49. return $this->response()->success('操作成功')->refresh();
  50. }else{
  51. return $this->response()->error('操作失败');
  52. }
  53. }
  54. /**
  55. * 设置要POST到接口的数据
  56. *
  57. * @return array
  58. */
  59. public function parameters()
  60. {
  61. return [
  62. 'state' => $this->state,
  63. ];
  64. }
  65. }