vali 6 years ago
parent
commit
ba17ccb465
2 changed files with 16 additions and 5 deletions
  1. 6 2
      app/Logic/UnSettmatchLogic.php
  2. 10 3
      datainf/logic/HttpServerOnlySet.php

+ 6 - 2
app/Logic/UnSettmatchLogic.php

@@ -27,7 +27,7 @@ class UnSettmatchLogic
 {
     use Instance;
     protected $redis = '';
-    private $fanshui = 0.1;       //默认返水比例
+    private $fanshui = 0.01;       //默认返水比例
 
     protected $game_code = '';
     protected $match_id = 0;
@@ -213,6 +213,7 @@ class UnSettmatchLogic
         //用户资金变化记录,以后好一次性更新用户余额
         $time = date("Y-m-d H:i:s");
         $userMoneyChange = [];   //用户资金变化记录,好一次性更新
+        $userMoneyChange_less = [];   //用户余额情况
 
         $orders_array = [];
         foreach ($simples as $item) {
@@ -235,14 +236,17 @@ class UnSettmatchLogic
                 $mModel->money_type = 1;
                 $mModel->money = $return_money;
                 $userMoneyChange[$accountIdent] = isset($userMoneyChange[$accountIdent]) ? ($userMoneyChange[$accountIdent] + $return_money) : $return_money;
+                $userMoneyChange_less[$accountIdent] = !isset($userMoneyChange_less[$accountIdent]) ? $useraccs[$item->account_identity]->cash + $userMoneyChange[$accountIdent] : $userMoneyChange_less[$accountIdent] + $userMoneyChange[$accountIdent];
             } else {
                 $return_money = $gain_money - $item->money * (1 - $this->fanshui);
                 $mModel->money_type = 2;
                 $mModel->money = $return_money;
                 $userMoneyChange[$accountIdent] = isset($userMoneyChange[$accountIdent]) ? ($userMoneyChange[$accountIdent] - $return_money) : -1 * $return_money;
+                $userMoneyChange_less[$accountIdent] = !isset($userMoneyChange_less[$accountIdent]) ? $useraccs[$item->account_identity]->cash + $userMoneyChange[$accountIdent] : $userMoneyChange_less[$accountIdent] - $return_money;
             }
-
+            $mModel->money_cash = floatval($userMoneyChange_less[$accountIdent]);
             $mModel->save();
+
             $item->status = 3;
             $item->settlement_time = date('Y-m-d H:i:s');
             $item->use_mark = '注单所属赛事作废!';

+ 10 - 3
datainf/logic/HttpServerOnlySet.php

@@ -506,11 +506,18 @@ class HttpServerOnlySet
         $trade_desc = $type == 1 ? '单式投注订单回款' : '串式投注订单回款';
         $reason = $type == 1 ? '单式投注订单回款' : '串式投注订单回款';
 
+        //用于记录用户余额的数据
+        if (!isset($this->PDatas['account_mash'][$buy_identity])) {
+            $this->PDatas['account_mash'][$buy_identity] = $this->PDatas['account_indentity_map_array'][$buy_identity]->cash;
+        }
+        $this->PDatas['account_mash'][$buy_identity] = $this->PDatas['account_mash'][$buy_identity] + $returnMoney;
+        $user_money_cash = $this->PDatas['account_mash'][$buy_identity];
+
         if (isset($this->PDatas['money_detail_array'][$order_id])) {
-            $sql = "update  money_details  set money=$returnMoney  where account_identity='$account_identity' and trade_id='$order_id' and trade_type=4 ";
+            $sql = "update  money_details  set money=$returnMoney,money_cash=$user_money_cash  where account_identity='$account_identity' and trade_id='$order_id' and trade_type=4 ";
         } else {
             $sql = "insert into money_details(info_identity,trade_id,account_name,account_identity,money,money_time,money_type,money_cash,trade_type,trade_desc,reason,sysetem_user,status)  values(";
-            $sql .= "'$info_identity','$order_id','$account','$account_identity',$returnMoney,'$money_time',1,0,4,'$trade_desc','$reason','系统',1)";
+            $sql .= "'$info_identity','$order_id','$account','$account_identity',$returnMoney,'$money_time',1,$user_money_cash,4,'$trade_desc','$reason','系统',1)";
         }
 
         $this->PushSqlToArray($sql);
@@ -625,7 +632,7 @@ class HttpServerOnlySet
             }
         }
 
-        $ret = DB::table('money_details')->whereIn('account_identity', $userindentys)->where([['money_time', '>=', date("Y-m-d", time() - 86400 * 60) . ' 00:00:00'], ['trade_type', '=', 4]])->whereIn('trade_id', $order_ids)->get();
+        $ret = DB::table('money_details')->whereIn('account_identity', $userindentys)->where([['money_time', '>=', date("Y-m-d", time() - 86400 * 90) . ' 00:00:00'], ['trade_type', '=', 4]])->whereIn('trade_id', $order_ids)->get();
         if ($ret) {
             foreach ($ret as $val) {
                 $this->PDatas['money_detail_array'][$val->trade_id] = $val;