Browse Source

fix moneySet

vali 6 years ago
parent
commit
f78528059d
1 changed files with 17 additions and 5 deletions
  1. 17 5
      datainf/logic/HttpServerOnlySet.php

+ 17 - 5
datainf/logic/HttpServerOnlySet.php

@@ -251,7 +251,7 @@ class HttpServerOnlySet
             return true;
         }
         $ids_array = array_map(function ($i) {
-            return "'$i'";
+            return "$i";
         }, $ids);
         $ids_array = implode(",", $ids_array);
         unset($ids_array_0);
@@ -330,6 +330,7 @@ class HttpServerOnlySet
         $account = $task['account'];
         $money_prize = $task['money_prize'];
 
+
         foreach ($matchDatas as $val) {
             if (!in_array($val->result, [-1, 1, 2, 3, 4])) {
                 throw  new  \Exception('match比赛结果异常或还没有输赢结果->' . $val->id);
@@ -367,7 +368,7 @@ class HttpServerOnlySet
         $game_status = $returnMoney > $simplexData->money ? 1 : ($returnMoney == $simplexData->money ? 3 : 2);
         // 修改投注表状态及盈亏
         $this->PushSqlToArray(["update money_buy_simplex set settle_status=2, game_status=$game_status,gain_money=$returnMoney  where order_id='$order_id' "]);
-        $this->userMoneyTotal[$account_identity] = isset($this->account_identity[$account_identity]) ? $this->account_identity[$account_identity] + $simplexData->money : $simplexData->money;
+        $this->userMoneyTotal[$account_identity] = isset($this->userMoneyTotal[$account_identity]) ? $this->userMoneyTotal[$account_identity] + $returnMoney : $returnMoney;
         $this->WriteOrAddSettlement($game_code, $match_id, $bet_type, $order_id, $account_identity, $returnMoney);
         $this->insertData(
             $order_id,
@@ -390,7 +391,7 @@ class HttpServerOnlySet
             return;
         }
 
-        if ($this->set_type == 2 && isset($this->settlement_middle_detail_array[$bet_type][$order_id])) {
+        if (isset($this->settlement_middle_detail_array[$bet_type][$order_id])) {
             $this->PushSqlToArray("update  settlement_middle_detail  set  money=$money  where game_code='$game_code' and bet_type=$bet_type and order_id='$order_id' ");
         } else {
             $this->PushSqlToArray("insert into settlement_middle_detail(game_code,match_id,account_identity,bet_type,order_id,money) values('$game_code','$match_id','$account_ident',$bet_type,'$order_id',$money)");
@@ -495,8 +496,12 @@ class HttpServerOnlySet
         $trade_desc = $type == 1 ? '单式投注订单回款' : '串式投注订单回款';
         $reason = $type == 1 ? '单式投注订单回款' : '串式投注订单回款';
 
-        $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)";
+        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' ";
+        } 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)";
+        }
 
         $this->PushSqlToArray($sql);
 
@@ -609,6 +614,13 @@ class HttpServerOnlySet
             }
         }
 
+        $ret = DB::table('money_details')->whereIn('account_identity', $userindentys)->where([['money_time', '>=', date("Y-m-d", time() - 86400 * 60) . ' 00:00:00'], ['money_type', '=', 4]])->whereIn('trade_id', $order_ids)->get();
+        if ($ret) {
+            foreach ($ret as $val) {
+                $this->PDatas['money_detail_array'][$val->trade_id] = $val;
+            }
+        }
+
         return true;
     }