|
|
@@ -326,18 +326,19 @@ 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];
|
|
|
+ $userMoneyChange_less[$accountIdent] = !isset($userMoneyChange_less[$accountIdent]) ? $userInents[$item->account_identity]->detail->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;
|
|
|
+ $userMoneyChange_less[$accountIdent] = !isset($userMoneyChange_less[$accountIdent]) ? $userInents[$item->account_identity]->detail->cash + $userMoneyChange[$accountIdent] : $userMoneyChange_less[$accountIdent] - $return_money;
|
|
|
}
|
|
|
$mModel->money_cash = floatval($userMoneyChange_less[$accountIdent]);
|
|
|
$mModel->save();
|
|
|
|
|
|
$item->status = 2;
|
|
|
+ $item->gain_money = 0;
|
|
|
$item->game_status = 2;
|
|
|
$item->settlement_time = date('Y-m-d H:i:s');
|
|
|
$item->use_mark = '';
|
|
|
@@ -366,9 +367,17 @@ class UnSettmatchLogic
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ $userMoneyArr = [];
|
|
|
//这里只把结果改为平局,再提交到旧的重新结算订单接口处理
|
|
|
foreach ($strOrders as $item2) {
|
|
|
+ //如果存在中奖的,要先扣回赢的钱,再以平处理
|
|
|
+ if ($item2->gain_money > 0) {
|
|
|
+ $acc = $item2->account_indentity;
|
|
|
+ $nowmoney = $item2->gain_money;
|
|
|
+ $userMoneyArr[$acc] = isset($userMoneyArr[$acc]) ? $userMoneyArr[$acc] + $nowmoney : $nowmoney;
|
|
|
+ }
|
|
|
$item2->status = 2;
|
|
|
+ $item2->gain_money = 0;
|
|
|
$item2->game_status = 2;
|
|
|
$item2->settlement_time = date('Y-m-d H:i:s');
|
|
|
$item2->save();
|
|
|
@@ -381,6 +390,10 @@ class UnSettmatchLogic
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if ($userMoneyArr) {
|
|
|
+ $this->AccountMoneydec($userMoneyArr);
|
|
|
+ }
|
|
|
+
|
|
|
$dataArr = [
|
|
|
'game_code' => $this->game_code,
|
|
|
'match_id' => $this->match_id,
|
|
|
@@ -400,6 +413,23 @@ class UnSettmatchLogic
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //对于已结算的又撤单的要扣回钱
|
|
|
+ public function AccountMoneydec($account_identity_array)
|
|
|
+ {
|
|
|
+ foreach ($account_identity_array as $acc => $money) {
|
|
|
+ $accarr[] = $acc;
|
|
|
+ }
|
|
|
+ $objs = $this->etAccountIdents($accarr);
|
|
|
+ foreach ($account_identity_array as $acc2 => $money) {
|
|
|
+ $nowmoney = $objs[$acc2]->detail->available_cash - $money;
|
|
|
+ $objs[$acc2]->detail->available_cash = $nowmoney;
|
|
|
+ $objs[$acc2]->detail->cash = $nowmoney;
|
|
|
+ $objs[$acc2]->detail->save();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
//得到某个账户的信息,主要是余额情况
|
|
|
public function getAccountIdents($account_identity_array)
|
|
|
{
|