|
|
|
@ -3,6 +3,7 @@ namespace App\Admin\Extensions; |
|
|
|
|
|
|
|
use App\Admin\Common\Rpc; |
|
|
|
use App\Admin\Forms\RefundNote; |
|
|
|
use App\Models\ImsCjdcOrder; |
|
|
|
use App\Models\ImsCjdcOrderMain; |
|
|
|
use Dcat\Admin\Grid\Displayers\Modal; |
|
|
|
use Dcat\Admin\Grid\RowAction; |
|
|
|
@ -35,9 +36,9 @@ class OrderStateHandle extends RowAction |
|
|
|
// 获取当前行ID
|
|
|
|
$id = $this->getKey(); |
|
|
|
$orderMain = new ImsCjdcOrderMain(); |
|
|
|
$order = $orderMain::where('id',$id)->first(); |
|
|
|
$state = $request->get('state'); |
|
|
|
if ($state==4){ |
|
|
|
$order = $orderMain::where('id',$id)->first(); |
|
|
|
//记录分账流水
|
|
|
|
$result = json_decode(Rpc::separateAccounts($order->global_order_id,$order->user_id),true)['result']; |
|
|
|
if ($result['code']!=0){ |
|
|
|
@ -46,24 +47,26 @@ class OrderStateHandle extends RowAction |
|
|
|
} |
|
|
|
return $this->response()->success('操作成功')->refresh(); |
|
|
|
}elseif ($state==9){//同意退款
|
|
|
|
$order = $orderMain::where('id',$id)->first(); |
|
|
|
$result = json_decode(Rpc::orderRefund($order->global_order_id,$order->user_id),true)['result']; |
|
|
|
if (isset($result['code'])&&$result['code']!=0){ |
|
|
|
Log::error('订单退款接口调用失败',$result); |
|
|
|
return $this->response()->error($result['message'])->refresh(); |
|
|
|
}else{ |
|
|
|
//$orderMain->modifyState($id,$state);
|
|
|
|
} |
|
|
|
//$orderMain->modifyState($id,$state);
|
|
|
|
return $this->response()->success($result['message'])->refresh(); |
|
|
|
} |
|
|
|
}elseif ($state==3){//接单
|
|
|
|
$res = $orderMain->modifyState($id,$state); |
|
|
|
if ($res==true){ |
|
|
|
$storeIds = ImsCjdcOrder::where('order_main_id',$order->global_order_id)->pluck('store_id')->toArray(); |
|
|
|
Rpc::doByOrder($order->user_id,$storeIds,$order->global_order_id,$state); |
|
|
|
return $this->response()->success('操作成功')->refresh(); |
|
|
|
}else{ |
|
|
|
return $this->response()->error('操作失败'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设置要POST到接口的数据 |
|
|
|
* |
|
|
|
|