lizhen_gitee 2 mesi fa
parent
commit
0424d10f33

+ 4 - 2
application/api/controller/Notify.php

@@ -84,8 +84,10 @@ class Notify extends Api
         $user_id = $orderInfo['user_id'];
 
         //逻辑开始
-        //$args = json_decode($orderInfo['args'],true);
-        $result = model('Wallet')->lockChangeAccountRemain($user_id,'money',$orderInfo['order_amount'],$log_type, $remark,'pay_order',$orderInfo['id']);
+        $args = json_decode($orderInfo['args'],true);
+        $giftmoney = isset($args['giftmoney']) ? $args['giftmoney'] : 0;
+        $rechargemoney = bcadd($orderInfo['order_amount'],$giftmoney,2);
+        $result = model('Wallet')->lockChangeAccountRemain($user_id,'money',$rechargemoney,$log_type, $remark,'pay_order',$orderInfo['id']);
         if($result['status']===false)
         {
             Db::rollback();

+ 3 - 1
application/api/controller/Pay.php

@@ -42,12 +42,14 @@ class Pay extends Api
         if($rc_id){
             $recharge_config = Db::name('recharge_config')->where('id',$rc_id)->find();
             $money = $recharge_config['money'];
+            $giftmoney = $recharge_config['giftmoney'];
         }
 
         //自由输入覆盖
         if(!empty($freemoney)){
             $rc_id = 0;
             $money = floatval($freemoney);
+            $giftmoney = 0;
         }
 
         //
@@ -72,7 +74,7 @@ class Pay extends Api
         $data['order_status'] = 0;
         $data['table_name'] = 'money_recharge';
         $data['table_id'] = 0;
-        $data['args'] = '';
+        $data['args'] = json_encode(['giftmoney' => $giftmoney]);
 
         $orderid = Db::name('pay_order')->insertGetId($data);