|
@@ -14,11 +14,16 @@ use Request;
|
|
|
class SportsTennisController extends Controller {
|
|
class SportsTennisController extends Controller {
|
|
|
|
|
|
|
|
public function score(Req $req) {
|
|
public function score(Req $req) {
|
|
|
- $request['name_chinese'] = isset($req->name_chinese) ? trim($req->name_chinese) : null;
|
|
|
|
|
|
|
+ $request['name_chinese'] = isset($req->name_chinese) ? trim($req->name_chinese) : '-1';
|
|
|
|
|
+ $request['home_team'] = isset($req->home_team) ? trim($req->home_team) : null;
|
|
|
|
|
+ $request['match_date'] = isset($req->match_date) ? trim($req->match_date) : null;
|
|
|
|
|
+ $request['status'] = isset($req->status) ? trim($req->status) : '-1';
|
|
|
$request['sureblurs'] = isset($req->sureblurs) ? $req->sureblurs : 'on';
|
|
$request['sureblurs'] = isset($req->sureblurs) ? $req->sureblurs : 'on';
|
|
|
|
|
+ $data = \App\Models\TennisLeague::select('id','lg_id','name_chinese')->get();
|
|
|
|
|
+ $request['league'] = $data;
|
|
|
$dt = \App\Lib\DataTable\DataTable::init();
|
|
$dt = \App\Lib\DataTable\DataTable::init();
|
|
|
$dt->setDataSource('/admin/SportsTennis/info');
|
|
$dt->setDataSource('/admin/SportsTennis/info');
|
|
|
- $dt->setLang('sportsbase');
|
|
|
|
|
|
|
+ $dt->setLang('sportstennis');
|
|
|
$dt->addColsFields('match_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 100));
|
|
$dt->addColsFields('match_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 100));
|
|
|
$dt->addColsFields('lg_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 80));
|
|
$dt->addColsFields('lg_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 80));
|
|
|
$dt->addColsFields('name_chinese', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
|
|
$dt->addColsFields('name_chinese', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
|
|
@@ -40,25 +45,46 @@ class SportsTennisController extends Controller {
|
|
|
return view('sports/tennis_match', $dt->render($request));
|
|
return view('sports/tennis_match', $dt->render($request));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function info() {
|
|
|
|
|
- $lange = trans('sportssoccer');
|
|
|
|
|
|
|
+ function info(Req $req) {
|
|
|
$page = Request::has('page') ? Request::get('page') : '';
|
|
$page = Request::has('page') ? Request::get('page') : '';
|
|
|
$list = Request::has('limit') ? Request::get('limit') : 10;
|
|
$list = Request::has('limit') ? Request::get('limit') : 10;
|
|
|
$name_chinese = Request::has('name_chinese') ? Request::get('name_chinese') : '';
|
|
$name_chinese = Request::has('name_chinese') ? Request::get('name_chinese') : '';
|
|
|
|
|
+ $home_team = Request::has('home_team') ? Request::get('home_team') : '';
|
|
|
|
|
+ $match_date = Request::has('match_date') ? Request::get('match_date') : '';
|
|
|
|
|
+ //$match_date = $req->input('match_date');
|
|
|
|
|
+// if(!empty($match_date)){
|
|
|
|
|
+// return 2;
|
|
|
|
|
+// }
|
|
|
|
|
+ $status = Request::has('status') ? Request::get('status') : '';
|
|
|
$sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
|
|
$sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
|
|
|
$where = array();
|
|
$where = array();
|
|
|
- if (!empty($name_chinese)) {
|
|
|
|
|
|
|
+ $orwhere = array();
|
|
|
|
|
+ if (!empty($name_chinese) && $name_chinese!=-1) {
|
|
|
|
|
+ $where[] = array('st_wq_league.name_chinese', '=', $name_chinese);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!empty($home_team)) {
|
|
|
if (empty($sureblur) || $sureblur == 'off') {
|
|
if (empty($sureblur) || $sureblur == 'off') {
|
|
|
- $where[] = array('st_wq_league.name_chinese', 'like', '%' . $name_chinese . '%');
|
|
|
|
|
|
|
+ $where[] = array('st_wq_competition.home_team', 'like', '%' . $home_team . '%');
|
|
|
|
|
+ $orwhere[] = array('st_wq_competition.guest_team', 'like', '%' . $home_team . '%');
|
|
|
} else {
|
|
} else {
|
|
|
- $where[] = array('st_wq_league.name_chinese', '=', $name_chinese);
|
|
|
|
|
|
|
+ $where[] = array('st_wq_competition.home_team', '=', $home_team);
|
|
|
|
|
+ $orwhere[] = array('st_wq_competition.guest_team', '=', $home_team);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if (!empty($match_date)) {
|
|
|
|
|
+// $where[] = array('st_wq_competition.match_date', '=', '2019-04-13');
|
|
|
|
|
+ $where[] = array('st_wq_competition.match_date', '=', $match_date);
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($status != -1) {
|
|
|
|
|
+ $where[] = array('st_wq_competition.status', '=', $status);
|
|
|
|
|
+ }
|
|
|
$newapp = new \App\Models\SportsTennis();
|
|
$newapp = new \App\Models\SportsTennis();
|
|
|
- $data = $newapp->getinfo($list, $page, $where);
|
|
|
|
|
|
|
+ $data = $newapp->getinfo($list, $page, $where,$orwhere);
|
|
|
return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
|
|
return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ *获取所有足球联赛信息
|
|
|
|
|
+ */
|
|
|
function getParent() {
|
|
function getParent() {
|
|
|
$data = \App\Models\TennisLeague::select('id','lg_id','name_chinese')->get();
|
|
$data = \App\Models\TennisLeague::select('id','lg_id','name_chinese')->get();
|
|
|
if (!$data) {
|
|
if (!$data) {
|
|
@@ -66,20 +92,50 @@ class SportsTennisController extends Controller {
|
|
|
}
|
|
}
|
|
|
return $data->toArray();
|
|
return $data->toArray();
|
|
|
}
|
|
}
|
|
|
|
|
+ /**
|
|
|
|
|
+ *获取所有国家信息
|
|
|
|
|
+ */
|
|
|
|
|
+ function getCountry() {
|
|
|
|
|
+ $data = \App\Models\Country::select('country_id','name_chinese')->get();
|
|
|
|
|
+ if (!$data) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ for($i=0;$i<count($data);$i++){
|
|
|
|
|
+ $data[$i]->home_country_name = $data[$i]->name_chinese;
|
|
|
|
|
+ $data[$i]->home_country_id = $data[$i]->country_id;
|
|
|
|
|
+ $data[$i]->guest_country_name = $data[$i]->name_chinese;
|
|
|
|
|
+ $data[$i]->guest_country_id = $data[$i]->country_id;
|
|
|
|
|
+ }
|
|
|
|
|
+ return $data->toArray();
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ *获取国家的球队信息
|
|
|
|
|
+ */
|
|
|
|
|
+ function getteam() {
|
|
|
|
|
+ $countryid = $_GET["countryid"];
|
|
|
|
|
+ $gametype = \App\Models\StGameType::where('game_code','wq')->first();
|
|
|
|
|
+ $res = \App\Models\Team::where('country_id',$countryid)->where('game_type_id',$gametype->id)->get();
|
|
|
|
|
+ return json_encode($res);
|
|
|
|
|
+ }
|
|
|
/**
|
|
/**
|
|
|
*添加赛事
|
|
*添加赛事
|
|
|
*/
|
|
*/
|
|
|
function add(Req $req) {
|
|
function add(Req $req) {
|
|
|
if (!$req->isMethod('post')) {
|
|
if (!$req->isMethod('post')) {
|
|
|
- $data = $this->getParent();
|
|
|
|
|
|
|
+ $parents = $this->getParent();
|
|
|
|
|
+ $country = $this->getCountry();
|
|
|
|
|
+ $countrys = $this->getCountry();
|
|
|
$lange = trans('menu');
|
|
$lange = trans('menu');
|
|
|
- foreach ($data as $k => $v) {
|
|
|
|
|
- $arr = trim($data[$k]['name_chinese']);
|
|
|
|
|
|
|
+ foreach ($parents as $k => $v) {
|
|
|
|
|
+ $arr = trim($parents[$k]['name_chinese']);
|
|
|
if (isset($lange[$arr])) {
|
|
if (isset($lange[$arr])) {
|
|
|
- $data[$k]['name']=$lange[$arr];
|
|
|
|
|
|
|
+ $parents[$k]['name']=$lange[$arr];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return view('sports.tennis_form', array('parents' => $data));
|
|
|
|
|
|
|
+ $data['parents'] = $parents;
|
|
|
|
|
+ $data['country'] = $country;
|
|
|
|
|
+ $data['countrys'] = $countrys;
|
|
|
|
|
+ return view('sports.Tennis_form', $data);
|
|
|
} else {
|
|
} else {
|
|
|
$model = new \App\Models\SportsTennis();
|
|
$model = new \App\Models\SportsTennis();
|
|
|
$model->home_team = $req->input('home_team');
|
|
$model->home_team = $req->input('home_team');
|
|
@@ -113,16 +169,24 @@ class SportsTennisController extends Controller {
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
if (!$req->isMethod('post')) {
|
|
if (!$req->isMethod('post')) {
|
|
|
-
|
|
|
|
|
|
|
+ $country = $this->getCountry();
|
|
|
|
|
+ $countrys = $this->getCountry();
|
|
|
$data = \App\Models\SportsTennis::where('id', $id)->first();
|
|
$data = \App\Models\SportsTennis::where('id', $id)->first();
|
|
|
if (!$data) {
|
|
if (!$data) {
|
|
|
return -2;
|
|
return -2;
|
|
|
}
|
|
}
|
|
|
$name_chinese = \App\Models\TennisLeague::where('lg_id', $data->lg_id)->first();
|
|
$name_chinese = \App\Models\TennisLeague::where('lg_id', $data->lg_id)->first();
|
|
|
|
|
+// $home_team = \App\Models\Team::where('team_name_cn', $data->home_team)->first();
|
|
|
|
|
+// $guest_team = \App\Models\Team::where('team_name_cn', $data->guest_team)->first();
|
|
|
|
|
+// $home_country = \App\Models\Country::where('country_id', $home_team->country_id)->first();
|
|
|
|
|
+// $guest_country = \App\Models\Country::where('country_id', $guest_team->country_id)->first();
|
|
|
$data->name_chinese = $name_chinese->name_chinese;
|
|
$data->name_chinese = $name_chinese->name_chinese;
|
|
|
- $data->league_id = $name_chinese->lg_id;
|
|
|
|
|
|
|
+// $data->home_country_id = $home_country->country_id;
|
|
|
|
|
+// $data->guest_country_id = $guest_country->country_id;
|
|
|
$data = $data->toArray();
|
|
$data = $data->toArray();
|
|
|
$data['parents'] = $this->getParent();
|
|
$data['parents'] = $this->getParent();
|
|
|
|
|
+ $data['country'] = $country;
|
|
|
|
|
+ $data['countrys'] = $countrys;
|
|
|
|
|
|
|
|
|
|
|
|
|
//$lange = trans('menu');
|
|
//$lange = trans('menu');
|
|
@@ -133,7 +197,7 @@ class SportsTennisController extends Controller {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return view('sports.tennis_form', $data);
|
|
|
|
|
|
|
+ return view('sports.Tennis_form', $data);
|
|
|
} else {
|
|
} else {
|
|
|
$model = new \App\Models\SportsTennis();
|
|
$model = new \App\Models\SportsTennis();
|
|
|
$model->id = $req->input('id');
|
|
$model->id = $req->input('id');
|
|
@@ -188,23 +252,33 @@ class SportsTennisController extends Controller {
|
|
|
function odds(Req $req)
|
|
function odds(Req $req)
|
|
|
{
|
|
{
|
|
|
$cp_id = $req->id;
|
|
$cp_id = $req->id;
|
|
|
|
|
+ $request['status'] = isset($req->status) ? trim($req->status) : '-1';
|
|
|
|
|
+ $request['p_code'] = isset($req->p_code) ? trim($req->p_code) : '-1';
|
|
|
$request['id'] = isset($req->id) ? trim($req->id) : null;
|
|
$request['id'] = isset($req->id) ? trim($req->id) : null;
|
|
|
- $newapp = new \App\Models\SportsTennis();
|
|
|
|
|
- $match_id = $newapp->getmatchid($request['id']);
|
|
|
|
|
|
|
+ $newapp = \App\Models\SportsTennis::where('id',$request['id'])->first();
|
|
|
|
|
+ // $match_id = $newapp->match_id;
|
|
|
|
|
+ if(empty($newapp)){
|
|
|
|
|
+ $match_id = $req->input('cp_id');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $match_id = $newapp->match_id;
|
|
|
|
|
+ }
|
|
|
$request['match_id'] = isset($match_id) ? trim($match_id) : null;
|
|
$request['match_id'] = isset($match_id) ? trim($match_id) : null;
|
|
|
|
|
+ $data = \App\Models\Matchcode::where('p_id','0')->where('game_type','wq')->get();
|
|
|
|
|
+ $request['pcode'] = $data;
|
|
|
$dt = \App\Lib\DataTable\DataTable::init();
|
|
$dt = \App\Lib\DataTable\DataTable::init();
|
|
|
$dt->setDataSource('/admin/SportsTennis/oddsinfo?match_id='.$match_id.'');
|
|
$dt->setDataSource('/admin/SportsTennis/oddsinfo?match_id='.$match_id.'');
|
|
|
$dt->setLang('sportssoccer');
|
|
$dt->setLang('sportssoccer');
|
|
|
$dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 80));
|
|
$dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 80));
|
|
|
$dt->addColsFields('match_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 100));
|
|
$dt->addColsFields('match_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 100));
|
|
|
- $dt->addColsFields('odds_code', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
|
|
|
|
|
|
|
+ $dt->addColsFields('odds_code_cn', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
|
|
|
$dt->addColsFields('condition', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
|
|
$dt->addColsFields('condition', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
|
|
|
$dt->addColsFields('odds', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
|
|
$dt->addColsFields('odds', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
|
|
|
// $dt->addColsFields('p_id', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
|
|
// $dt->addColsFields('p_id', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
|
|
|
- $dt->addColsFields('p_code', array('templet' => '#userdetail', 'sort' => false, 'width' => 120));
|
|
|
|
|
|
|
+ $dt->addColsFields('p_code_cn', array('templet' => '#userdetail', 'sort' => false, 'width' => 120));
|
|
|
$dt->addColsFields('max', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
|
|
$dt->addColsFields('max', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
|
|
|
$dt->addColsFields('min', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
|
|
$dt->addColsFields('min', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
|
|
|
$dt->addColsFields('status', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
|
|
$dt->addColsFields('status', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
|
|
|
|
|
+ $dt->addColsFields('expire_time', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
|
|
|
if (checkRriv('/admin/SportsTennis/oddsedit?id='.$cp_id.'')) {
|
|
if (checkRriv('/admin/SportsTennis/oddsedit?id='.$cp_id.'')) {
|
|
|
$arr[] = 'oddsedit';
|
|
$arr[] = 'oddsedit';
|
|
|
}
|
|
}
|
|
@@ -215,13 +289,23 @@ class SportsTennisController extends Controller {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function oddsinfo(Req $req){
|
|
function oddsinfo(Req $req){
|
|
|
- $lange = trans('sportssoccer');
|
|
|
|
|
|
|
+ $lange = trans('sportsoddscode');
|
|
|
$match_id = $req->match_id;
|
|
$match_id = $req->match_id;
|
|
|
|
|
+ $p_code = Request::has('p_code') ? Request::get('p_code') : '';
|
|
|
|
|
+ $status = Request::has('status') ? Request::get('status') : '';
|
|
|
|
|
+ $where = array();
|
|
|
|
|
+ if (!empty($p_code) && $p_code!=-1) {
|
|
|
|
|
+ $where[] = array('st_wq_odds.p_code', '=', $p_code);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!empty($status) && $status != -1) {
|
|
|
|
|
+ $where[] = array('st_wq_odds.status', '=', $status);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (intval($match_id) < 1) {
|
|
if (intval($match_id) < 1) {
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
$new = new \App\Models\TennisOdds();
|
|
$new = new \App\Models\TennisOdds();
|
|
|
- $data = $new->getodds($match_id);
|
|
|
|
|
|
|
+ $data = $new->getodds($match_id,$where);
|
|
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
foreach ($data as $k => $v) {
|
|
|
$odds_code = trim($data[$k]['odds_code']);
|
|
$odds_code = trim($data[$k]['odds_code']);
|
|
@@ -241,16 +325,15 @@ class SportsTennisController extends Controller {
|
|
|
*/
|
|
*/
|
|
|
function getoddscode() {
|
|
function getoddscode() {
|
|
|
$p_code = $_GET["pcode"];
|
|
$p_code = $_GET["pcode"];
|
|
|
- $res = \App\Models\TennisGame::where('odds_code',$p_code)->first();
|
|
|
|
|
- $codedata = \App\Models\TennisGame::where('pid',$res->id)->get();
|
|
|
|
|
|
|
+ $res = \App\Models\Matchcode::where('odds_code',$p_code)->first();
|
|
|
|
|
+ $codedata = \App\Models\Matchcode::where('p_id',$res->id)->get();
|
|
|
return json_encode($codedata);
|
|
return json_encode($codedata);
|
|
|
}
|
|
}
|
|
|
/**
|
|
/**
|
|
|
*添加赔率
|
|
*添加赔率
|
|
|
*/
|
|
*/
|
|
|
function addodds(Req $req) {
|
|
function addodds(Req $req) {
|
|
|
- //$lange = trans('sportssoccer');
|
|
|
|
|
- $pcodedata = \App\Models\TennisGame::where('pid','0')->get();
|
|
|
|
|
|
|
+ $pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_type','wq')->get();
|
|
|
for($i=0;$i<count($pcodedata);$i++){
|
|
for($i=0;$i<count($pcodedata);$i++){
|
|
|
$pcodedata[$i]->p_code = $pcodedata[$i]->odds_code;
|
|
$pcodedata[$i]->p_code = $pcodedata[$i]->odds_code;
|
|
|
}
|
|
}
|
|
@@ -262,13 +345,12 @@ class SportsTennisController extends Controller {
|
|
|
return view('sports.tennis_odds_form',$data);
|
|
return view('sports.tennis_odds_form',$data);
|
|
|
} else {
|
|
} else {
|
|
|
$model = new \App\Models\TennisOdds();
|
|
$model = new \App\Models\TennisOdds();
|
|
|
- $id = $req->input('match_id');
|
|
|
|
|
- $rew = \App\Models\SportsTennis::where('id',$id)->first();
|
|
|
|
|
- $model->match_id = $rew->match_id;
|
|
|
|
|
|
|
+ $date = new \App\Models\TennisOddsRecord();
|
|
|
|
|
+ $model->match_id = $req->input('match_id');
|
|
|
$model->odds_code = $req->input('code');
|
|
$model->odds_code = $req->input('code');
|
|
|
$model->status = $req->input('status');
|
|
$model->status = $req->input('status');
|
|
|
$model->p_code = $req->input('pcode');
|
|
$model->p_code = $req->input('pcode');
|
|
|
- $res = \App\Models\TennisGame::where('odds_code',$model->p_code)->first();
|
|
|
|
|
|
|
+ $res = \App\Models\Matchcode::where('odds_code',$model->p_code)->first();
|
|
|
$model->p_id = $res->id;
|
|
$model->p_id = $res->id;
|
|
|
$result = \App\Models\TennisOdds::where('odds_code',$model->odds_code)->where('p_id',$model->p_id)->orderby('utime','desc')->first();
|
|
$result = \App\Models\TennisOdds::where('odds_code',$model->odds_code)->where('p_id',$model->p_id)->orderby('utime','desc')->first();
|
|
|
if(!empty($result)){
|
|
if(!empty($result)){
|
|
@@ -289,7 +371,33 @@ class SportsTennisController extends Controller {
|
|
|
if(!empty($lg_id)){
|
|
if(!empty($lg_id)){
|
|
|
$model->lg_id = $lg_id->lg_id;
|
|
$model->lg_id = $lg_id->lg_id;
|
|
|
}
|
|
}
|
|
|
|
|
+ $model->expire_time = $req->input('expire_time');
|
|
|
|
|
+ $model->odds_only = md5($model->match_id.$model->odds_code.$model->ctime);
|
|
|
|
|
+
|
|
|
|
|
+ $date->match_id = $model->match_id;
|
|
|
|
|
+ $date->odds_code = $model->odds_code;
|
|
|
|
|
+ $date->status = $model->status;
|
|
|
|
|
+ $date->p_code = $model->p_code;
|
|
|
|
|
+ $date->p_id = $model->p_id;
|
|
|
|
|
+ $record = \App\Models\TennisOddsRecord::where('odds_code',$date->odds_code)->where('p_id',$date->p_id)->orderby('utime','desc')->first();
|
|
|
|
|
+ if(!empty($record)){
|
|
|
|
|
+ $sort = $record->sort;
|
|
|
|
|
+ $date->sort = $sort+1;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $date->sort = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ $date->odds = $model->odds;
|
|
|
|
|
+ $date->condition = $model->condition;
|
|
|
|
|
+ $date->max = $model->max;
|
|
|
|
|
+ $date->min = $model->min;
|
|
|
|
|
+ $date->ctime = $model->ctime;
|
|
|
|
|
+ $date->utime = $model->utime;
|
|
|
|
|
+ $date->source = $model->source;
|
|
|
|
|
+ $date->lg_id = $model->lg_id;
|
|
|
|
|
+ $date->odds_only = $model->odds_only;
|
|
|
|
|
+
|
|
|
$model->save();
|
|
$model->save();
|
|
|
|
|
+ $date->save();
|
|
|
return responseToJson(1);
|
|
return responseToJson(1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -297,9 +405,7 @@ class SportsTennisController extends Controller {
|
|
|
*修改赔率
|
|
*修改赔率
|
|
|
*/
|
|
*/
|
|
|
function oddsedit(Req $req) {
|
|
function oddsedit(Req $req) {
|
|
|
- $lange = trans('sportssoccer');
|
|
|
|
|
- $pcodedata = \App\Models\TennisGame::where('pid','0')->get();
|
|
|
|
|
- //$codedata = \App\Models\SoccerGame::where('pid','!=','0')->get();
|
|
|
|
|
|
|
+ $pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_type','wq')->get();
|
|
|
for($i=0;$i<count($pcodedata);$i++){
|
|
for($i=0;$i<count($pcodedata);$i++){
|
|
|
$pcodedata[$i]->p_code = $pcodedata[$i]->odds_code;
|
|
$pcodedata[$i]->p_code = $pcodedata[$i]->odds_code;
|
|
|
}
|
|
}
|
|
@@ -313,23 +419,30 @@ class SportsTennisController extends Controller {
|
|
|
if (!$data) {
|
|
if (!$data) {
|
|
|
return -2;
|
|
return -2;
|
|
|
}
|
|
}
|
|
|
|
|
+ $res = \App\Models\Matchcode::where('odds_code', $data->odds_code)->where('game_type','wq')->first();
|
|
|
|
|
+ $data->odds_name = $res->odds_name;
|
|
|
|
|
|
|
|
- $odds_code = trim($data['odds_code']);
|
|
|
|
|
- $p_code = trim($data['p_code']);
|
|
|
|
|
|
|
+ $expire_time = $data->expire_time; //2019-04-15 21:10:00
|
|
|
|
|
+ $str1 = str_replace(" ","T",$expire_time);
|
|
|
|
|
+ $data->expire_time = $str1;
|
|
|
|
|
+
|
|
|
|
|
+ $odds_code = trim($data->odds_code);
|
|
|
|
|
+ $p_code = trim($data->p_code);
|
|
|
if (isset($lange[$odds_code])) {
|
|
if (isset($lange[$odds_code])) {
|
|
|
- $data['odds_code_cn']=$lange[$odds_code];
|
|
|
|
|
|
|
+ $data->odds_code_cn=$lange[$odds_code];
|
|
|
}
|
|
}
|
|
|
if (isset($lange[$p_code])) {
|
|
if (isset($lange[$p_code])) {
|
|
|
- $data['p_code_cn']=$lange[$p_code];
|
|
|
|
|
|
|
+ $data->p_code_cn=$lange[$p_code];
|
|
|
}
|
|
}
|
|
|
$data = $data->toArray();
|
|
$data = $data->toArray();
|
|
|
|
|
|
|
|
$data['pcode'] = $pcodedata;
|
|
$data['pcode'] = $pcodedata;
|
|
|
//$data['code'] = $codedata;
|
|
//$data['code'] = $codedata;
|
|
|
|
|
|
|
|
- return view('sports.soccer_odds_form', $data);
|
|
|
|
|
|
|
+ return view('sports.tennis_odds_form', $data);
|
|
|
} else {
|
|
} else {
|
|
|
$model = new \App\Models\TennisOdds();
|
|
$model = new \App\Models\TennisOdds();
|
|
|
|
|
+ $data = new \App\Models\TennisOddsRecord();
|
|
|
$model->id = $req->input('id');
|
|
$model->id = $req->input('id');
|
|
|
$model = $model::find($model->id);
|
|
$model = $model::find($model->id);
|
|
|
$model->odds_code = $req->input('code');
|
|
$model->odds_code = $req->input('code');
|
|
@@ -341,8 +454,34 @@ class SportsTennisController extends Controller {
|
|
|
$model->min = $req->input('min');
|
|
$model->min = $req->input('min');
|
|
|
$model->ctime = date('Y-m-d H:i:s',time());
|
|
$model->ctime = date('Y-m-d H:i:s',time());
|
|
|
$model->utime = date('Y-m-d H:i:s',time());
|
|
$model->utime = date('Y-m-d H:i:s',time());
|
|
|
|
|
+ $model->expire_time = $req->input('expire_time');
|
|
|
|
|
+ $model->odds_only = md5($model->match_id.$model->odds_code.$model->ctime);
|
|
|
|
|
+
|
|
|
|
|
+ $result = \App\Models\TennisOdds::where('id',$model->id)->first();
|
|
|
|
|
+ $data->match_id = $result->match_id;
|
|
|
|
|
+ $data->odds_code = $model->odds_code;
|
|
|
|
|
+ $data->status = $model->status;
|
|
|
|
|
+ $data->p_code = $model->p_code;
|
|
|
|
|
+ $data->p_id = $model->p_id;
|
|
|
|
|
+ $record = \App\Models\TennisOddsRecord::where('match_id',$data->match_id)->where('odds_code',$data->odds_code)->where('p_id',$data->p_id)->orderby('utime','desc')->first();
|
|
|
|
|
+ if(!empty($record)){
|
|
|
|
|
+ $sort = $record->sort;
|
|
|
|
|
+ $data->sort = $sort+1;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $data->sort = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ $data->odds = $model->odds;
|
|
|
|
|
+ $data->condition = $model->condition;
|
|
|
|
|
+ $data->max = $model->max;
|
|
|
|
|
+ $data->min = $model->min;
|
|
|
|
|
+ $data->ctime = $model->ctime;
|
|
|
|
|
+ $data->utime = $model->utime;
|
|
|
|
|
+ $data->source = $result->source;
|
|
|
|
|
+ $data->lg_id = $result->lg_id;
|
|
|
|
|
+ $data->odds_only = $result->odds_only;
|
|
|
|
|
|
|
|
$model->save();
|
|
$model->save();
|
|
|
|
|
+ $data->save();
|
|
|
return responseToJson(1);
|
|
return responseToJson(1);
|
|
|
}
|
|
}
|
|
|
|
|
|