|
@@ -19,20 +19,20 @@ class RefundController extends Curd
|
|
|
{
|
|
|
$this->model = new OrderReturn();
|
|
|
$this->validate = true;
|
|
|
- $this->validateClass=new ReturnValidate();
|
|
|
+ $this->validateClass = new ReturnValidate();
|
|
|
}
|
|
|
|
|
|
public function select(Request $request): Response
|
|
|
{
|
|
|
[$where, $format, $limit, $field, $order] = $this->selectInput($request);
|
|
|
$order = $request->get('order', 'desc');
|
|
|
- $type = $request->get('type','');
|
|
|
+ $type = $request->get('type', '');
|
|
|
$field = $field ?? 'order_return_addtimes';
|
|
|
$where['order_return_category'] = '退款';
|
|
|
- if ($type == 'today'){
|
|
|
+ if ($type == 'today') {
|
|
|
$where['order_return_addtimes'] = [
|
|
|
- strtotime(date('Y-m-d').' 00:00:00'),
|
|
|
- strtotime(date('Y-m-d').' 23:59:59')
|
|
|
+ strtotime(date('Y-m-d') . ' 00:00:00'),
|
|
|
+ strtotime(date('Y-m-d') . ' 23:59:59')
|
|
|
];
|
|
|
}
|
|
|
$query = $this->doSelect($where, $field, $order);
|
|
@@ -45,8 +45,8 @@ class RefundController extends Curd
|
|
|
'member' => function ($query) {
|
|
|
$query->select('member_id', 'member_mobile');
|
|
|
},
|
|
|
- 'cert'=>function($query){
|
|
|
- $query->select('join_cert_member_id','member_cert_name');
|
|
|
+ 'cert' => function ($query) {
|
|
|
+ $query->select('join_cert_member_id', 'member_cert_name');
|
|
|
},
|
|
|
'order' => function ($query) {
|
|
|
$query->select('order_id', 'order_name');
|
|
@@ -89,13 +89,13 @@ class RefundController extends Curd
|
|
|
|
|
|
public function afterQuery($items)
|
|
|
{
|
|
|
- foreach ($items as &$item){
|
|
|
- if (!empty($item['order_return_apply_json']) && is_json($item['order_return_apply_json'])){
|
|
|
- $json = json_decode($item['order_return_apply_json'],true);
|
|
|
+ foreach ($items as &$item) {
|
|
|
+ if (!empty($item['order_return_apply_json']) && is_json($item['order_return_apply_json'])) {
|
|
|
+ $json = json_decode($item['order_return_apply_json'], true);
|
|
|
$item['order_return_apply_json'] = $json['apply'] ?? '';
|
|
|
}
|
|
|
- if (!empty($item['order_return_recharge_json']) && is_json($item['order_return_recharge_json'])){
|
|
|
- $json = json_decode($item['order_return_recharge_json'],true);
|
|
|
+ if (!empty($item['order_return_recharge_json']) && is_json($item['order_return_recharge_json'])) {
|
|
|
+ $json = json_decode($item['order_return_recharge_json'], true);
|
|
|
$item['order_return_recharge_json'] = $json['change'] ?? '';
|
|
|
}
|
|
|
|
|
@@ -113,14 +113,14 @@ class RefundController extends Curd
|
|
|
if (!$model) {
|
|
|
throw new BusinessException('记录不存在', 2);
|
|
|
}
|
|
|
- if (empty($model->order_return_accept_datetimes) && $model->order_return_status == 'PENDING' && $data['order_return_status'] == 'DOING'){
|
|
|
+ if (empty($model->order_return_accept_datetimes) && $model->order_return_status == 'PENDING' && $data['order_return_status'] == 'DOING') {
|
|
|
$data['order_return_accept_datetimes'] = date('Y-m-d H:i:s');
|
|
|
}
|
|
|
- if (!empty($data['order_return_apply_json'])){
|
|
|
- $data['order_return_apply_json'] = json_encode(['apply'=>$data['order_return_apply_json']]);
|
|
|
+ if (!empty($data['order_return_apply_json'])) {
|
|
|
+ $data['order_return_apply_json'] = json_encode(['apply' => $data['order_return_apply_json']]);
|
|
|
}
|
|
|
- if (!empty($data['order_return_recharge_json'])){
|
|
|
- $data['order_return_recharge_json'] = json_encode(['change'=>$data['order_return_recharge_json']]);
|
|
|
+ if (!empty($data['order_return_recharge_json'])) {
|
|
|
+ $data['order_return_recharge_json'] = json_encode(['change' => $data['order_return_recharge_json']]);
|
|
|
}
|
|
|
|
|
|
unset($data[$primary_key]);
|
|
@@ -175,13 +175,13 @@ class RefundController extends Curd
|
|
|
$item['goods']['components'] = $goodsArr;
|
|
|
}
|
|
|
|
|
|
- if (!empty($item['refund'])){
|
|
|
- if (!empty($item['refund']['order_return_apply_json']) && is_json($item['refund']['order_return_apply_json'])){
|
|
|
- $json = json_decode($item['refund']['order_return_apply_json'],true);
|
|
|
+ if (!empty($item['refund'])) {
|
|
|
+ if (!empty($item['refund']['order_return_apply_json']) && is_json($item['refund']['order_return_apply_json'])) {
|
|
|
+ $json = json_decode($item['refund']['order_return_apply_json'], true);
|
|
|
$item['refund']['order_return_apply_json'] = $json['reason'] ?? '';
|
|
|
}
|
|
|
- if (!empty($item['refund']['order_return_recharge_json']) && is_json($item['refund']['order_return_recharge_json'])){
|
|
|
- $json = json_decode($item['refund']['order_return_recharge_json'],true);
|
|
|
+ if (!empty($item['refund']['order_return_recharge_json']) && is_json($item['refund']['order_return_recharge_json'])) {
|
|
|
+ $json = json_decode($item['refund']['order_return_recharge_json'], true);
|
|
|
$item['refund']['order_return_recharge_json'] = $json['change'] ?? '';
|
|
|
}
|
|
|
}
|
|
@@ -197,4 +197,22 @@ class RefundController extends Curd
|
|
|
|
|
|
return json_success('', $data);
|
|
|
}
|
|
|
+
|
|
|
+ public function customRefund(Request $request)
|
|
|
+ {
|
|
|
+ $orderId = $request->post('order_id','');
|
|
|
+ $orderId = $request->post('order_id', '');
|
|
|
+ $amount = $request->post('refund_amount', 0);
|
|
|
+ $password = $request->post('refund_password', '');
|
|
|
+ if (!$orderId || !$amount || !$password) {
|
|
|
+ return json_fail('参数异常');
|
|
|
+ }
|
|
|
+ if ($password != '123456') {
|
|
|
+ return json_fail('支付密码错误');
|
|
|
+ }
|
|
|
+ $order = Order::where('order_id',$orderId)->where('order_status_payment','SUCCESS')->first();
|
|
|
+ if (!$order){
|
|
|
+ return json_fail("订单异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|