...
|
...
|
@@ -228,9 +228,12 @@ class Order extends Api |
|
|
|
|
|
/**
|
|
|
* 我的订单-申请退款
|
|
|
* @ApiMethod (GET)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="order_id", type="integer", required=true, description="订单ID")
|
|
|
* @ApiParams (name="refund_reason", type="string", required=true, description="退款原因")
|
|
|
* @ApiParams (name="refund_reason_explain", type="string", required=true, description="退款说明")
|
|
|
* @ApiParams (name="refund_reason_images", type="string", required=true, description="退款凭证,多个图片用英文逗号分隔")
|
|
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
|
|
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
|
|
|
* @ApiReturnParams (name="data", type="object", description="扩展数据返回")
|
...
|
...
|
@@ -239,14 +242,18 @@ class Order extends Api |
|
|
'msg':'返回成功'
|
|
|
})
|
|
|
*/
|
|
|
public function refund($order_id)
|
|
|
public function refund()
|
|
|
{
|
|
|
if(!$order = $this->model->getUserOrderDetail($order_id, $this->user['id'])){
|
|
|
$post = $this->request->post();
|
|
|
if(!$order = $this->model->getUserOrderDetail($post['order_id'], $this->user['id'])){
|
|
|
$this->error($this->model->getError());
|
|
|
}
|
|
|
if ($order['refund_status'] == 2) return self::setErrorInfo('订单已退款!');
|
|
|
if ($order['refund_status'] == 1) return self::setErrorInfo('正在申请退款中!');
|
|
|
if ($order['status'] == 1) return self::setErrorInfo('订单当前无法退款!');
|
|
|
}
|
|
|
empty($post['refund_reason']) && $this->error(__('请选择退款原因!'));
|
|
|
$order['refund_status'] == '2' && $this->error(__('订单已退款!'));
|
|
|
$order['refund_status'] == '1' && $this->error(__('正在申请退款中!'));
|
|
|
$order['delivery_status'] == '1' && $this->error(__('订单当前无法退款!'));
|
|
|
$this->model->allowField(true)->save($post);
|
|
|
$this->success(__('申请退款成功'));
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -268,5 +275,6 @@ class Order extends Api |
|
|
if(!$order = $this->model->getUserOrderDetail($post['order_id'], $this->user['id'])){
|
|
|
$this->error($this->model->getError());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
} |
...
|
...
|
|