SportsfootController.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Http\Controllers\Controller;
  4. use Illuminate\Http\Request as Req;
  5. use Illuminate\Support\Facades\DB;
  6. Use App\Lib\Settlement\SettlementOrder;
  7. use App\Models;
  8. use Request;
  9. /**
  10. *足球结算
  11. */
  12. class SportsfootController extends Controller {
  13. function Settlement(Req $req){
  14. $jsurl = config('sconstant.url');//结算请求域名地址
  15. $match_id = $req->match_id;
  16. $type = $req->type;
  17. $token = session('adminInfo.token');
  18. $notice = \App\Models\Comendnotice::where('match_id', $match_id)->first();
  19. if(!$notice){
  20. return json_encode(['status'=>5,'msg'=>'请先核对结果,并提交结果']);
  21. }
  22. $noticeid = $notice['id'];
  23. //查询赛事单式是否有订单(足球)
  24. $newapp = new \App\Models\MoneyBuyMatch();
  25. $simplex_ids = array_column($newapp->allsimplexorder($match_id,'zq'),'order_id');
  26. $str_ids = array_column($newapp->allstrorder($match_id),'order_id');
  27. if(count($simplex_ids)>0 || count($str_ids)>0){
  28. $requet = file_get_contents($jsurl."/WinFail?noticeid=".$noticeid."&token=".$token);
  29. if(json_decode($requet,true)['status']==1){
  30. $napp = new \App\Models\Stzqresult();
  31. //单式结算
  32. if(count($simplex_ids)>0 && count($str_ids)==0){
  33. $huawei_res = $napp->simplexs($token,$match_id,$jsurl,'zq');
  34. if($huawei_res['status']==1){
  35. return json_encode(['status'=>1,'msg'=>'单式结算成功,没有串式订单']);
  36. }else{
  37. return json_encode(['status'=>3,'msg'=>'单式结算有误,请联系管理员!!!('.$huawei_res['msg'].')']);//结算错误
  38. }
  39. }elseif(count($str_ids)>0 && count($simplex_ids)==0){
  40. //串式结算
  41. $tandem_res = $napp->tandems($token,$match_id,$jsurl,'zq');
  42. if($tandem_res['status']==1){
  43. return json_encode(['status'=>1,'msg'=>'串式结算成功,没有单式订单']);
  44. }else{
  45. return json_encode(['status'=>3,'msg'=>'串式结算有误,请联系管理员!!!('.$tandem_res['msg'].')']);//结算错误
  46. }
  47. }elseif(count($str_ids)>0 && count($simplex_ids)>0){
  48. //既有单式又有串式
  49. $huawei_res = $napp->simplexs($token,$match_id,$jsurl,'zq');
  50. //串式结算
  51. $tandem_res = $napp->tandems($token,$match_id,$jsurl,'zq');
  52. if($tandem_res['status']==1 && $huawei_res['status']==1){
  53. return json_encode(['status'=>1,'msg'=>'结算成功']);
  54. }elseif($tandem_res['status']!=1 || $huawei_res['status']!=1){
  55. return json_encode(['status'=>3,'msg'=>'结算有误,请联系管理员!!!('.$tandem_res['msg'].$huawei_res['msg'].')']);
  56. }else{
  57. return json_encode(['status'=>3,'msg'=>'返回参数不对']);
  58. }
  59. }
  60. }else{
  61. return json_encode(['status'=>2,'msg'=>'判断输赢错误,请联系管理员!!!']);;//输赢错误
  62. }
  63. }else{
  64. $log = array(
  65. session('adminInfo.admin_name'),
  66. );
  67. OperationLog(session('adminInfo.admin_id'), '足球结算', $log);
  68. $res = \App\Models\Stzqresult::where ('match_id', $match_id)->update(['status' =>3]);
  69. $res = \App\Models\SportsSoccer::where ('match_id', $match_id)->update(['status' =>3]);
  70. return json_encode(['status'=>4,'msg'=>'该赛事没有任何订单,将会结束该赛事!!!']);
  71. }
  72. }
  73. //添加危险球列表
  74. function addwarn(Req $req){
  75. $match_id = $req->match_id;
  76. $warn = \App\Models\Stzqresult::where('match_id', $match_id)->select("warn_more")->first();
  77. $warnmore = json_decode($warn['warn_more'],true);
  78. $sousuo = $req->sousuo?$req->sousuo:'';
  79. if($sousuo){
  80. $shuzu = array();
  81. for ($i=0; $i < count($warnmore); $i++) {
  82. if($warnmore[$i]['rtype']==$sousuo){
  83. $shuzu[$i]['timei'] = $warnmore[$i]['timei'];
  84. $shuzu[$i]['rtype'] = $warnmore[$i]['rtype'];
  85. }
  86. }
  87. $shuzu = array_values($shuzu);
  88. $warnmore = $shuzu;
  89. $warnmore[0]['timei'] = 10000;
  90. }
  91. if($warnmore[0]['timei']!="1970-1-1 0:0:1"){
  92. $request['warnmore'] = $warnmore;
  93. $request['warnmore'][0]['rtype'] = $sousuo;
  94. }else{
  95. $request['warnmore'] = '';
  96. }
  97. $request['match_id'] = $match_id;
  98. $request['sousuo'] = $sousuo;
  99. return view('admin.sportsfoot/addwarn', $request);
  100. }
  101. //危险球查询
  102. function warnresult(Req $req){
  103. $match_id = $req->match_id;
  104. $wid = $req->wid;
  105. $warnonlys = \App\Models\Stzqresult::where('match_id', $match_id)->select("warn_more","start_time")->first();
  106. $warno = array(
  107. 'warn_more' => json_decode($warnonlys['warn_more'],true),
  108. 'starttime' => $warnonlys['start_time'],
  109. );
  110. return $warno;
  111. }
  112. //添加编辑危险球
  113. function addwarnonly(Req $req){
  114. $matchid = $req->matchid;
  115. $wid = $req->wid;//编辑对象值
  116. $timei = $req->timei?$req->timei:"1970-11-1 0:0:1";
  117. $rtype = $req->warntype?$req->warntype:0;
  118. $typenum = $req->typenum;
  119. $model = \App\Models\Stzqresult::where('match_id', $matchid)->select("warn_more","start_time")->first()->toArray();
  120. $sel = json_decode($model['warn_more'],true);
  121. $addru = array(
  122. array(
  123. 'timei'=>$timei,
  124. 'rtype'=>$rtype,
  125. ),
  126. );
  127. $only =$model['start_time'];
  128. $t = strtotime($only);
  129. $tt = date('Y-m-d H:i:s', $t+1*3*60*60);
  130. //timei']!="1970-1-1 0:0:1"
  131. if($only<$timei && $timei<$tt){
  132. if($typenum==10000){
  133. if($sel[0]['timei']=="1970-1-1 0:0:1"){
  134. //首次添加
  135. $res = \App\Models\Stzqresult::where ('match_id', $matchid)->update(['warn_more' => json_encode($addru,JSON_UNESCAPED_UNICODE)]);
  136. }else{
  137. //再次添加
  138. $upnum = array_merge_recursive($sel,$addru);
  139. $res = \App\Models\Stzqresult::where ('match_id', $matchid)->update(['warn_more' => json_encode($upnum,JSON_UNESCAPED_UNICODE)]);
  140. }
  141. }else{
  142. //编辑
  143. for ($i=0; $i < count($sel); $i++) {
  144. $sel[$wid]['timei'] = $timei;
  145. $sel[$wid]['rtype'] = $rtype;
  146. }
  147. $res = \App\Models\Stzqresult::where ('match_id', $matchid)->update(['warn_more' => json_encode($sel,JSON_UNESCAPED_UNICODE)]);
  148. }
  149. }else{
  150. return json_encode(['status'=>2,'msg'=>'请设置正确时间']);
  151. }
  152. return responseToJson(1);
  153. }
  154. //足球结果列表
  155. function outcome(Req $req) {
  156. $request=array();
  157. $request['home_team'] = isset($req->home_team) ? trim($req->home_team) : null;
  158. $request['status'] = isset($req->status) ? trim($req->status) : '-1';
  159. $request['sureblurs'] = isset($req->sureblurs) ? $req->sureblurs : 'on';
  160. $request['star_time'] = isset($req->star_time) ? trim($req->star_time) :trans('status.default_time.seven_day') ;
  161. $request['end_time'] = isset($req->end_time) ? trim($req->end_time) : trans('status.default_time.etime');
  162. $newapp = new \App\Models\SoccerLeague();
  163. $data = $newapp->allleague();
  164. $request['league'] = $data;//联赛id
  165. $request['token'] = session('adminInfo.token');//token 变量
  166. $dt = \App\Lib\DataTable\DataTable::init();
  167. $dt->setDataSource('/admin/sportsfoot/outcomeinfo');
  168. $dt->setLang('sportsfoot');
  169. $dt->addColsFields('newtime', array('templet' => '#newtime', 'sort' => false, 'width' => 200));
  170. $dt->addColsFields('totime', array('templet' => '#totime', 'sort' => false, 'width' => 80));
  171. $dt->addColsFields('home_team', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
  172. $dt->addColsFields('guest_team', array('templet' => '#userdetail', 'sort' => false, 'width' => 70));
  173. $dt->addColsFields('dsnum', array('templet' => '#dsnum', 'sort' => false, 'width' => 70));
  174. $dt->addColsFields('csnum', array('templet' => '#csnum', 'sort' => false, 'width' => 110));
  175. $dt->addColsFields('sxalfcourt', array('templet' => '#sxalfcourt', 'sort' => false, 'width' => 300));
  176. $dt->addColsFields('statusmatch', array('templet' => '#statusmatch', 'sort' => false, 'width' => 150,'align' => 'left'));
  177. $dt->addColsFields('operation', array('templet' => '#status', 'sort' => false, 'width' => 300));
  178. // $arr[] = 'view';
  179. // if (checkRriv('/admin/sportsfoot/edit')) {
  180. // $arr[] = 'edit';
  181. // }
  182. // $dt->setToolBar($arr, array('width' => 200));
  183. $dt->enableCheckBox();
  184. return view('admin.sportsfoot/outcome', $dt->render($request));
  185. }
  186. //结果添加
  187. function addend(Req $req){
  188. $match_id = $req->matchid;
  189. $model = \App\Models\Stzqresult::where('match_id', $match_id)->first();
  190. $penaltycard = array(
  191. 'home'=>intval($req->homeallcard)?intval($req->homeallcard):0,
  192. 'guest'=>intval($req->guestallcard)?intval($req->guestallcard):0,
  193. 'home_half'=>intval($req->homehalfcard)?intval($req->homehalfcard):0,
  194. 'guest_half'=>intval($req->guesthalfcard)?intval($req->guesthalfcard):0,
  195. );
  196. $cornerball = array(
  197. 'home'=>intval($req->homeallcorner)?intval($req->homeallcorner):0,
  198. 'guest'=>intval($req->guestallcorner)?intval($req->guestallcorner):0,
  199. 'home_half'=>intval($req->homehalfcorner)?intval($req->homehalfcorner):0,
  200. 'guest_half'=>intval($req->guesthalfcorner)?intval($req->guesthalfcorner):0,
  201. );
  202. $firstone = array(
  203. 'teamscore'=>$req->firstscore ? $req->firstscore:0,
  204. 'scoretime'=>intval($req->onescoretime)?intval($req->onescoretime):0,
  205. 'scoretype'=>$req->firststye ? $req->firststye:0,
  206. );
  207. $model->last_score = $req->lastscore?$req->lastscore:'';
  208. $model->match_winer = $req->matchwiner?$req->matchwiner:'';
  209. $model->penalty_card = json_encode($penaltycard,JSON_UNESCAPED_UNICODE);
  210. $model->corner_ball = json_encode($cornerball,JSON_UNESCAPED_UNICODE);
  211. $model->first_score = json_encode($firstone,JSON_UNESCAPED_UNICODE);
  212. $model->save();
  213. return responseToJson(1);
  214. }
  215. //查询赛事结果
  216. function Matchresult(Req $req){
  217. $match_id = $req->match_id;
  218. $newapp = \App\Models\Stzqresult::where('match_id', $match_id)->first();
  219. $array =array(
  220. 'corner_ball' => json_decode($newapp['corner_ball'],true),
  221. 'penalty_card' => json_decode($newapp['penalty_card'],true),
  222. 'first_score' => json_decode($newapp['first_score'],true),
  223. 'newapp' => $newapp,
  224. );
  225. return $array;
  226. }
  227. function onlyresult(Req $req){
  228. $match_id = $req->matchid;
  229. $newapp = \App\Models\Stzqresult::where('match_id', $match_id)->first();
  230. return $newapp;
  231. }
  232. //作废
  233. function revokeft(Req $req){
  234. $iszf = $req->iszf?$req->iszf:'';//赛事id
  235. if(intval($iszf)){
  236. $id = $req->input('id');
  237. if (empty($id)) {
  238. return responseToJson(-2001); //
  239. }
  240. $ids = explode(',', $id);
  241. if (!is_array($ids) && intval($ids) < 0) {
  242. return responseToJson(-2002); //
  243. }
  244. if (is_array($ids) && count($ids) > 0) {
  245. foreach ($ids as $k => $v) {
  246. if (intval($v) < 1) {
  247. unset($ids[$k]);
  248. }
  249. }
  250. }
  251. for ($ii=0; $ii < count($ids); $ii++) {
  252. $model = \App\Models\Stzqresult::where('id', $ids[$ii])->first();
  253. $model->status = 4;
  254. $model->save();
  255. $ssid = $model['match_id'];//赛事id
  256. $smodel = \App\Models\SportsSoccer::where('match_id', $ssid)->first();
  257. if($smodel){
  258. $smodel->status = 4;
  259. $smodel->save();
  260. }
  261. $upapp = new \App\Models\SportsNoteList();
  262. $data = $upapp->updatesimplex($ssid,'zq');//修改单式状态
  263. //单式撤单返现
  264. $newapp = new \App\Models\MoneyBuyMatch();
  265. $all = $newapp->allsimplexorder($ssid,'zq');
  266. for ($i=0; $i < count($all); $i++) {
  267. $appgx = new \App\Lib\Settlement\SettlementOrder();
  268. $appgx->insertData($all[$i]['order_id'], $all[$i]['money'], $all[$i]['account_identity'], '1', 'zq', $all[$i]['info_identity'], $all[$i]['money'],$all[$i]['match_id']);
  269. }
  270. //串式撤单只改状态
  271. $str_ids = array_column($newapp->allstrorder($ssid),'order_id');
  272. $csapp = new \App\Models\MoneyBuyStr();
  273. $csapp->updatestatus($str_ids);//var_dump($ss);die;
  274. //修改money_buy_match 投注结果result=2为平
  275. $newapp->updatast($ssid);
  276. }
  277. return responseToJson(1);
  278. }else{
  279. $match_id = $req->match_id;//赛事id
  280. $model = \App\Models\Stzqresult::where('match_id', $match_id)->first();
  281. $model->status = 4;
  282. $model->save();
  283. $smodel = \App\Models\SportsSoccer::where('match_id', $match_id)->first();
  284. if($smodel){
  285. $smodel->status = 4;
  286. $smodel->save();
  287. }
  288. $upapp = new \App\Models\SportsNoteList();
  289. $data = $upapp->updatesimplex($match_id,'zq');//修改单式状态
  290. //单式撤单返现
  291. $newapp = new \App\Models\MoneyBuyMatch();
  292. $all = $newapp->allsimplexorder($match_id,'zq');
  293. for ($i=0; $i < count($all); $i++) {
  294. $appgx = new \App\Lib\Settlement\SettlementOrder();
  295. $appgx->insertData($all[$i]['order_id'], $all[$i]['money'], $all[$i]['account_identity'], '1', 'zq', $all[$i]['info_identity'], $all[$i]['money'],$all[$i]['match_id']);
  296. }
  297. //串式撤单只改状态
  298. $str_ids = array_column($newapp->allstrorder($match_id),'order_id');
  299. $csapp = new \App\Models\MoneyBuyStr();
  300. $csapp->updatestatus($str_ids);//var_dump($ss);die;
  301. //修改money_buy_match 投注结果result=2为平
  302. $newapp->updatast($match_id);
  303. return responseToJson(1);
  304. }
  305. }
  306. //赛事结果修改
  307. function edit(Req $req) {
  308. $id = $req->id;
  309. if (intval($id) < 1) {
  310. return -1;
  311. }
  312. if (!$req->isMethod('post')) {
  313. $data = \App\Models\Stzqresult::where('id', $id)->first();
  314. if (!$data) {
  315. return -2;
  316. }
  317. $data = $data->toArray();
  318. return view('admin.sportsfoot/edit', $data);
  319. } else {
  320. $model = \App\Models\Stzqresult::where('id', $id)->first();
  321. $model->home_team = $req->input('home_team');
  322. $model->guest_team = $req->input('guest_team');
  323. $model->home_rate = $req->input('home_rate');
  324. $model->guest_rate = $req->input('guest_rate');
  325. $model->status = $req->input('status');
  326. //$model->update_time = time();
  327. $model->save();
  328. return responseToJson(1);
  329. }
  330. }
  331. function outcomeinfo() {
  332. $page = Request::has('page') ? Request::get('page') : '';
  333. $list = Request::has('limit') ? Request::get('limit') : 10;
  334. $home_team = Request::has('home_team') ? Request::get('home_team') : '';
  335. $sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
  336. $status = Request::has('status') ? Request::get('status') : '';
  337. $star_time = Request::get('star_time') ? Request::get('star_time').' 00:00:00' : '';
  338. $end_time = Request::get('end_time') ? Request::get('end_time').' 23:59:59' : '';
  339. $where = array();
  340. $orwhere = array();
  341. if (!empty($home_team)) {
  342. if (empty($sureblur) || $sureblur == 'off') {
  343. $where[] = array('st_zq_result.home_team', 'like', '%' . $home_team . '%');
  344. $orwhere[] = array('st_zq_result.guest_team', 'like', '%' . $home_team . '%');
  345. } else {
  346. if(is_numeric($home_team)){
  347. $where[] = array('st_zq_result.match_id', '=', $home_team);
  348. }else{
  349. $where[] = array('st_zq_result.home_team', '=', $home_team);
  350. $orwhere[] = array('st_zq_result.guest_team', '=', $home_team);
  351. }
  352. }
  353. }
  354. if ($status != -1) {
  355. $where[] = array('st_zq_result.status', '=', $status);
  356. $orwhere[] = array('st_zq_result.status', '=', $status);
  357. }
  358. if(!is_numeric($home_team)){
  359. if (!empty($star_time)) {
  360. $star_time = date('Y-m-d H:i:s', strtotime($star_time));
  361. $where[] = array('st_zq_result.start_time', '>', $star_time);
  362. $orwhere[] = array('st_zq_result.start_time', '>', $star_time);
  363. }
  364. if (!empty($end_time)) {
  365. $end_time = date('Y-m-d H:i:s', strtotime($end_time));
  366. $where[] = array('st_zq_result.start_time', '<', $end_time);
  367. $orwhere[] = array('st_zq_result.start_time', '<', $end_time);
  368. }
  369. }
  370. $newapp = new \App\Models\Stzqresult();
  371. $data = $newapp->resultlist($list, $page, $where, $orwhere);
  372. return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
  373. }
  374. function saislist(Req $req){
  375. $lgid = $req->lgid;//赛事id
  376. $newstzqcompetition = new \App\Models\Stzqcompetition();
  377. $league_data = $newstzqcompetition->allcompetition($lgid);//赛事id
  378. return $league_data;
  379. }
  380. //赛事结果添加 guest_score 客队进球 all_goal总进球数
  381. function addoutcome(Req $req) {
  382. if (!$req->isMethod('post')) {
  383. $lange = trans('menu');
  384. $newapp = new \App\Models\SoccerLeague();
  385. $league_data = $newapp->allleague();//联赛id
  386. return view('admin.sportsfoot/addoutcome',['data'=>$league_data]);
  387. } else {
  388. $match_id = trim($req->input('match_id'));//赛事id
  389. //添加足球比赛结果表
  390. $alldata = $req->input();
  391. unset($alldata['_token']);
  392. $all_goal = intval($alldata['home_score'])+intval($alldata['guest_score']);//总进球数
  393. $penaltycard = array(
  394. 'home'=>intval($alldata['homeallcard'])?intval($alldata['homeallcard']):0,
  395. 'guest'=>intval($alldata['guestallcard'])?intval($alldata['guestallcard']):0,
  396. 'home_half'=>intval($alldata['homehalfcard'])?intval($alldata['homehalfcard']):0,
  397. 'guest_half'=>intval($alldata['guesthalfcard'])?intval($alldata['guesthalfcard']):0,
  398. );
  399. $cornerball = array(
  400. 'home'=>intval($alldata['homeallcorner'])?intval($alldata['homeallcorner']):0,
  401. 'guest'=>intval($alldata['guestallcorner'])?intval($alldata['guestallcorner']):0,
  402. 'home_half'=>intval($alldata['homehalfcorner'])?intval($alldata['homehalfcorner']):0,
  403. 'guest_half'=>intval($alldata['guesthalfcorner'])?intval($alldata['guesthalfcorner']):0,
  404. );
  405. $ret = \App\Models\Stzqresult::updateOrCreate(['match_id'=>$match_id],array_merge($alldata,['match_time'=>'00:01','update_time'=>date('Y-m-d H:i:s'),'all_goal'=>$all_goal,'penalty_card'=>json_encode($penaltycard),'corner_ball'=>json_encode($cornerball)]));
  406. //添加足球比赛结果记录表
  407. \App\Models\Stzqresultrecord::updateOrCreate(['match_id'=>$match_id,'update_time'=>date('Y-m-d H:i:s')],array_merge($alldata,['match_time'=>'00:01','update_time'=>date('Y-m-d H:i:s')]));
  408. }
  409. return responseToJson(1);
  410. }
  411. //删除赛事结果
  412. function deleteoutcome(Req $req) {
  413. $id = $req->input('id');
  414. if (empty($id)) {
  415. return responseToJson(-2001); //
  416. }
  417. $ids = explode(',', $id);
  418. if (!is_array($ids) && intval($ids) < 0) {
  419. return responseToJson(-2002); //
  420. }
  421. if (is_array($ids) && count($ids) > 0) {
  422. foreach ($ids as $k => $v) {
  423. if (intval($v) < 1) {
  424. unset($ids[$k]);
  425. }
  426. }
  427. }
  428. $rows = \App\Models\Stzqresult::whereIn('id', $ids)->delete();
  429. if (!$rows) {
  430. return responseToJson(-2003);
  431. }
  432. return responseToJson(1);
  433. }
  434. //更新赛事比分
  435. function updatenum(Req $req){
  436. $match_id = $req->match_id;
  437. $newapp = new \App\Models\Stzqresult();
  438. $data['u_home_score'] = intval($req->u_home_score)?intval($req->u_home_score):0;
  439. $data['u_guest_score'] = intval($req->u_guest_score)?intval($req->u_guest_score):0;
  440. $data['home_score'] = intval($req->home_score)?intval($req->home_score):0;
  441. $data['guest_score'] = intval($req->guest_score)?intval($req->guest_score):0;
  442. $newapp->updateInfo($data,$match_id);//联赛id
  443. $newapp->totalgoal($match_id);
  444. $update = $this->addcomendnotice($match_id);
  445. $twoapp = new \App\Models\SportsSoccer();
  446. $twoapp->updatestatus('match_id',$match_id,['status'=>2]);//修改赛事状态
  447. $newapp->updatestatus('match_id',$match_id,['status'=>2]);//修改结果状态
  448. return responseToJson(1);
  449. }
  450. //添加赛事结束纪录
  451. function addcomendnotice($match_id){
  452. $data = \App\Models\Comendnotice::where(['match_id'=>$match_id,'game_code'=>'zq'])->first();
  453. if(!$data){
  454. $model = new \App\Models\Comendnotice();
  455. $model->status = 0;//联赛id
  456. $model->game_code = 'zq';
  457. $model->match_id = $match_id;//赛事id
  458. $model->ctime = date('Y-m-d H:i:s');
  459. $model->save();
  460. }
  461. return responseToJson(1);
  462. }
  463. }