getValue(['order_id' => $order_id, 'site_id' => $site_id], 'trade_no'); $CloudPay = new CloudPay(); $res = $CloudPay->Surrender($trade_no)['response']; if ($res['code'] == '10000' || $res['sub_code'] == '1310') { model('zima_order')->update(['order_status' => 'CANCEL', 'surrenderChannel' => 'API'], ['order_id' => $order_id, 'site_id' => $site_id]); model('order')->update(['order_status_name' => '已解约'], ['order_id' => $order_id, 'site_id' => $site_id]); $log_data = array( 'order_id' => $order_id, 'action' => 'refund', 'site_id' => $site_id, 'content' => '商家发起无责解约', 'is_auto' => 1,//todo 当前业务默认是系统任务完成订单 ); (new OrderLog())->addLog($log_data); return $this->success('解除成功'); } return $this->error(-1,$res['sub_msg']?:$res['msg']); } }