|
|
@@ -500,6 +500,31 @@ class SportsfootController extends Controller {
|
|
|
$model->first_score = json_encode($firstone,JSON_UNESCAPED_UNICODE);
|
|
|
|
|
|
$model->save();
|
|
|
+
|
|
|
+ //添加赛事结果记录
|
|
|
+ $lastLog = \App\Models\Stzqresultlog::where([
|
|
|
+ ['match_id', $match_id],
|
|
|
+ ['type', 1]
|
|
|
+ ])->orderBy('id', 'desc')->first();
|
|
|
+ if(empty($lastLog) || !($lastLog['penalty_card'] == $model->penalty_card
|
|
|
+ && $lastLog['corner_ball'] == $model->corner_ball
|
|
|
+ && $lastLog['first_score'] == $model->first_score
|
|
|
+ && $lastLog['last_score'] == $model->last_score
|
|
|
+ && $lastLog['match_winer'] == $model->match_winer
|
|
|
+ )){
|
|
|
+ \App\Models\Stzqresultlog::insert([
|
|
|
+ 'match_id' => $match_id,
|
|
|
+ 'penalty_card' => $model->penalty_card ,
|
|
|
+ 'corner_ball' => $model->corner_ball,
|
|
|
+ 'first_score' => $model->first_score,
|
|
|
+ 'last_score' => $model->last_score,
|
|
|
+ 'match_winer' => $model->match_winer,
|
|
|
+ 'user_id' => session('adminInfo.admin_id'),
|
|
|
+ 'type' => 1,
|
|
|
+ 'create_at' => now()
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
return responseToJson(1);
|
|
|
}
|
|
|
|
|
|
@@ -517,6 +542,23 @@ class SportsfootController extends Controller {
|
|
|
return $array;
|
|
|
}
|
|
|
|
|
|
+ //查询赛事结果记录
|
|
|
+ function resultLog(Req $req){
|
|
|
+ $match_id = $req->match_id;
|
|
|
+ $list = \App\Models\Stzqresultlog::leftJoin('system_user', 'user_id', '=', 'system_user.id')
|
|
|
+ ->select('st_zq_result_log.*', 'system_user.loginname')->where('match_id', $match_id)->orderBy('id', 'asc')->get();
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
+ $list[$key]['penalty_card'] = json_decode($value['penalty_card'], true);
|
|
|
+ $list[$key]['corner_ball'] = json_decode($value['corner_ball'], true);
|
|
|
+ $list[$key]['first_score'] = empty($value['first_score']) ? '' : json_decode($value['first_score'], true);
|
|
|
+ }
|
|
|
+ $result =array(
|
|
|
+ 'status' => 200,
|
|
|
+ 'list' => $list
|
|
|
+ );
|
|
|
+ echo json_encode($result);die;
|
|
|
+ }
|
|
|
+
|
|
|
function onlyresult(Req $req){
|
|
|
$match_id = $req->matchid;
|
|
|
$newapp = \App\Models\Stzqresult::where('match_id', $match_id)->first();
|
|
|
@@ -776,6 +818,27 @@ class SportsfootController extends Controller {
|
|
|
$twoapp->updatestatus('match_id',$match_id,['status'=>2]);//修改赛事状态
|
|
|
$newapp->updatestatus('match_id',$match_id,['status'=>2]);//修改结果状态
|
|
|
|
|
|
+ //添加赛事结果比较记录
|
|
|
+ $lastLog = \App\Models\Stzqresultlog::where([
|
|
|
+ ['match_id', $match_id],
|
|
|
+ ['type', 2]
|
|
|
+ ])->orderBy('id', 'desc')->first();
|
|
|
+
|
|
|
+ if(empty($lastLog) || !(
|
|
|
+ $lastLog['u_home_score'] == $data['u_home_score']
|
|
|
+ && $lastLog['u_guest_score'] == $data['u_guest_score']
|
|
|
+ && $lastLog['home_score'] == $data['home_score']
|
|
|
+ && $lastLog['guest_score'] == $data['guest_score']
|
|
|
+ )){
|
|
|
+ $logData = $data;
|
|
|
+ unset($logData['is_correct']);
|
|
|
+ $logData['type'] = 2;
|
|
|
+ $logData['match_id'] = $match_id;
|
|
|
+ $logData['user_id'] = session('adminInfo.admin_id');
|
|
|
+ $logData['create_at'] = now();
|
|
|
+ \App\Models\Stzqresultlog::insert($logData);
|
|
|
+ }
|
|
|
+
|
|
|
return responseToJson(1);
|
|
|
}
|
|
|
|