xialei 1 год назад
Родитель
Сommit
19ccfe795c
2 измененных файлов с 21 добавлено и 0 удалено
  1. 1 0
      app/controller/api/Notify.php
  2. 20 0
      app/controller/api/store/service/Huafei.php

+ 1 - 0
app/controller/api/Notify.php

@@ -54,6 +54,7 @@ class Notify
54
                                     'rand'=>$requestId[1],
54
                                     'rand'=>$requestId[1],
55
                                     'pay_type'=>$pay_type,
55
                                     'pay_type'=>$pay_type,
56
                                     'pay_wx'=>systemConfig('pay_wx'),
56
                                     'pay_wx'=>systemConfig('pay_wx'),
57
+                                    'app_id'=>$post['app_id'],
57
                                     'payment_id'=>$post_data_str['id'],
58
                                     'payment_id'=>$post_data_str['id'],
58
                                     'reverse_amt'=>$post_data_str['pay_amt'],
59
                                     'reverse_amt'=>$post_data_str['pay_amt'],
59
                                     'status'=>1
60
                                     'status'=>1

+ 20 - 0
app/controller/api/store/service/Huafei.php

@@ -6,6 +6,7 @@ use think\App;
6
 use think\facade\Db;
6
 use think\facade\Db;
7
 use crmeb\basic\BaseController;
7
 use crmeb\basic\BaseController;
8
 use app\common\repositories\user\UserThirdRepository;
8
 use app\common\repositories\user\UserThirdRepository;
9
+use app\common\repositories\store\order\StoreRefundOrderRepository;
9
 
10
 
10
 class Huafei extends BaseController
11
 class Huafei extends BaseController
11
 {
12
 {
@@ -74,6 +75,25 @@ class Huafei extends BaseController
74
 				}
75
 				}
75
 
76
 
76
 				if($param['status'] == 3) {
77
 				if($param['status'] == 3) {
78
+					$order_data = Db::name('order_huafei_hf')->where('order_no', $order_no)->find();
79
+					$pay_wx = systemConfig('pay_wx');
80
+					//推送失败 给新支付的这一笔退款
81
+					Db::name('log')->insert(['data' => '给新话费充值支付的这一笔退款']);
82
+					if ($pay_wx == 3){
83
+						$key='api_live_b0a687ec-5450-4ada-a0e4-65bac0f46871';
84
+					}else{
85
+						$key='api_live_90ef02e4-54ac-41ee-adf1-e4927d23d58f';
86
+					}
87
+					$refund_traits = [
88
+						'payment_id'  => $order_data['payment_id'],
89
+						'app_id'      => $order_data['app_id'],
90
+						'order_no'    => app()->make(StoreRefundOrderRepository::class)->getNewOrderId(),
91
+						'reverse_amt' => $order_data['reverse_amt'],
92
+						'notify_url'  => env('APP_URL') . "/api/hf_notify/reverse_order",
93
+					];
94
+					$hf_refund_res = app()->make(StoreRefundOrderRepository::class)->payment_Reverse($refund_traits, $order_data['pay_type'] == '1' ? 2 : 1, $pay_wx, $key);
95
+					Db::name('log')->insert(['data'=>'话费充值汇付支付撤销返回结果:'.json_encode($hf_refund_res)]);
96
+
77
 					//把赠送出去的养老金 积分 贡献值 复购金 改为已失效
97
 					//把赠送出去的养老金 积分 贡献值 复购金 改为已失效
78
 					Db::name('user_bill')->where('order_sn', $huafeiInfo['order_no'])->update(['status'=> -1]);
98
 					Db::name('user_bill')->where('order_sn', $huafeiInfo['order_no'])->update(['status'=> -1]);
79
 					Db::name('user_sign_score')->where('order_id', $huafeiInfo['order_no'])->update(['status'=> 0]);
99
 					Db::name('user_sign_score')->where('order_id', $huafeiInfo['order_no'])->update(['status'=> 0]);