|
@@ -127,18 +127,49 @@ class UnSettmatchLogic
|
|
|
//关联用户
|
|
//关联用户
|
|
|
$userInents = $this->getAccountIdents($useraccs);
|
|
$userInents = $this->getAccountIdents($useraccs);
|
|
|
//用户资金变化记录,以后好一次性更新用户余额
|
|
//用户资金变化记录,以后好一次性更新用户余额
|
|
|
- $userInents_money = [];
|
|
|
|
|
|
|
+ $time = date("Y-m-d H:i:s");
|
|
|
|
|
+ $userMoneyChange = []; //用户资金变化记录,好一次性更新
|
|
|
|
|
+
|
|
|
foreach ($simples as $item) {
|
|
foreach ($simples as $item) {
|
|
|
$gain_money = $item->gain_money;
|
|
$gain_money = $item->gain_money;
|
|
|
|
|
+ $accountIdent = $item->account_identity;
|
|
|
|
|
+
|
|
|
|
|
+ $mModel = new MoneyDetailsModel();
|
|
|
|
|
+ $mModel->info_identity = UUID();
|
|
|
|
|
+ $mModel->trade_id = $item->order_id;
|
|
|
|
|
+ $mModel->account_name = $userInents['accountIdent']->account;
|
|
|
|
|
+ $mModel->account_identity = $accountIdent;
|
|
|
|
|
+ $mModel->moneytime = $time;
|
|
|
|
|
+ $mModel->money_type = 3;
|
|
|
|
|
+ $mModel->trade_desc = '赛事取消返款--matchid=' . $this->match_id;
|
|
|
|
|
+
|
|
|
if ($gain_money <= 0.01) {
|
|
if ($gain_money <= 0.01) {
|
|
|
$return_money = $item->money * (1 - $this->fanshui);
|
|
$return_money = $item->money * (1 - $this->fanshui);
|
|
|
|
|
+ $mModel->money_type = 1;
|
|
|
|
|
+ $mModel->money = $return_money;
|
|
|
|
|
+ $userMoneyChange[$accountIdent] = isset($userMoneyChange[$accountIdent]) ? ($userMoneyChange[$accountIdent] + $return_money) : $return_money;
|
|
|
} else {
|
|
} else {
|
|
|
$return_money = $gain_money - $item->money * (1 - $this->fanshui);
|
|
$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;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ $mModel->save();
|
|
|
|
|
+ $item->status = 3;
|
|
|
|
|
+ $item->save();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if ($userMoneyChange) {
|
|
|
|
|
+ foreach ($userMoneyChange as $uident => $money) {
|
|
|
|
|
+ if (abs($money) > 0) {
|
|
|
|
|
+ $userInents[$uident]->detail->available_cash = $userInents[$uident]->detail->available_cash + $money;
|
|
|
|
|
+ $userInents[$uident]->detail->cash = $userInents[$uident]->detail->cash + $money;
|
|
|
|
|
+ $userInents[$uident]->detail->save();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -146,12 +177,35 @@ class UnSettmatchLogic
|
|
|
//处理串式订单相关逻辑
|
|
//处理串式订单相关逻辑
|
|
|
public function doStr()
|
|
public function doStr()
|
|
|
{
|
|
{
|
|
|
- $simples = $this->getStrOrders($this->game_code, $this->match_id);
|
|
|
|
|
- if (empty($simples)) {
|
|
|
|
|
|
|
+ $strOrders = $this->getStrOrders($this->game_code, $this->match_id);
|
|
|
|
|
+ if (empty($strOrders)) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //这里只把结果改为平局,再提交到旧的重新结算订单接口处理
|
|
|
|
|
+ foreach ($strOrders as $item2) {
|
|
|
|
|
+ $mats = $item2->matchdatas;
|
|
|
|
|
+ foreach ($mats as $item3) {
|
|
|
|
|
+ $item3->result = 2;
|
|
|
|
|
+ $item3->matchresult = '赛事撤销!';
|
|
|
|
|
+ $item3->save();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ $dataArr = [
|
|
|
|
|
+ 'game_code' => $this->game_code,
|
|
|
|
|
+ 'match_id' => $this->match_id,
|
|
|
|
|
+ 'settype' => 2,
|
|
|
|
|
+ 'bettype' => 2,
|
|
|
|
|
+ 'change_status' => 0,
|
|
|
|
|
+ ];
|
|
|
|
|
+ $url = 'http://127.0.0.1:9094/Settelement';
|
|
|
|
|
+ foreach ($strOrders as $item) {
|
|
|
|
|
+
|
|
|
|
|
+ $dataArr['order_ids'] = $item->order_id;
|
|
|
|
|
+ post_curls($url, $dataArr);
|
|
|
|
|
+ }
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//得到某个账户的信息,主要是余额情况
|
|
//得到某个账户的信息,主要是余额情况
|