|
@@ -14,6 +14,7 @@ use Illuminate\Support\Facades\DB;
|
|
|
Use App\Lib\Settlement\SettlementOrder;
|
|
Use App\Lib\Settlement\SettlementOrder;
|
|
|
Use App\Lib\Settlement\SettlementWinFail;
|
|
Use App\Lib\Settlement\SettlementWinFail;
|
|
|
use App\Models;
|
|
use App\Models;
|
|
|
|
|
+use App\Models\MoneyBuySimplex as MoneyBuySimplexModel;
|
|
|
use Request;
|
|
use Request;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -111,7 +112,7 @@ class SoccerNoteListController extends Controller
|
|
|
$sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
|
|
$sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
|
|
|
$type = Request::has('type') ? Request::get('type') : 'zq';
|
|
$type = Request::has('type') ? Request::get('type') : 'zq';
|
|
|
$where = array();
|
|
$where = array();
|
|
|
- $where[] = array('money_buy_simplex.is_champion',1);
|
|
|
|
|
|
|
+ $where[] = array('money_buy_simplex.is_champion', 1);
|
|
|
if (!empty($account)) {
|
|
if (!empty($account)) {
|
|
|
if (empty($sureblur) || $sureblur == 'off') {
|
|
if (empty($sureblur) || $sureblur == 'off') {
|
|
|
$where[] = array('money_buy_simplex.account_name', 'like', '%' . $account . '%');
|
|
$where[] = array('money_buy_simplex.account_name', 'like', '%' . $account . '%');
|
|
@@ -249,7 +250,7 @@ class SoccerNoteListController extends Controller
|
|
|
$sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
|
|
$sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
|
|
|
$type = Request::has('type') ? Request::get('type') : 'zq';
|
|
$type = Request::has('type') ? Request::get('type') : 'zq';
|
|
|
$where = array();
|
|
$where = array();
|
|
|
- $where[] = array('money_buy_simplex.is_champion','<>',1);
|
|
|
|
|
|
|
+ $where[] = array('money_buy_simplex.is_champion', '<>', 1);
|
|
|
if (!empty($account)) {
|
|
if (!empty($account)) {
|
|
|
if (empty($sureblur) || $sureblur == 'off') {
|
|
if (empty($sureblur) || $sureblur == 'off') {
|
|
|
$where[] = array('money_buy_simplex.account_name', 'like', '%' . $account . '%');
|
|
$where[] = array('money_buy_simplex.account_name', 'like', '%' . $account . '%');
|
|
@@ -278,16 +279,16 @@ class SoccerNoteListController extends Controller
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//调整状态查询 1,2,3为订单状态 1投注 2作废 3撤单
|
|
//调整状态查询 1,2,3为订单状态 1投注 2作废 3撤单
|
|
|
- if($order_status == 1 || $order_status == 2 || $order_status == 3){
|
|
|
|
|
|
|
+ if ($order_status == 1 || $order_status == 2 || $order_status == 3) {
|
|
|
$where[] = array('money_buy_simplex.status', '=', $order_status);
|
|
$where[] = array('money_buy_simplex.status', '=', $order_status);
|
|
|
}
|
|
}
|
|
|
//4 5为结算状态 4未结算 5已结算
|
|
//4 5为结算状态 4未结算 5已结算
|
|
|
- if($order_status == 4){
|
|
|
|
|
- $status = 1;
|
|
|
|
|
|
|
+ if ($order_status == 4) {
|
|
|
|
|
+ $status = 1;
|
|
|
$where[] = array('money_buy_simplex.settle_status', '=', $status);
|
|
$where[] = array('money_buy_simplex.settle_status', '=', $status);
|
|
|
}
|
|
}
|
|
|
- if($order_status == 5){
|
|
|
|
|
- $status = 2;
|
|
|
|
|
|
|
+ if ($order_status == 5) {
|
|
|
|
|
+ $status = 2;
|
|
|
$where[] = array('money_buy_simplex.settle_status', '=', $status);
|
|
$where[] = array('money_buy_simplex.settle_status', '=', $status);
|
|
|
}
|
|
}
|
|
|
/*
|
|
/*
|
|
@@ -424,16 +425,16 @@ class SoccerNoteListController extends Controller
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//调整状态查询 1,2,3为订单状态 1投注 2作废 3撤单
|
|
//调整状态查询 1,2,3为订单状态 1投注 2作废 3撤单
|
|
|
- if($order_status == 1 || $order_status == 2 || $order_status == 3){
|
|
|
|
|
|
|
+ if ($order_status == 1 || $order_status == 2 || $order_status == 3) {
|
|
|
$where[] = array('money_buy_simplex.status', '=', $order_status);
|
|
$where[] = array('money_buy_simplex.status', '=', $order_status);
|
|
|
}
|
|
}
|
|
|
//4 5为结算状态 4未结算 5已结算
|
|
//4 5为结算状态 4未结算 5已结算
|
|
|
- if($order_status == 4){
|
|
|
|
|
- $status = 1;
|
|
|
|
|
|
|
+ if ($order_status == 4) {
|
|
|
|
|
+ $status = 1;
|
|
|
$where[] = array('money_buy_simplex.settle_status', '=', $status);
|
|
$where[] = array('money_buy_simplex.settle_status', '=', $status);
|
|
|
}
|
|
}
|
|
|
- if($order_status == 5){
|
|
|
|
|
- $status = 2;
|
|
|
|
|
|
|
+ if ($order_status == 5) {
|
|
|
|
|
+ $status = 2;
|
|
|
$where[] = array('money_buy_simplex.settle_status', '=', $status);
|
|
$where[] = array('money_buy_simplex.settle_status', '=', $status);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -581,7 +582,7 @@ class SoccerNoteListController extends Controller
|
|
|
$sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
|
|
$sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
|
|
|
$type = Request::has('type') ? Request::get('type') : 'zq';
|
|
$type = Request::has('type') ? Request::get('type') : 'zq';
|
|
|
$where = array();
|
|
$where = array();
|
|
|
- $where[] = array('money_buy_simplex.is_champion','<>',1);
|
|
|
|
|
|
|
+ $where[] = array('money_buy_simplex.is_champion', '<>', 1);
|
|
|
if (!empty($account)) {
|
|
if (!empty($account)) {
|
|
|
if (empty($sureblur) || $sureblur == 'off') {
|
|
if (empty($sureblur) || $sureblur == 'off') {
|
|
|
$where[] = array('money_buy_simplex.account_name', 'like', '%' . $account . '%');
|
|
$where[] = array('money_buy_simplex.account_name', 'like', '%' . $account . '%');
|
|
@@ -610,16 +611,16 @@ class SoccerNoteListController extends Controller
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//调整状态查询 1,2,3为订单状态 1投注 2作废 3撤单
|
|
//调整状态查询 1,2,3为订单状态 1投注 2作废 3撤单
|
|
|
- if($order_status == 1 || $order_status == 2 || $order_status == 3){
|
|
|
|
|
|
|
+ if ($order_status == 1 || $order_status == 2 || $order_status == 3) {
|
|
|
$where[] = array('money_buy_simplex.status', '=', $order_status);
|
|
$where[] = array('money_buy_simplex.status', '=', $order_status);
|
|
|
}
|
|
}
|
|
|
//4 5为结算状态 4未结算 5已结算
|
|
//4 5为结算状态 4未结算 5已结算
|
|
|
- if($order_status == 4){
|
|
|
|
|
- $status = 1;
|
|
|
|
|
|
|
+ if ($order_status == 4) {
|
|
|
|
|
+ $status = 1;
|
|
|
$where[] = array('money_buy_simplex.settle_status', '=', $status);
|
|
$where[] = array('money_buy_simplex.settle_status', '=', $status);
|
|
|
}
|
|
}
|
|
|
- if($order_status == 5){
|
|
|
|
|
- $status = 2;
|
|
|
|
|
|
|
+ if ($order_status == 5) {
|
|
|
|
|
+ $status = 2;
|
|
|
$where[] = array('money_buy_simplex.settle_status', '=', $status);
|
|
$where[] = array('money_buy_simplex.settle_status', '=', $status);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -940,7 +941,117 @@ class SoccerNoteListController extends Controller
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return responseToJson(1, '更新成功');
|
|
return responseToJson(1, '更新成功');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+//单式订单直接手动设置比赛结果 --> 提交胜负判断处理以及 --> 提交结算
|
|
|
|
|
+ public function manualmatchpdate_v2(Req $req)
|
|
|
|
|
+ {
|
|
|
|
|
+ $order_id = isset($req->order_id) ? $req->order_id : 0;
|
|
|
|
|
+ $game_code = isset($req->game_code) ? $req->game_code : 0;
|
|
|
|
|
+ $match_id = isset($req->match_id) ? $req->match_id : 0;
|
|
|
|
|
+ $pdatas = isset($req->matchdata) ? $req->matchdata : [];
|
|
|
|
|
+ $pdatas = json_decode($pdatas, true);
|
|
|
|
|
+ if (empty($order_id) || empty($game_code) || empty($match_id) || empty($pdatas)) {
|
|
|
|
|
+ return responseToJson(0, '参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $buyModel = (new MoneyBuySimplexModel())->where([['order_id', '=', $order_id]])->first();
|
|
|
|
|
+ if (empty($buyModel)) {
|
|
|
|
|
+ return responseToJson(0, '订单数据错误');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $restModel = '';
|
|
|
|
|
+ switch ($game_code) {
|
|
|
|
|
+ case 'zq':
|
|
|
|
|
+ $restModel = DB::table('st_zq_result')->where([['match_id', '=', $match_id]])->first();
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'lq':
|
|
|
|
|
+ $restModel = DB::table('st_lq_result')->where([['match_id', '=', $match_id]])->first();
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'wq':
|
|
|
|
|
+ $restModel = DB::table('st_wq_result')->where([['match_id', '=', $match_id]])->first();
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'bq':
|
|
|
|
|
+ $restModel = DB::table('st_bq_result')->where([['match_id', '=', $match_id]])->first();
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (empty($restModel)) {
|
|
|
|
|
+ return responseToJson(0, '赛事结果记录没有找到,数据错误');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($game_code == 'zq') {
|
|
|
|
|
+ $home = intval($pdatas['home']);
|
|
|
|
|
+ $guest = intval($pdatas['guest']);
|
|
|
|
|
+ $restModel->home_score = $home;
|
|
|
|
|
+ $restModel->guest_score = $guest;
|
|
|
|
|
+ $restModel->corner_ball = json_decode($restModel->corner_ball, 256);
|
|
|
|
|
+ $restModel->penalty_card = json_decode($restModel->penalty_card, 256);
|
|
|
|
|
+ $restModel->first_score = json_decode($restModel->first_score, 256);
|
|
|
|
|
+ $restModel->warn_more = json_decode($restModel->warn_more, 256);
|
|
|
|
|
+
|
|
|
|
|
+ $buyModel->single_result = json_encode([$restModel], 256);
|
|
|
|
|
+ $buyModel->result_flag = 1;
|
|
|
|
|
+ $ret = $buyModel->save();
|
|
|
|
|
+ if ($ret) {
|
|
|
|
|
+ $ret2 = $this->do_win_set($order_id, $game_code, $match_id);
|
|
|
|
|
+ if ($ret2['status'] == 1) {
|
|
|
|
|
+ return responseToJson(1, '操作成功!');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return responseToJson(0, '操作失败2!--' . $ret2['data']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return responseToJson(0, '更新失败1');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ return responseToJson(0, '未做更新', ['order_id' => $order_id, 'game_code' => $game_code, 'match_id' => $game_code, 'datas' => $pdatas]);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //先提交输赢,再结算
|
|
|
|
|
+ private function do_win_set($order_id, $game_code, $match_id)
|
|
|
|
|
+ {
|
|
|
|
|
+ $winret = $this->do_winfail($order_id, $game_code, $match_id);
|
|
|
|
|
+ if ($winret['status'] == 1) {
|
|
|
|
|
+ $setret = $this->do_settelement($order_id, $game_code, $match_id);
|
|
|
|
|
+ if ($setret['status'] == 1) {
|
|
|
|
|
+ return ['status' => 1, 'msg' => 'success', 'data' => []];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return ['status' => 0, 'msg' => 'failse', 'data' => $setret['msg']];
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return ['status' => 0, 'msg' => 'failse', 'data' => $winret['msg']];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //单订单手动提交输赢计算
|
|
|
|
|
+ private function do_winfail($order_id, $game_code, $match_id)
|
|
|
|
|
+ {
|
|
|
|
|
+ $data = [
|
|
|
|
|
+ 'token' => session('adminInfo.token'), //外网
|
|
|
|
|
+ 'order_id' => $order_id,
|
|
|
|
|
+ ];
|
|
|
|
|
+ $ret = $this->request_post(config('sconstant.url') . '/DoWinFailOneOrder', $data);
|
|
|
|
|
+ return json_decode($ret, true);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ //单订单手动提交结算
|
|
|
|
|
+ private function do_settelement($order_id, $game_code, $match_id)
|
|
|
|
|
+ {
|
|
|
|
|
+ $data = [
|
|
|
|
|
+ 'token' => session('adminInfo.token'), //外网
|
|
|
|
|
+ 'order_ids' => $order_id,
|
|
|
|
|
+ 'bettype' => 1,
|
|
|
|
|
+ 'settype' => 2,
|
|
|
|
|
+ 'game_code' => $game_code,
|
|
|
|
|
+ 'match_id' => $match_id,
|
|
|
|
|
+ 'change_status' => 0,
|
|
|
|
|
+ 'is_manual' => 1,
|
|
|
|
|
+ ];
|
|
|
|
|
+ $ret = $this->request_post(config('sconstant.url') . '/Settelement', $data);
|
|
|
|
|
+ return json_decode($ret, true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|